terraform-provider-google
terraform-provider-google copied to clipboard
default labels on provider
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
it would be awesome to define a default set of labels on the provider to be applied to all resources using that provider
New or Affected Resource(s)
- the provider itself
- potentially all resources with settable labels?
Potential Terraform Configuration
provider "google" {
project = "my-project-id"
region = "us-central1"
default_labels = {
owner = "my-team",
dept = "my-dept"
}
}
resource "google_pubsub_topic" "example1" {
name = "example-topic1"
labels = {
foo = "bar",
owner = "special-team"
}
}
resource "google_pubsub_topic" "example2" {
name = "example-topic2"
}
when deploying the resources above, the labels would be merged like merge(provider.default_labels, resource.labels)
resulting in the resources having the following labels when deployed:
example1:
- foo = "bar"
- owner = "special-team"
- dept = "my-dept"
example2:
- owner = "my-team"
- dept = "my-dept"
References
- Tracking issue: http://b/235080729
For a reference implementation, here's how it is done on the AWS provider with the default_tags
parameter at the provider level:
- https://github.com/hashicorp/terraform-provider-aws/pull/17974
- https://github.com/hashicorp/terraform-provider-aws/pull/18730
- https://github.com/hashicorp/terraform-provider-aws/pull/19006
- https://github.com/hashicorp/terraform-provider-aws/pull/19084
And those are also exposed by a datasource:
- https://github.com/hashicorp/terraform-provider-aws/pull/19391
PS: I'm not trolling, it's just that this works pretty well.
Bringing in updated sizing from https://github.com/hashicorp/terraform-provider-google/issues/9067
Note: This hit a threshold for prioritization, and we're going to investigate what the change might look like in detail. There's a moderate amount of scoping work to be done.
will be awesome, aws-like
+1
+1
+1
+1
+1
+1
+1
+1
+1
Support for default labels have been merged into the 5.0.0 major release feature branch with https://github.com/GoogleCloudPlatform/magic-modules/pull/8670
This will release with v5.0.0. Check https://github.com/hashicorp/terraform-provider-google/issues/15582 for more details on the major release.
Closing this issue for tracking purposes.
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.