variables.tf
variable "aws_region" {
description = "AWS region where EC2 instance will be created"
type = string
}
variable "instance_type" {
description = "EC2 instance type"
type = string
}
variable "ami_id" {
description = "AMI ID for the EC2 instance"
type = string
}
firsttest.tf
provider "aws" {
region = var.aws_region
}
resource "aws_instance" "test" {
ami = var.ami_id
instance_type = var.instance_type
}
terraform.tfvars
aws_region = "eu-north-1"
ami_id = "ami-07c8c1b18ca66bb07"
instance_type = "t3.micro"
the error i got when run terraform apply -auto-approve
terrform version:
Terraform v1.9.1
on windows_amd64
provider registry.terraform.io/hashicorp/aws v5.58.0