Terraform scripts are used to create, manage, and delete resources.
Resources are deleted after use.
Get the Terraform scripts from the
These scripts are applicable to Terraform version v0.12.16.
- Download Terraform: Terraform Download Site.
- Install Terraform.
- Set the Terraform path in the environmental variables.
To verify that Terraform is installed, type
terraform at the command line to display an options list.
Creating and managing resources
To create and manage the resources:
- Ensure that the Terraform scripts are in place.
- Add the access key and secret key for the service account to the
- Ensure that the
provider.tffile has access to the project.
- Place all of the required
.tffiles into the same folder.
If you need to create a set of resources, put all those resources
.tf files in the same folder as the
The following Terraform commands are used to create, manage, and delete resources:
terraform init - Initializes Terraform.
terraform plan - Shows the list of actions.
terraform plan -out=plan_store - Stores and directly applies the plan.
terraform apply plan_store - Stores a plan in the plan_store.
terraform apply - Shows the list of actions and asks for permission to apply the plan actions.
terraform destroy - Destroys all the resources created with Terraform.
- By storing a plan in the
plan_store, the permission query is bypassed when applying the plan.
- When a folder contains all types of
.tffiles, only a specific type of
.tffile should be executed.
To execute a single type file, use the following commands:
terraform plan -out=plan_store -target="resource_name.logical_name"
For example, to create only instances, use the following commands:
terraform plan -out=plan_store -target="amazon_compute_instance.instanceTest"
terraform apply plan_store
Amazon API Gateway
Amazon Direct Connect
Amazon Elastic Block Store
Amazon Elastic File System
Amazon Elastic Transcoder
Amazon Elastic Beanstalk
Amazon Internet of Things
Amazon Key Management Service
Amazon Elemental MediaConvert
Amazon Elemental MediaPackage
Amazon Managed Streaming for Kafka
Amazon NAT Gateway
Amazon Route 53
Amazon Step Functions
Amazon Simple Workflow Service
Amazon Web Application Firewall
AWS Code Commit (Repository)