DevOps, Day - 63

DevOps, Day - 63

Terraform Variables

Using Map Data Type

stop and remove the running container

docker stop <container_id>
docker rm <container_id>
terraform apply


modify your main.tf file as shown

variable "my_list" {
  type    = list(string)
  default = ["item1", "item2", "item3"]
}

variable "my_set" {
  type    = set(string)
  default = ["item1", "item2", "item3"]
}

variable "my_object" {
  type = object({
    key1 = string
    key2 = number
  })
  default = {
    key1 = "value1"
    key2 = 42
  }
}

Now use the terraform refresh command.

terraform refresh

This command will update the state file with the current variable values.

you can use terraform show to see the current state and values of your resources and variables.


Thank you so much for reading

Follow me on LinkedIn to see interesting posts like this : )

Linkedin

Β