Terraform concepts
- Providers
- Resource
- Datasource
- Argument
-
Attribute
-
Provider is vendor specific implementation which is used by terrform to create/manage infra
-
Resource: This represents an infra element which you want to create
-
Argument: Inputs
- Attribute: Outputs
Popular Terraform providers
Steps for creating Terraform Templates
- Create a new folder
- Create any file with extension
.tf
- In this files you are supposed to write
HCL
- Provider syntax
- resource syntax
- Configuring AWS Provider
- In the file
# provider
provider "aws" {
region = "ap-south-1"
}
# resource
- Now to download provider from cli
terraform init
- To write a resource Refer Here for syntax
- For s3
# provider
provider "aws" {
region = "ap-south-1"
}
# resource
resource "aws_s3_bucket" "first" {
# argument
bucket = "qt-apr-1-test-from-tf"
}
- Now execute
terraform apply
- Now to clean
terraform destroy
Lets create a s3 bucket in aws
You are an aws expert,
I want you to guide me how to create aws s3 bucket in Console
Way of Working
- Figure out manual steps
- Choose the right provider
- Define resources with right arguments
- use terraform commands
Like this:
Like Loading...