Terraform syntax: Difference between revisions

From wikinotes
(Created page with "Terraform files use the extension <code>*.tf</code> = Documentation = <blockquote> {| class="wikitable" |- | terraform language || https://www.terraform.io/language |- |} </blockquote><!-- Documentation --> = Basics = <blockquote> * '''blocks''' contain configuration for an object using a key/value format * blocks can optionally be assigned a variable number of '''labels''' * key-value assignments within a block are referred to as '''arguments''' <syntaxhighlight lang...")
 
Line 13: Line 13:
<blockquote>
<blockquote>
* '''blocks''' contain configuration for an object using a key/value format
* '''blocks''' contain configuration for an object using a key/value format
* blocks can optionally be assigned a variable number of '''labels'''
* '''labels''' can optionally be assigned a block (as many as you'd like)
* key-value assignments within a block are referred to as '''arguments'''
* '''arguments'' are how the key-value assignments within a block are referred to.


<syntaxhighlight lang="tf">
<syntaxhighlight lang="tf">

Revision as of 15:26, 25 September 2022

Terraform files use the extension *.tf

Documentation

terraform language https://www.terraform.io/language

Basics

  • blocks contain configuration for an object using a key/value format
  • labels can optionally be assigned a block (as many as you'd like)
  • 'arguments are how the key-value assignments within a block are referred to.
# ${BLOCK_TYPE} [${LABEL}..] {
#   ${IDENTIFIER} = ${EXPRESSION}  # argument
# }

resource "aws_vpc" "main" {
  cidr_block = var.base_cidr_block
}