sudo vi create_s3.tf
resource "aws_s3_bucket" "mybucket" {
bucket = "my-tf-test-bucket"
acl = "public-read"
website {
index_document = "hello.html"
routing_rules = <<EOF
[{
"Condition": {
"KeyPrefixEquals": "docs/"
},
"Redirect": {
"ReplaceKeyPrefixWith": "documents/"
}
}]
EOF
}
tags= {
Name = "My bucket"
Environment = "Dev"
}
}
Once you create the above file, execute terraform plan and then terraform apply to create S3 bucket in AWS.
Join the Discussion
Have a question about this tutorial or need help with a lab? Share your questions and feedback below.
Post a Comment