From 32d9aa0ffd4d29b8f68c249dd74f19f3a0f7074c Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Thu, 10 Mar 2022 18:56:58 -0500 Subject: [PATCH 1/6] build: updated documentation reflecting cloud backend override functionality --- website/docs/language/files/override.mdx | 5 +++++ website/docs/language/settings/terraform-cloud.mdx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/website/docs/language/files/override.mdx b/website/docs/language/files/override.mdx index ff009e451..3f76145b4 100644 --- a/website/docs/language/files/override.mdx +++ b/website/docs/language/files/override.mdx @@ -150,3 +150,8 @@ In both the `required_version` and `required_providers` settings, each override constraint entirely replaces the constraints for the same component in the original block. If both the base block and the override block both set `required_version` then the constraints in the base block are entirely ignored. + +If a `cloud` block is set within the original configuration's `terraform` block and a `backend` block +is set in the override file, then the backend specified by the `backend` block is used upon merging. +Similarly, if a `backend` block is set within the original configuration's `terraform` block +and a `cloud` block is set in the override file, then the backend specified by the `backend` block is used upon merging. diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index e76454772..7f41976d9 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -28,6 +28,8 @@ terraform { } ``` -You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. +You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. +A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. +Note that a `cloud` block can be overridden by a state backend in an [override file](/language/files/override#merging-terraform-blocks). Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI docs for more information. From 478b4e0aea3f9ce75b61bd33c6a05a9eaa18be0f Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Thu, 10 Mar 2022 19:01:58 -0500 Subject: [PATCH 2/6] fix: tighten behavior description --- website/docs/language/files/override.mdx | 4 ++-- website/docs/language/settings/terraform-cloud.mdx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/language/files/override.mdx b/website/docs/language/files/override.mdx index 3f76145b4..487a760fa 100644 --- a/website/docs/language/files/override.mdx +++ b/website/docs/language/files/override.mdx @@ -152,6 +152,6 @@ original block. If both the base block and the override block both set `required_version` then the constraints in the base block are entirely ignored. If a `cloud` block is set within the original configuration's `terraform` block and a `backend` block -is set in the override file, then the backend specified by the `backend` block is used upon merging. +is set in the override file, then the backend specified by the `backend` block is used by Terraform upon merging. Similarly, if a `backend` block is set within the original configuration's `terraform` block -and a `cloud` block is set in the override file, then the backend specified by the `backend` block is used upon merging. +and a `cloud` block is set in the override file, then the backend specified by the `backend` block is used by Terraform upon merging. diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index 7f41976d9..902903c1d 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -30,6 +30,6 @@ terraform { You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. -Note that a `cloud` block can be overridden by a state backend in an [override file](/language/files/override#merging-terraform-blocks). +Note, however, that a `cloud` block can be overridden by a state backend in an [override file](/language/files/override). Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI docs for more information. From e9043cdcade66168723232110eb5a0aad24aaebb Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Mon, 14 Mar 2022 19:03:53 -0400 Subject: [PATCH 3/6] fix: suggested changes --- website/docs/language/files/override.mdx | 11 +++++++---- website/docs/language/settings/terraform-cloud.mdx | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/website/docs/language/files/override.mdx b/website/docs/language/files/override.mdx index 487a760fa..f1388df3a 100644 --- a/website/docs/language/files/override.mdx +++ b/website/docs/language/files/override.mdx @@ -151,7 +151,10 @@ constraint entirely replaces the constraints for the same component in the original block. If both the base block and the override block both set `required_version` then the constraints in the base block are entirely ignored. -If a `cloud` block is set within the original configuration's `terraform` block and a `backend` block -is set in the override file, then the backend specified by the `backend` block is used by Terraform upon merging. -Similarly, if a `backend` block is set within the original configuration's `terraform` block -and a `cloud` block is set in the override file, then the backend specified by the `backend` block is used by Terraform upon merging. +The presence of a block defining a backend (either `cloud` or `backend`) in an override +file always takes precedence over a block defining a backend in the original configuration. +That is, if a `cloud` block is set within the original configuration and a `backend` block is +set in the override file, Terraform will use the `backend` block specified in the override file as the +configuration's backend upon merging. Similarly, if a `backend` block is set within the original +configuration and a `cloud` block is set in the override file, Terraform will use the `cloud` +block specified in the override file as the configuration's backend upon merging. diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index 902903c1d..e69013b71 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -30,6 +30,7 @@ terraform { You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. -Note, however, that a `cloud` block can be overridden by a state backend in an [override file](/language/files/override). +However, if a state `backend` block is defined in an [override file](/language/files/override), +that `backend` block will override an existing `cloud` block in the configuration upon merging. Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI docs for more information. From 12f125d9584c2e87b32e7b236ab061bf61893497 Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Tue, 15 Mar 2022 11:25:05 -0400 Subject: [PATCH 4/6] remove override interjection on terraform-cloud docs --- website/docs/language/settings/terraform-cloud.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index e69013b71..1cd9c7b8d 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -30,7 +30,5 @@ terraform { You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. -However, if a state `backend` block is defined in an [override file](/language/files/override), -that `backend` block will override an existing `cloud` block in the configuration upon merging. Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI docs for more information. From b8d8461dbb64ba14e9bd03c32c5369492850801d Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Tue, 15 Mar 2022 11:26:04 -0400 Subject: [PATCH 5/6] no new line changes in terraform-cloud.mdx --- website/docs/language/settings/terraform-cloud.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index 1cd9c7b8d..e76454772 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -28,7 +28,6 @@ terraform { } ``` -You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. -A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. +You cannot use the CLI integration and a [state backend](/language/settings/backends) in the same configuration; they are mutually exclusive. A configuration can only provide one `cloud` block and the `cloud` block cannot refer to named values like input variables, locals, or data source attributes. Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI docs for more information. From 659fb09fc1fb5cc07f9518a106d25e46aacd0a83 Mon Sep 17 00:00:00 2001 From: GoodmanBen Date: Tue, 15 Mar 2022 16:36:04 -0400 Subject: [PATCH 6/6] fix: cleaner syntax --- website/docs/language/files/override.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/language/files/override.mdx b/website/docs/language/files/override.mdx index f1388df3a..3595cd5ed 100644 --- a/website/docs/language/files/override.mdx +++ b/website/docs/language/files/override.mdx @@ -154,7 +154,7 @@ original block. If both the base block and the override block both set The presence of a block defining a backend (either `cloud` or `backend`) in an override file always takes precedence over a block defining a backend in the original configuration. That is, if a `cloud` block is set within the original configuration and a `backend` block is -set in the override file, Terraform will use the `backend` block specified in the override file as the -configuration's backend upon merging. Similarly, if a `backend` block is set within the original -configuration and a `cloud` block is set in the override file, Terraform will use the `cloud` -block specified in the override file as the configuration's backend upon merging. +set in the override file, Terraform will use the `backend` block specified in the override file upon merging. +Similarly, if a `backend` block is set within the original configuration and a `cloud` block +is set in the override file, Terraform will use the `cloud` block specified in the override +file upon merging.