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_sql_database_instance accepts user_labels and not labels #19450

Open
tibers opened this issue Sep 12, 2024 · 2 comments
Open

google_sql_database_instance accepts user_labels and not labels #19450

tibers opened this issue Sep 12, 2024 · 2 comments

Comments

@tibers
Copy link

tibers commented Sep 12, 2024

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 a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform cloud latest
on

  • provider registry.terraform.io/hashicorp/google latest

Affected Resource(s)

google_sql_database_instance accepts user_labels and not labels

Why is this a problem? If we write a sentinel policy which requires labels on things, I have one single resource which uses user_labels and not the standard labels.

See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#user_labels

Terraform Configuration

Debug Output

No response

Expected Behavior

No response

Actual Behavior

No response

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

@tibers tibers added the bug label Sep 12, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/sqladmin-cp labels Sep 12, 2024
@ggtisc ggtisc self-assigned this Sep 18, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Sep 18, 2024

Hi @tibers!

I tried to replicate this issue with the next code based on this example but the result was successful without errors:

resource "google_sql_database_instance" "sql_db_instance_19450" {
  name             = "sql-db-instance-19450"
  database_version = "MYSQL_8_0_31"
  deletion_protection = false
  settings {
    tier    = "db-perf-optimized-N-2"
    edition = "ENTERPRISE_PLUS"
    data_cache_config {
        data_cache_enabled = true
    }
    user_labels = {
      "foo" : "bar"
    }
  }
}

I suggest you to check the terraform registry and API documentation. But if you still continue with issues share your full code to check out what is happening.

@SarahFrench
Copy link
Member

Hi @tibers - Thanks for opening this issue and I appreciate this resource being an outlier is irritating!

We discussed this internally and decided that we won't alter this resource to make the labels field be called 'labels' or be located at the top-level. Our reasoning is that we prefer to make resources in the provider resemble the resources in the API, and not deviate from that except when absolutely necessary. Unfortunately the SQL API is an old GCP API that predates the standards that make other APIs look so alike, hence the labels field being handled differently.

Are you able to write your Sentinel policy in a way that accommodates this resource as it currently behaves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants