Sobes.tech
Junior — Middle

What are the main components and resources that need to be defined in a Terraform manifest file?

sobes.tech AI

Answer from AI

The main components of a Terraform manifest file (usually with the .tf extension) are:

  • Providers — define which cloud platforms or services Terraform will work with (e.g., AWS, Azure, GCP).
  • Resources — describe specific infrastructure objects to create or manage (e.g., virtual machines, networks, databases).
  • Variables — allow parameterizing the configuration for flexibility and reuse.
  • Outputs — specify what data to output after applying the configuration.
  • Locals — for defining intermediate computed values within the configuration.

Example of a simple manifest:

provider "aws" {
  region = "us-west-2"
}

resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}

variable "instance_count" {
  type    = number
  default = 1
}

output "instance_id" {
  value = aws_instance.example.id
}
What are the main components and resources that need… - sobes.tech