Difference between revisions of "Terraform splat expression"

From wikieduonline
Jump to navigation Jump to search
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
+
* https://www.terraform.io/docs/language/expressions/splat.html provides a more concise way to express a common operation that could otherwise be performed with a [[for]] expression.
  
  
Line 7: Line 7:
 
   
 
   
 
   dynamic "website" {
 
   dynamic "website" {
     for_each = var.mywebsitevar[*]
+
     [[for_each]] = var.mywebsitevar[*]
 
     content {
 
     content {
 
       index_document = website.value.index_document
 
       index_document = website.value.index_document
Line 17: Line 17:
  
 
== Related terms ==
 
== Related terms ==
* [[tolist]]
+
* <code>[[tolist]]</code>
 +
* [[Error: Error in function call]]: "list" function was deprecated in [[Terraform v0.12]]
  
 
== See also ==
 
== See also ==
* {{Terraform}}
+
* {{Terraform functions}}
 +
* {{Terraform expresions}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 09:27, 23 February 2023


https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each

resource "aws_s3_bucket" "myexample" {
  # ...

  dynamic "website" {
    for_each = var.mywebsitevar[*]
    content {
      index_document = website.value.index_document
      error_document = website.value.error_document
    }
  }
}


Related terms[edit]

See also[edit]

Advertising: