From 7cb1cf7b63f42c0e1d1af299f6ddedd6996d1c7b Mon Sep 17 00:00:00 2001 From: StefanSchoof <4662023+StefanSchoof@users.noreply.github.com> Date: Fri, 6 May 2022 09:47:03 +0200 Subject: [PATCH 1/2] Use different names for var and block I think it is easier to understand, which refers to the var and which to the block, when the var has not the exact same name as the block --- website/docs/language/expressions/splat.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/language/expressions/splat.mdx b/website/docs/language/expressions/splat.mdx index fca40484f7..213831c546 100644 --- a/website/docs/language/expressions/splat.mdx +++ b/website/docs/language/expressions/splat.mdx @@ -66,7 +66,7 @@ This special behavior can be useful for modules that accept optional input variables whose default value is `null` to represent the absence of any value. This allows the module to adapt the variable value for Terraform language features designed to work with collections. For example: ``` -variable "website" { +variable "website_setting" { type = object({ index_document = string error_document = string @@ -78,7 +78,7 @@ resource "aws_s3_bucket" "example" { # ... dynamic "website" { - for_each = var.website[*] + for_each = var.website_setting[*] content { index_document = website.value.index_document error_document = website.value.error_document From 650ada19b7f17cf470d5b225733cef6c9b375411 Mon Sep 17 00:00:00 2001 From: StefanSchoof <4662023+StefanSchoof@users.noreply.github.com> Date: Wed, 18 May 2022 07:59:47 +0200 Subject: [PATCH 2/2] change also variable name in text --- website/docs/language/expressions/splat.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/language/expressions/splat.mdx b/website/docs/language/expressions/splat.mdx index 213831c546..36c0fdf5c5 100644 --- a/website/docs/language/expressions/splat.mdx +++ b/website/docs/language/expressions/splat.mdx @@ -89,7 +89,7 @@ resource "aws_s3_bucket" "example" { The above example uses a [`dynamic` block](/language/expressions/dynamic-blocks), which generates zero or more nested blocks based on a collection value. The input -variable `var.website` is defined as a single object that might be null, +variable `var.website_setting` is defined as a single object that might be null, so the `dynamic` block's `for_each` expression uses `[*]` to ensure that there will be one block if the module caller sets the website argument, or zero blocks if the caller leaves it set to null.