confluentinc / terraform-provider-confluentcloud

Confluent Cloud Terraform Provider is deprecated in favor of Confluent Terraform Provider
https://registry.terraform.io/providers/confluentinc/confluentcloud/latest/docs
52 stars 23 forks source link

Error data after resource confluentcloud_service_account #68

Closed AliaksandrShamchonak closed 2 years ago

AliaksandrShamchonak commented 2 years ago

Service account was not found after service account was created via terraform. But service account is visible and can be use via CLI.

Example:

terraform {
  required_providers {
    confluentcloud = {
      source  = "confluentinc/confluentcloud"
      version = "0.5.0"
    }
  }
}

resource "confluentcloud_service_account" "example-sa" {
  display_name = "orders-app-sa"
  description  = "Service Account for orders app"
}

data "confluentcloud_service_account" "example_using_name" {
  display_name = "orders-app-sa"
  depends_on   = [confluentcloud_service_account.example-sa]
}

Log:


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:  
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.confluentcloud_service_account.example_using_name will be read during apply
  # (config refers to values not yet known)
 <= data "confluentcloud_service_account" "example_using_name"  {
      + api_version  = (known after apply)
      + description  = (known after apply)
      + display_name = "orders-app-sa"
      + id           = (known after apply)
      + kind         = (known after apply)
    }

  # confluentcloud_service_account.example-sa will be created
  + resource "confluentcloud_service_account" "example-sa" {
      + api_version  = (known after apply)
      + description  = "Service Account for orders app"
      + display_name = "orders-app-sa"
      + id           = (known after apply)
      + kind         = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

confluentcloud_service_account.example-sa: Creating...
confluentcloud_service_account.example-sa: Creation complete after 2s [id=sa-j5pq6q]
data.confluentcloud_service_account.example_using_name: Reading...
╷
│ Error: The service account with display_name=orders-app-sa was not found
│
│   with data.confluentcloud_service_account.example_using_name,
│   on main.tf line 15, in data "confluentcloud_service_account" "example_using_name":
│   15: data "confluentcloud_service_account" "example_using_name" {
│
╵
linouk23 commented 2 years ago

Thanks for reporting the issue @AliaksandrShamchonak!

That's a duplicated of #54, it'll be fixed in our next release which is schedule for early next week.

linouk23 commented 2 years ago

@AliaksandrShamchonak we're very excited to let you know we've just published a new version of TF Provider that includes a fix for this issue among other very exciting improvements: it enables fully automated provisioning of our key Kafka workflows (see the demo) with no more manual intervention and makes it our biggest and most impactful release.

The only gotcha we've renamed it from confluentinc/confluentcloud to confluentinc/confluent but we published a migration guide so it should be fairly straightforward. The existing confluentinc/confluentcloud will be deprecated soon so we'd recommend switching as soon as possible.

New confluentinc/confluent provider also includes a lot of sample configurations so you won't need to write them from scratch. You can find them here, find a full list of changes here.