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.