Formation DevOps | Formation Terraform : 1- Premier pas avec Terraform: Stockage des variables

This website is powered by ItGalaxy.io



Terraform : Stockage variables

Type de variables :
String
Number
Bool (boolean)
Liste
Map

Test intéractif avec une variable string en outupt:
variable “str” {}
output “variable” {value = var.str}

On peut aussi declarer output “mavariable” { value = “${var.str}” }

Les différents niveaux des variables :

Ordre des variables :

**1. Variable d’environnement

  1. Fichier terraform.tfvars
  2. Fichier terraform.tfvars.json
  3. Fichier *.auto.tfvars , *.auto.tfvars.json
  4. CLI : -var ou –var-file**

/!\De moins vers le plus prioritaire.

  • Tester les différents niveau de variables:
  1. Niveau variable d’environnement

export TF_VAR_str=“env”

variable “str” {}
output “variable” {value = var.str}

  1. Fichier terraform.tfvars

echo ‘str=“fichier terraform.tfvars”’ > terraform.tfvars
terraform apply

  1. Fichier *.auto.tfvars

echo ‘str=“fichier production.auto.tfvars”’ > production.auto.tfvars
terraform apply

  1. Paramètre -var

terraform apply -var str=’“var”’
terraform apply

  1. Paramètre –var-file

echo ‘str=“fichier varfile.tfvars”’ > varfile.tfvars
terraform apply -var-file varfile.tfvars
terraform apply






1. Nous contactez


2. Infra as a Service

  • Description: Infrastructure cloud évolutive et sécurisée
  • Links:

3. Projets Développeurs


4. Développeurs


5. Formations Complètes


6. Marketplace

7. Blogs


This website is powered by ItGalaxy.io