Difference between revisions of "Terraform variables: variables.tf"

From wikieduonline
Jump to navigation Jump to search
Line 8: Line 8:
 
Definition in <code>[[variables.tf]]</code>
 
Definition in <code>[[variables.tf]]</code>
  
<code>variable "YourVarName" { default = "your_default_value" }</code>
+
[[variable]] "YourVarName" {}
  
  [[variable]] "YourVarName" {}
+
  variable "YourVarName" { default = "your_default_value" }
  
 
  [[variable]] "YourVarName" {
 
  [[variable]] "YourVarName" {
Line 21: Line 21:
 
   default = "your_default_value"
 
   default = "your_default_value"
 
  }
 
  }
 
  [[variable]] "YourVarName" {}
 
  
 
Usage in <code>[[main.tf]]</code>
 
Usage in <code>[[main.tf]]</code>

Revision as of 17:47, 19 October 2021

Example

Definition in variables.tf

variable "YourVarName" {}
variable "YourVarName" { default = "your_default_value" }
variable "YourVarName" {
  default = "your_default_value"
}
variable "YourVarName" {
  type = string
  description = "Description of your variable"
  default = "your_default_value"
}

Usage in main.tf AnyFieldToAssingAValue = var.YourVarName

Errors

Related term

See also

Advertising: