Terraform variables and outputs that set the "description" argument are not stored in the state file. The "description" argument is used to provide a human-readable description of the variable or output, and it is intended to be used as documentation for other users of the Terraform code.
The state file is used to store the current state of the infrastructure managed by Terraform, including the values of variables and outputs. However, the "description" argument is not part of the state file, and it is not used by Terraform to manage the infrastructure. Instead, it is only used as metadata to describe the variable or output.
1) Create the following Terraform configuration:
provider "aws" {
region = "eu-west-1"
}
variable "instance_type" {
description = "The type of instance to create"
default = "t2.micro"
}
resource "aws_instance" "example" {
ami = "ami-096800910c1b781ba" # Replace this with an appropriate AMI ID for your region
instance_type = var.instance_type
}
output "instance_id" {
description = "The ID of the created instance"
value = aws_instance.example.id
}
2) After you run terraform apply on this configuration, the state file (terraform.tfstate) will include the value of the instance_type variable ("t2.micro")
and the value of the instance_id output (which would be the ID of the created AWS instance),
but it would not include the descriptions of either the variable or the output.
A. True
Terraform variables and outputs that set the "description" argument will indeed store that description in the state file. This allows for better documentation and understanding of the purpose of variables and outputs within the Terraform configuration. However, it's important to note that sensitive information should not be included in descriptions as the state file is stored in plain text and could potentially expose sensitive information if not handled properly.
Terraform state files are intended to store the actual configuration and state of the infrastructure, focusing on information that is necessary for Terraform to understand and manage the resources. Descriptions, being informational and not affecting the infrastructure's configuration or behavior, are typically not included in the state file to keep it concise and focused on essential details for Terraform's management.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
SilentMilli
Highly Voted 2 years agoantivrillee
Highly Voted 2 years, 6 months agoBere
Most Recent 5 months, 3 weeks agostarkonbullet
10 months agomamtak_2008
1 year, 1 month agoLashe
7 months, 1 week agosamimshaikh
1 year, 2 months agoguicane
1 year, 3 months agoluke404
1 year, 4 months agoMimi666
1 year, 5 months agoBadii
1 year, 6 months agoJayanth
1 year, 7 months agoBusi57
1 year, 7 months agoShane_C
1 year, 8 months agoSIAMIANJI
1 year, 9 months agoPower123
1 year, 11 months agoMal_8
2 years agoOnly5
2 years, 1 month agoguicane
1 year, 3 months ago