Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miteshsharma/terraformwiths3backend
Terraform configuration files with S3 backend and dynamo DB as locking mechanism
https://github.com/miteshsharma/terraformwiths3backend
dynamodb infrastructure-as-code remote-backends s3 terraform
Last synced: about 19 hours ago
JSON representation
Terraform configuration files with S3 backend and dynamo DB as locking mechanism
- Host: GitHub
- URL: https://github.com/miteshsharma/terraformwiths3backend
- Owner: MiteshSharma
- License: mit
- Created: 2018-08-30T18:07:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T18:15:20.000Z (about 6 years ago)
- Last Synced: 2023-03-05T02:03:24.775Z (over 1 year ago)
- Topics: dynamodb, infrastructure-as-code, remote-backends, s3, terraform
- Language: HCL
- Size: 2.93 KB
- Stars: 14
- Watchers: 2
- Forks: 35
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform with S3 backend and dynamo DB locking
Terraform helps us build, evolve, and manage our infrastructure using its configuration files across multiple providers. When we are building infrastructure with terraform configuration, a state file gets generated in the local workspace directory named "terraform.tfstate". This state file contains information about the provisioned infrastructure which terraform is managing. Whenever we do changes in terraform configuration, Terraform automatically determines which part of your configuration is already deployed and which needs to be changed with help of state file. State helps provides immutability to terraform as it already knows if one resource is present and prevent it to be deployed again when the same configuration executes.
## Steps to run this code:
Step 1: Clone this repository
Step 2: Replace "ACCESS_KEY_HERE" with aws access key and "SECRET_KEY_HERE" with aws secret key. These keys can be generated from IAM module of aws.
Step 3: Go to s3 folder and execute terraform from below mentioned steps. This is going to create an S3 bucket which is used to store terraform state.
Step 4: Go to dynamoDB folder and execute terraform from below mentioned steps. This is going to create a dynamo DB table which is used for locking terraform configuration execution.
Step 5: Go back to the main folder and execute terraform to create EC2 instance with S3 as backend and DynamoDB as a locking mechanism.
Steps to execute any terraform code:
Step 1: Run command "terraform init" to init configuration workspace
Step 2: Run command "terraform plan" to see output which is going to be executed.
Step 5: Run command "terraform apply" to actually create terraform resources
Step 6: Run command "terraform destroy" to destroy created resources.