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

Deploying Resource results in 'inconsistent' error #16185

Closed

Comments

@davenportjw
Copy link

davenportjw commented Oct 9, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

google provider version: v4.84.0

I believe the TF version is 1.2.3 or 1.2.6

Affected Resource(s)

Appears to be service accounts from prior failures, but this specific example is below

  • google_service_account

Expected Behavior

Successful deployment/

Actual Behavior

Cloud Build Logs: https://console.cloud.google.com/cloud-build/builds/435e6b9a-a37b-477b-9c4f-7e46c4cf702c?project=cloud-foundation-cicd&e=13803378&mods=pan_ng2

b/304483428

@davenportjw davenportjw added the bug label Oct 9, 2023
@github-actions github-actions bot added forward/review In review; remove label to forward service/iam-serviceaccount labels Oct 9, 2023
@edwardmedia edwardmedia removed the forward/review In review; remove label to forward label Oct 9, 2023
@edwardmedia
Copy link
Contributor

@davenportjw I did not see the inconsistent error from the Cloud Build log you provided. Or did I miss your point?

@davenportjw
Copy link
Author

davenportjw commented Oct 9, 2023 via email

@sbocinec
Copy link

sbocinec commented Oct 11, 2023

The link to the Cloud Build output is not public. Though, we are also frequently (a few times daily) experiencing the following incosistent result issue with google_service_account:

Error: Provider produced inconsistent result after apply
When applying changes to google_service_account.connectors[0], provider "provider[\"registry.terraform.io/hashicorp/google\"]" produced an unexpected new value: Root resource was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.

In all our cases, the SA is created in GCP, as retrying apply fails with 409:

Error: Error creating service account: googleapi: Error 409: Service account connectors already exists within project projects/connectors-xyz.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.ResourceInfo",
    "resourceName": "projects/connectors-xyz/serviceAccounts/connectors@connectors-xyz.iam.gserviceaccount.com"
  }
]
, alreadyExists
  with google_service_account.connectors[0],
  on sa.tf line 9, in resource "google_service_account" "connectors":
   9: resource "google_service_account" "connectors" {

terraform version: 1.2.9
google provider version: 4.83.0

Example code:

resource "google_service_account" "connectors" {
  count        = local.create_connectors_service_account ? 1 : 0
  account_id   = substr(local.cluster_name, 0, 28)
  display_name = "${local.cluster_name} connectors service account"
}

I wonder, can it be related to the recent fix of retrying read after creating the google_service_account if 403 is received GoogleCloudPlatform/magic-modules#8815 , introduced in 4.83.0 ?

@benhxy
Copy link

benhxy commented Dec 12, 2023

Looks like a dup with #10193. We can consider adding error handling of 409.

Copy link

github-actions bot commented Feb 8, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.