what is a resource block in terraform ?
It defines a specific infrastructure component, such as a virtual machine, storage bucket, or a database, that Terraform will manage.
how do you run the terraform destroy command to destroy just a specific resource ?
use the -target flag. (terraform destroy -target resource_type.local_resource_name)
what is an attribute in terraform ?
Attributes define the details or configuration of a resource and can also include information Terraform retrieves after the resource is created
what is string interpolation ?
string interpolation is used when you want to merge or combine variables (or expressions) with plain text (defined directly in the string).
eg variable “username” {
default = “Alice”
}
“Welcome, ${var.username}!”
what is the function of an output block in terraform ?
it makes information about your infrastructure available on the command.
what are variables in terraform ?
A variable in Terraform is like a container for storing data that can be reused throughout your configuration
what are the different ways you can define variables in terraform ?
which variable takes precedence in terraform ?
what is data type in terraform ?
In Terraform, data types define the kind of values a variable or output can hold. eg string boolean number list set map null
what are the different meta arguments in terraform ?
create_before_destroy: Ensures a new resource is created before destroying the old one.
prevent_destroy: Protects a resource from being destroyed accidentally.
ignore_changes: Tells Terraform to ignore changes to certain attributes.
- timeouts: Configures how long Terraform should wait for a resource operation to complete.