User Tools

Site Tools


programming:terraform

This is an old revision of the document!


terraform

variable properties

variable types

  • Input Variables: These are used to pass dynamic values to Terraform configurations.
  • Environment Variables: These are used to set values for Terraform commands or to provide sensitive data.
  • Output Variables: These are used to expose values from a Terraform configuration to be used by other configurations or by external systems.

Types of Variables

Terraform supports several types of variables:

  • String: A single string value.
  • Number: A numeric value.
  • Bool: A boolean value.
  • List: A list of values.
  • Map: A key-value pair.
  • Object: A collection of named attributes that each have their own type.
  • Tuple: A sequence of elements identified by their order and each have their own type.

Working with variables

  • Variable Type Constraints: You can specify the type of a variable to enforce that the provided value matches the expected type.
  • Using Variables in Configuration: Variables can be accessed using the var keyword.
  • Providing Values for Variables: Values for variables can be provided in several ways
  • Variable Validation: You can add validation rules to ensure that input values meet certain criteria.
  • Sensitive Variables: Sensitive variables are used to store sensitive information like passwords.
  • Default Values: Variables can have default values, which are used if no other value is provided.
  • Conditional Expressions with Variables: Terraform supports conditional expressions that can be used to assign variable values based on conditions.
programming/terraform.1719828380.txt.gz · Last modified: 2024/07/01 10:06 by kamaradski