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

Data source for google_secret_manager_secret_version constantly has ID changing due to timestamp issue #7092

Closed
Assignees
Labels
bug forward/review In review; remove label to forward service/secretmanager

Comments

@lucasteligioridis
Copy link

lucasteligioridis commented Aug 25, 2020

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

Terraform: v0.13.0
Google Provider: 3.35.0

Affected Resource(s)

  • data_source_google_secret_manager_secret_version

Terraform Configuration Files

data "google_secret_manager_secret_version" "secret" {
  project = "my-project"
  secret = "my-secret"
  version = "latest"
}

Expected Behavior

Once a terraform apply has been run, the diff should be clean unless a secret has changed.

Actual Behavior

On terraform apply's for subsequent runs, there should be no diff or need to re-fetch the secret unless something has changed. But due to the way that the ID is configured:

The ID will change every terraform plan/apply since the secret is read causing constant diffs with the id always changing.

 <= data "google_secret_manager_secret_version" "secret"  {
        create_time = "2020-08-24T06:55:21.133675Z"
        enabled     = true
      ~ id          = "2020-08-25 01:04:46.045399 +0000 UTC" -> "2020-08-25 01:06:12.418661 +0000 UTC"
        name        = "projects/12345678/secrets/my-secret/versions/1"
        project     = "my-project"
        secret      = "my-secret"
        secret_data = (sensitive value)
        version     = "1"
    }

Should probably emulate the way the AWS secret manager version resource works.

Steps to Reproduce

  1. Create a secret in the GCP secrets manager.
  2. Create a data source as pasted above.
  3. terraform apply
  4. Then terraform apply again and see the diff always presenting itself because of the id using a currently read timestamp.
@ghost ghost added the bug label Aug 25, 2020
@edwardmedia edwardmedia self-assigned this Aug 25, 2020
@edwardmedia
Copy link
Contributor

I think setting id to the same as name might make more sense in this case.

@ghost
Copy link

ghost commented Sep 25, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 25, 2020
@github-actions github-actions bot added service/secretmanager forward/review In review; remove label to forward labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.