Code Monkey home page Code Monkey logo

Comments (7)

linouk23 avatar linouk23 commented on May 30, 2024 3

@mallie-su @sc-alistairdeneys my team discussed this issue internally and I'm happy to let you know that we'll add this functionality in our upcoming 0.8.0 release.

from terraform-provider-confluent.

mallie-su avatar mallie-su commented on May 30, 2024 1

The hacky way works like a charm! Not quiet user friendly, espcially with a remote state, but eh, it works!
But I do think that the feature to import the keys would be much easier 😉

Thanks a lot @linouk23!

from terraform-provider-confluent.

linouk23 avatar linouk23 commented on May 30, 2024 1

@mallie-su @sc-alistairdeneys @Talgatele we're happy to let you know that we've implemented import for confluent_api_key resource in our latest 0.8.0 release.

from terraform-provider-confluent.

sc-alistairdeneys avatar sc-alistairdeneys commented on May 30, 2024 1

Fantastic! Thanks for the notification @linouk23

from terraform-provider-confluent.

linouk23 avatar linouk23 commented on May 30, 2024

@mallie-su thanks for opening an issue! That's very exciting you've proactively migrated to 0.7.0 and it went smoothly for you!

We're thinking about adding an import functionality for confluent_api_key but it's not supported at the moment.

One hacky thing you could do right now is to fake an import (I'll use Kafka API Key as an example) by:

  1. Adding its config to your TF configuration file (main.tf):
# Adjust the variables
resource "confluent_api_key" "app-producer-kafka-api-key" {
  display_name = "app-producer-kafka-api-key"
  description  = "Kafka API Key that is owned by 'app-producer' service account"
  owner {
    id          = confluent_service_account.app-producer.id
    api_version = confluent_service_account.app-producer.api_version
    kind        = confluent_service_account.app-producer.kind
  }

  managed_resource {
    id          = confluent_kafka_cluster.basic.id
    api_version = confluent_kafka_cluster.basic.api_version
    kind        = confluent_kafka_cluster.basic.kind

    environment {
      id = confluent_environment.staging.id
    }
  }
}
  1. Adding it to TF state file (terraform.tfstate):
{
      "mode": "managed",
      "type": "confluent_api_key",
      "name": "app-producer-kafka-api-key",
      "provider": "provider[\"registry.terraform.io/confluentinc/confluent\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "description": "Kafka API Key that is owned by 'app-producer' service account",
            "display_name": "app-producer-kafka-api-key",
            "id": "WI34H6UO111111111",
            "managed_resource": [
              {
                "api_version": "cmk/v2",
                "environment": [
                  {
                    "id": "env-abc-123"
                  }
                ],
                "id": "lkc-xyz123",
                "kind": "Cluster"
              }
            ],
            "owner": [
              {
                "api_version": "iam/v2",
                "id": "sa-abc123",
                "kind": "ServiceAccount"
              }
            ],
            "secret": "***REDACTED***"
          },
          "sensitive_attributes": [],
          "private": "bnVsbA==",
          "dependencies": [
            "confluent_environment.staging",
            "confluent_kafka_cluster.basic",
            "confluent_service_account.app-producer"
          ]
        }
      ]
    },

(update all IDs including secret attribute)

and then run terraform plan that should show no changes to the config 🤞

Let me know if it helps!

from terraform-provider-confluent.

linouk23 avatar linouk23 commented on May 30, 2024

That's great to hear!

But I do think that the feature to import the keys would be much easier 😉

For sure, I'll keep this issue open until we add it.

from terraform-provider-confluent.

sc-alistairdeneys avatar sc-alistairdeneys commented on May 30, 2024

I'd like to +1 this feature request.

I'm in the process of migrating our Confluent configuration to Terraform and it would be great if we could manage all resources, including API keys, in Terraform.

from terraform-provider-confluent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.