Preparation

To learn how to use terraform provider AWS:

AWS Provider

Define terraform version

terraform {
  required_version = ">= 1.6" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.0"
    }
    null = {
      source = "hashicorp/null"
      version = "~> 3.0"
    }        
  }
}

Define Provider

  • The “access key” and “secret key” is located in your account security credential
  • This lab will use only “us-east-1” region
# Provider AWS
provider "aws" {
  region  = var.aws_region
  access_key = ""
  secret_key = ""
}
# AWS Region
variable "aws_region" {
  description = "Region in which AWS Resources to be created"
  type = string
  default = "us-east-1"  
}

Content