Terraform - Automation
user: testuser
password: tz1L5=XA
Secret access key: hR8Jw1N2iv+ArjhMxoA4DEZ4GN+ADmVOx3WxIs3v
Access Key: AKIAQRU7H34APSCDY2QT
ami: ami-007020fd9c84e18c7
Local setup
- Keep the
terraform.exe
file andmain.tf
file in same directory level.
provider "aws" {
region = "ap-south-1"
access_key = "AKIAQRU7H34APSCDY2QT"
secret_key = "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"
}
resource "aws_instance" "app_server" {
ami = "ami-007020fd9c84e18c7"
instance_type = "t2.micro"
tags = {
Name = "testServerInstance"
}
}
./terraform.exe fmt
./terraform.exe plan
./terraform.exe init
Creating Instance
./terraform.exe apply
Deleting Instance
./terraform.exe destroy
- Count = 5
provider "aws" {
region = "ap-south-1"
access_key = "AKIAQRU7H34APSCDY2QT"
secret_key = "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"
}
resource "aws_instance" "app_server" {
ami = "ami-007020fd9c84e18c7"
instance_type = "t2.micro"
count = 5
tags = {
Name = "testServerInstance"
}
}