From 547d3255a1d8ae99ba0f79dba041c56c9719e809 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 10:00:10 -0700 Subject: [PATCH 1/7] Add guides for labels and annotations --- .../guides/version_5_upgrade.html.markdown | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index 1fb735550522..dffc7fd6975e 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -86,6 +86,28 @@ terraform { } ``` +## Lables Rework + +### 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. + +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. + +There will be three labels related fields on the resources with resource `labels` field. + +* 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. + +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. + +### 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. + ## Provider ### Provider-level change example header From bf1e48ef20da841f8035803562ee056544c13e17 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 15:12:48 -0700 Subject: [PATCH 2/7] Modify the guides --- .../guides/version_5_upgrade.html.markdown | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index dffc7fd6975e..eaa3d8fa3c52 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -86,27 +86,35 @@ terraform { } ``` -## Lables Rework +## Provider-level Labels Rework -### Labels +The labels and annotations are key-value pairs attached on Google cloud resources. Cloud labels are used for organizing resources, filtering resources, breaking down billing, and so on. The users, GCP clients, and API services can manage those fields. Annotations are used to attach metadata to Kubernetes resources. -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. +Not all of Google cloud resources support labels and annotations. Please check the Terraform Google provider resource documentation to figure out if the resource supports the `labels` and `annotations` fields. -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. +### Provider default labels -There will be three labels related fields on the resources with resource `labels` field. +Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the resource `labels` field. + +Provider-level default annotations are not supported. + +### Resource labels + +The new labels model will be applied to all of the resources with the resource `labels` field. Currently there are two kinds of resource `labels` fields, the top level `labels` field and the nested `labels` field inside the `metadata` field. Some `labels` fields are for child resources, so the new model will not be applied to the `labels` fields for child resources. + +There are now three label-related fields with the new model: * 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. +* 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. If the same label exists on both the resource labels and provider default labels, the label on the resource will override the provider label. -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. +After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform apply`, these three fields should show in the state file of the resources with a self-applying `labels` field. -### Annotations +### Resource 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. +There will be two annotation-related fields on resources with resource `annotations` field, the `annotations` and the output-only `effective_annotations` fields. ## Provider From 66c0feec2199fa9070476e9224f98e1bba162618 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 15:24:48 -0700 Subject: [PATCH 3/7] Modify the guide --- .../website/docs/guides/version_5_upgrade.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index eaa3d8fa3c52..ccb9067343d1 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -88,19 +88,19 @@ terraform { ## Provider-level Labels Rework -The labels and annotations are key-value pairs attached on Google cloud resources. Cloud labels are used for organizing resources, filtering resources, breaking down billing, and so on. The users, GCP clients, and API services can manage those fields. Annotations are used to attach metadata to Kubernetes resources. +The labels and annotations are key-value pairs attached on Google cloud resources. Cloud labels are used for organizing resources, filtering resources, breaking down billing, and so on. Annotations are used to attach metadata to Kubernetes resources. Not all of Google cloud resources support labels and annotations. Please check the Terraform Google provider resource documentation to figure out if the resource supports the `labels` and `annotations` fields. ### Provider default labels -Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the resource `labels` field. +Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the `metadata` field. Provider-level default annotations are not supported. ### Resource labels -The new labels model will be applied to all of the resources with the resource `labels` field. Currently there are two kinds of resource `labels` fields, the top level `labels` field and the nested `labels` field inside the `metadata` field. Some `labels` fields are for child resources, so the new model will not be applied to the `labels` fields for child resources. +The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the `metadata` field. Some labels fields are for child resources, so the new model will not be applied to the `labels` field for child resources. There are now three label-related fields with the new model: From 4914d16110e04a407a3b068f550fbd68532b01ab Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 15:29:11 -0700 Subject: [PATCH 4/7] Modify the guide --- .../website/docs/guides/version_5_upgrade.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index ccb9067343d1..a19f55fbddd3 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -94,13 +94,13 @@ Not all of Google cloud resources support labels and annotations. Please check t ### Provider default labels -Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the `metadata` field. +Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Provider-level default annotations are not supported. ### Resource labels -The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the `metadata` field. Some labels fields are for child resources, so the new model will not be applied to the `labels` field for child resources. +The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level`metadata` field. Some labels fields are for child resources, so the new model will not be applied to labels fields for child resources. There are now three label-related fields with the new model: @@ -114,7 +114,7 @@ After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform a The new annotations model is similar to the new labels model. -There will be two annotation-related fields on resources with resource `annotations` field, the `annotations` and the output-only `effective_annotations` fields. +There are now two annotation-related fields on resources with the new model, the `annotations` and the output-only `effective_annotations` fields. ## Provider From 67aa6b20407c045f284457aa7441443bb661cd99 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 15:32:19 -0700 Subject: [PATCH 5/7] Modify the guide --- .../website/docs/guides/version_5_upgrade.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index a19f55fbddd3..d396c0e0b00a 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -112,9 +112,9 @@ After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform a ### Resource annotations -The new annotations model is similar to the new labels model. +The new annotations model is similar to the new labels model and will be applied to all of the resources with the top level `annotations` field or the nested `annotations` field inside the top level`metadata` field. -There are now two annotation-related fields on resources with the new model, the `annotations` and the output-only `effective_annotations` fields. +There are now two annotation-related fields with the new model, the `annotations` and the output-only `effective_annotations` fields. ## Provider From 6f4b5816b0e844959a3c31d1b3906e0dcad0c5dc Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 10 Aug 2023 15:34:07 -0700 Subject: [PATCH 6/7] Add more spaces --- .../website/docs/guides/version_5_upgrade.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index d396c0e0b00a..8f9bd4e541cc 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -100,7 +100,7 @@ Provider-level default annotations are not supported. ### Resource labels -The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level`metadata` field. Some labels fields are for child resources, so the new model will not be applied to labels fields for child resources. +The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Some labels fields are for child resources, so the new model will not be applied to labels fields for child resources. There are now three label-related fields with the new model: @@ -112,7 +112,7 @@ After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform a ### Resource annotations -The new annotations model is similar to the new labels model and will be applied to all of the resources with the top level `annotations` field or the nested `annotations` field inside the top level`metadata` field. +The new annotations model is similar to the new labels model and will be applied to all of the resources with the top level `annotations` field or the nested `annotations` field inside the top level `metadata` field. There are now two annotation-related fields with the new model, the `annotations` and the output-only `effective_annotations` fields. From 2a546a75372d0bdb577e7e72fd8a8f9973a9af47 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Fri, 11 Aug 2023 13:28:30 -0700 Subject: [PATCH 7/7] Move 'Provider-level Labels Rework' below Provider --- .../guides/version_5_upgrade.html.markdown | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown index 8f9bd4e541cc..5cc294664109 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -86,19 +86,21 @@ terraform { } ``` -## Provider-level Labels Rework +## Provider + +### Provider-level Labels Rework -The labels and annotations are key-value pairs attached on Google cloud resources. Cloud labels are used for organizing resources, filtering resources, breaking down billing, and so on. Annotations are used to attach metadata to Kubernetes resources. +Labels and annotations are key-value pairs attached on Google cloud resources. Cloud labels are used for organizing resources, filtering resources, breaking down billing, and so on. Annotations are used to attach metadata to Kubernetes resources. Not all of Google cloud resources support labels and annotations. Please check the Terraform Google provider resource documentation to figure out if the resource supports the `labels` and `annotations` fields. -### Provider default labels +#### Provider default labels Default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Provider-level default annotations are not supported. -### Resource labels +#### Resource labels The new labels model will be applied to all of the resources with the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Some labels fields are for child resources, so the new model will not be applied to labels fields for child resources. @@ -110,18 +112,12 @@ There are now three label-related fields with the new model: After upgrading to `5.0.0`, and then running `terraform refresh` or `terraform apply`, these three fields should show in the state file of the resources with a self-applying `labels` field. -### Resource annotations +#### Resource annotations The new annotations model is similar to the new labels model and will be applied to all of the resources with the top level `annotations` field or the nested `annotations` field inside the top level `metadata` field. There are now two annotation-related fields with the new model, the `annotations` and the output-only `effective_annotations` fields. -## Provider - -### Provider-level change example header - -Description of the change and how users should adjust their configuration (if needed). - ## Datasources ## Datasource: `google_product_datasource`