Activity: From Terraform Create an S3 bucket in AWS Cloud (Contd)
- Create a new folder and create an empty file
main.tfin it. - Open this folder with vscode
- Install Terraform Extension from Hashicorp
- Create the basic provider skeleton syntax
- Install AWS CLI
- Windows =>
choco install awscli - Mac =>
brew install awscli
- Windows =>
- Create an IAM authentication as mentioned Refer Here
- Now execute aws configure and enter the secret access key id and access key, region (us-west-2) and output format => json
- So after configuring credentials. Execute
terraform initto download the providers configured - Now we need to configure the resource s3_bucket Refer Here
- Now fill the required arguments Refer Here
- Now lets check for the validity of the configuration which we have written
- Now try creating the resources by executing
terraform apply - Now check for the resources created or not
- Once the infra is created, lets execute
terraform applyagain - Terraform is idempotent i.e. when you run terraform multiple times to create the infrastructure it will lead to the same result i.e. your desired state
- Now lets change the acl to
public-read& apply - Now lets try to delete the infrastructure which we have created
- Refer Here for the changes done in the main.tf file.
