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

google_bigquery_capacity_commitment should probably make capacity_commitment_id as required #16204

Comments

@theminghuang
Copy link

theminghuang commented Oct 10, 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 the 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 the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

New or Affected Resource(s)

  • google_bigquery_capacity_commitment

Potential Terraform Configuration

google_bigquery_capacity_commitment should probably make capacity_commitment_id as required since making it optional produce confusing result.

Here's my understanding of how it currently work with empty capacity_commitment_id,

  1. Say if we already have a google_bigquery_capacity_commitment test_commitment applied, and on the ui, it shows it has id 1234
  2. When doing another plan, because test_commitment has empty capacity_commitment_id, it'll get convert to something like
resource "google_bigquery_capacity_commitment" "test_commitment" {
      edition                = "ENTERPRISE" 
      id                        = "projects/{$PROJECT}/locations/{$LOCATION}/capacityCommitments/"
      plan                    = "THREE_YEAR"
      renewal_plan    = "NONE"
      slot_count         = 100
}
  1. under the hood it then calls the list api to get existing commitment, and see something like
[
   {
       "name": "projects/{$PROJECT}/locations/{$LOCATION}/capacityCommitments/1234",
       "slotCount": "100",
       "plan": "THREE_YEAR",
       "state": "ACTIVE",
       "renewalPlan": "NONE",
       "edition": "ENTERPRISE"
       ...
  }
]
  1. it tries to compare the constructed commitment object with the existing commitment returned from api and see that no commitment with id "projects/{$PROJECT}/locations/{$LOCATION}/capacityCommitments/"
  2. It'll then create a new commitment

References

  • #0000

b/305197408

@github-actions github-actions bot added forward/review In review; remove label to forward service/bigquery labels Oct 10, 2023
@melinath
Copy link
Collaborator

It looks like the API autogenerates a capacity_commitment_id if one is not supplied. This means that the field needs to have default_from_api similar to google_api_gateway_api_config.api_config_id. There may also be other changes necessary.

This is a bug.

Copy link

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 Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.