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

From wikieduonline
Jump to navigation Jump to search
Line 10: Line 10:
 
  [[variable]] "YourVarName" {}
 
  [[variable]] "YourVarName" {}
 
  variable "YourVarName" { default = "your_default_value" }
 
  variable "YourVarName" { default = "your_default_value" }
 +
variable "your_subnets" { default = ["subnet-0d68d399b6cf9c2b3", "subnet-055f2f0b4de211111"] }
  
 
  [[variable]] "YourVarName" {
 
  [[variable]] "YourVarName" {

Revision as of 19:42, 19 October 2021

Example

Definition in variables.tf

variable "YourVarName" {}
variable "YourVarName" { default = "your_default_value" }
variable "your_subnets" { default = ["subnet-0d68d399b6cf9c2b3", "subnet-055f2f0b4de211111"] }
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: