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

add read-only fields updateTime or version to cloudfunctions_function / cloudfunctions2_function #11926

Open
StephenWithPH opened this issue Jun 21, 2022 · 0 comments

Comments

@StephenWithPH
Copy link

StephenWithPH commented Jun 21, 2022

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

GCP's api exposes the version and update time of a cloud function. Exposing either of these fields on the cloudfunctions_function Terraform resource (as a read-only attribute) would be useful for several reasons.

My use case would be to consume the version or update time field as an argument to replace_triggered_by on a Terraform resource that needs to be (re)created when the Cloud Function changes. In my case, the cloudfunctions_function resource is created inside a Terraform module, and other resources not part of that module cannot reference the entire resource in their meta-arguments. cloudfunctions_function does not currently expose any attributes which change when the function's source code changes. Adding the version or update time field would work around this.

New or Affected Resource(s)

  • google_cloudfunctions_function
  • google_cloudfunctions2_function

Potential Terraform Configuration

# lifted from the current docs
resource "google_cloudfunctions_function" "function" {
  name        = "function-test"
  description = "My function"
  runtime     = "nodejs16"

  available_memory_mb   = 128
  source_archive_bucket = google_storage_bucket.bucket.name
  source_archive_object = google_storage_bucket_object.archive.name
  trigger_http          = true
  entry_point           = "helloGET"
}

# demonstrating the requested new field via an output
output "function_version" {
  value = google_cloudfunctions_function.function.version_id
}

# demonstrating the requested new field via an output
output "function_update_time" {
  value = google_cloudfunctions_function.function.update_time
}

References

Anything Else

It looks like updateTime is available on both the v1 and v2 (beta) resources, while versionId is only on the v1 resource. This suggests that updateTime might be a more future-proof choice.

b/274817399

@rileykarson rileykarson added this to the Goals milestone Jun 27, 2022
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Oct 4, 2024
[upstream:30dee30c780a874572bf672e809735ce66767fd0]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit that referenced this issue Oct 4, 2024
[upstream:30dee30c780a874572bf672e809735ce66767fd0]

Signed-off-by: Modular Magician <magic-modules@google.com>
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

3 participants