hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.28k stars 1.72k forks source link

Error updating apigee organization #9906

Open adrian-visoiu-db opened 3 years ago

adrian-visoiu-db commented 3 years ago

Community Note

Terraform Version

Terraform v0.13.2

Affected Resource(s)

Terraform Configuration Files

resource "google_apigee_organization" "apigee_internal_org" { analytics_region = var.analytics_region display_name = var.apigee_organization_name description = "Terraform-provisioned Apigee Internal" project_id = var.project runtime_database_encryption_key_name = var.google_kms_crypto_key authorized_network = var.network }

Apigee instance.

resource "google_apigee_instance" "apigee_internal_instance" { name = "${var.apigee_organization_name}-${var.apigee_instance_name}" location = var.primary_region org_id = google_apigee_organization.apigee_internal_org.id disk_encryption_key_name = var.google_kms_crypto_key peering_cidr_range = "SLASH_20" display_name = "${var.apigee_organization_name}-${var.apigee_instance_name}"

Debug Output

module.apigee_internal.google_apigee_organization.apigee_internal_org: Still modifying... [id=organizations/db-dev1-8wzd-apigee-i-1, 3m20s elapsed]

Error: Error waiting for Updating Organization: couldn't find resource (21 retries)

on modules/apigee-internal/main.tf line 2, in resource "google_apigee_organization" "apigee_internal_org": 2: resource "google_apigee_organization" "apigee_internal_org" {

Panic Output

Expected Behavior

Hi,

I am trying to create resources related to Apigee:

I see the organization is created when calling GET https://apigee.googleapis.com/v1/organizations api ...{ "organization": "-apigee-i-1", "projectIds": [ "" ] }

Actual Behavior

After changing apigee instance in tf script I get the error mentioned in outputs: module.apigee_internal.google_apigee_organization.apigee_internal_org: Still modifying... [id=organizations/db-dev1-8wzd-apigee-i-1, 3m20s elapsed]

Error: Error waiting for Updating Organization: couldn't find resource (21 retries) on modules/apigee-internal/main.tf line 2, in resource "google_apigee_organization" "apigee_internal_org": 2: resource "google_apigee_organization" "apigee_internal_org" {

Steps to Reproduce

  1. provide tf with valid apigee organization name and invalid apigee instance name -> only organization is created
  2. provide with valid apigee organization name and valid apigee instance name -> timeout updating organization (can't find resource)

Important Factoids

References

adrian-visoiu-db commented 3 years ago

Along with the Apigee Instance name there was a change in org name in the same time. First I’ve changed the org name from apigee-internal-org back to original apigee-internal – the script failed with the same error related to instance but I saw in /organizations API that the display name of the org was changed to apigee-internal.

Then I kept org name as reported by API (apigee-internal) and changed only the instance name to dev1-instance -> now the error related to org does not appear and the plan is not stalling.

megan07 commented 3 years ago

Hi @adrian-visoiu-db ! Thanks for the update. Am I understanding that you solved the issue and it's working as expected? If so, are we able to close this issue? Thanks!

megan07 commented 2 years ago

Hi @adrian-visoiu-db ! Is this still an issue?

adrian-visoiu-db commented 2 years ago

Hi @adrian-visoiu-db ! Is this still an issue?

Hi Megan, issue was solved as mentioned above, however it is up to you to consider investigating why having two resources A and B, B depending on A, having changes in both, B is not waiting for A's update and references an obsolete resource, to me it seems a problem with the tf planning.

megan07 commented 2 years ago

@adrian-visoiu-db Thanks for the response! Would you mind adding some configurations here and what the plan looks like so that I can try and recreate it? Thanks!

melinath commented 1 year ago

b/270216759