terraform statefile configuration

0 votes

I am currently reading the book called "Terraform-up-and-learning 2nd edition"

In the section introducing setting state file remotely, I faced a trouble.

this is the code that I ran.

terraform {
        backend "s3" {
                bucket = "my-state"
                key = "workspaces-example/terraform.tfstate"
                region = "ap-southeast-1"

                dynamodb_table = "my-lock"
                encrypt = true
        }
}

provider "aws" {
        region = "ap-southeast-1"
        profile = "my-test"
}

resource "aws_instance" "example" {
        ami = "ami-02045ebddb047018b"
        instance_type = "t2.micro"
}

prior to running this code, I made s3 and DDB using my AWS console by hand. And

terraform init
terraform plan

works well.

But I can't find any state file in my AWS console. Following the book, the state file should be in "my-state" s3.

In addition, I can't find any statefile in my local too.

Jan 4, 2023 in AWS by Ashwini
• 5,430 points

edited 5 days ago 5 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP