Wednesday, June 5, 2024

Terraform S3 Backend Configuration

#provider.tf

provider "aws" {
  region = "us-east-1"
  access_key = "my-access-key"
  secret_key = "my-secret-key"

}

main.tf:


resource "aws_instance" "ec2web3" {
  ami           = "ami-0d191299f2822b1fa"
  instance_type = "t2.micro"
}

terraform {

  backend "s3" {

    access_key = "xxxxxxxxxxxxxxx"
    secret_key = "xxxxxxxxxxxxxxxxxxxxxxx"
    region     = "us-east-1"
    bucket     = "kishor-tf-state"
    key        = "terraform.tfstate"
  }
}

#command
terraform init -backend-config="access_key=xxxxxxxxxxxxxxxx"
-backend-config="secret_key=xxxxxxxxxxxxxxxxxx"




No comments:

Post a Comment

Sample Game App Deployment on EKS cluster

 https://padmakshi.medium.com/setting-up-an-eks-cluster-and-deploying-a-game-application-a-step-by-step-guide-08790e0be117