Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform import of cloudfoundry_service_key fails #516

Open
mogul opened this issue Aug 2, 2023 · 0 comments
Open

terraform import of cloudfoundry_service_key fails #516

mogul opened this issue Aug 2, 2023 · 0 comments

Comments

@mogul
Copy link
Contributor

mogul commented Aug 2, 2023

Terraform code:

locals {
  s3_service_name        = "fac-terraform-state"
}

module "s3" {
  source = "github.com/18f/terraform-cloudgov//s3"

  cf_org_name   = "gsa-tts-oros-fac"
  cf_space_name = "production"
  name          = local.s3_service_name
}

resource "cloudfoundry_service_key" "bucket_creds" {
  name             = "${local.s3_service_name}-access"
  service_instance = module.s3.bucket_id
}

Trying to import an existing key attached to the service in question:

$ cf service-key fac-terraform-state fac-terraform-state-access --guid
3da2a5d0-2fd7-4e3a-a0c2-5773a885b082
$ terraform import cloudfoundry_service_key.bucket_creds 3da2a5d0-2fd7-4e3a-a0c2-5773a885b082
module.s3.data.cloudfoundry_service.s3: Reading...
module.s3.data.cloudfoundry_space.space: Reading...
module.s3.data.cloudfoundry_space.space: Read complete after 0s [id=5593dba8-7023-49a5-bdbe-e809fe23edf9]
module.s3.data.cloudfoundry_service.s3: Read complete after 1s [id=440ce9d9-b108-4bbe-80b4-08338f3cc25b]
cloudfoundry_service_key.bucket_creds: Importing from ID "3da2a5d0-2fd7-4e3a-a0c2-5773a885b082"...
╷
│ Error: The provider returned a resource missing an identifier during ImportResourceState. This is generally a bug in the resource implementation for import. Resource import code should not call d.SetId("") or create an empty ResourceData. If the resource is missing, instead return an error. Please report this to the provider developers.
│ 
│ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant