Sunday, June 7, 2020

Terraform : IAC series I

This blog covers the basics of terraform a declarative language for managing infrastructure as code. 
Download link:
 brew install terraform  //mac
 choco install terraform //windows // manual :https://www.terraform.io/downloads.html
 Editor : Visual Studio code

Install terraform from above location. Check the installed version on terminal
 terraform -- version
Sample example 1

create a file main.tf
provider "aws" {
    access_key="XXXXXXXXXX"
    secret_key="xxxxx"
    region="us-east-1"
}
resource "aws_instance" "myfirstec2" {
  ami="ami-09d95fab7fff3776c"
  instance_type="t2.micro"
  tags= {
      Name="The Techie House demo"
  }
}
resource "aws_s3_bucket" "theTechieHouseB" {
  bucket="the-techie-house-first-bucket"
  acl="private"
  tags ={
            Name="The Techie House demo"
  }
}
Commands:
I. terraform init
II. terraform plan // show what it is going to perform
III. terraform apply // Going to create infrastructure
IV. Terraform show // show the available resources
V. terraform destroy // destroy everything

No comments:

Post a Comment