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 guides for labels and annotations #8608

Merged
merged 7 commits into from
Aug 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@ terraform {
}
```

## Lables Rework
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

### Labels

The new labels model will be applied to all of the resources with the resource `labels` field. Some `labels` fields are for child resources, so the new model will not be applied to the `labels` fields for child resources.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

The default labels configured on the provider through the new `default_lables` field will be supported. The default labels configured on the provider will be applied to all of the resources with the resource `labels` field.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

There will be three labels related fields on the resources with resource `labels` field.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

* The `labels` field will be non-authoritative and only manage the labels defined by the users on the resource through Terraform.
* The output-only `effective_labels` will list all of labels present on the resource in GCP, including the labels configured through Terraform, other clients and services.
* The output-only `terraform_labels` will merge the labels defined by the users on the resource through Terraform and the default labels configured on the provider. When the same label exists on both the resource labels and provider default labels, the lable on the resource will override the label on the provider.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform apply`, these three fields should show in the state file if the resources have resource "labels" field.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

### Annotations

The new annotations model is similar to the new labels model.

There will be two annotations related fields on resources with resource `annotations` field, the `annotaitons` and the output-only `effective_annotations` fields. `terraform_annotations` field is not supported, as the default annotations configured on the provider will not be supported.
zli82016 marked this conversation as resolved.
Show resolved Hide resolved

## Provider

### Provider-level change example header
Expand Down