How to start Terraform on local machine
1. Resources
- Docker Engine
- Docker Compose
- Terraform
2. Steps for starting
- Download file docker-compose-aws-localstack
- Build localstack if none:
docker-compose -f docker-compose.yml up -d –build
- Ready to Deploy
-
Download a sample terraform-sample.tf and follow commands in following:
-
Init Terraform backend
terraform init -input=false
-
Terraform syntax validation
terraform validate
-
Plan for seeing any changes on resources
terraform plan
-
Deploy for new resources creation
terraform apply –auto-approve
-
- Destroy resources with
terraform destroy
3. Development
aws_lambda_function.web_raw_ingesting_lambda: Creation complete after 13s [id=web_raw_ingesting_lambda]
╷
│ Warning: AWS account ID not found for provider
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on main.tf line 12, in provider "aws":
│ 12: provider "aws" {
│
│ See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.
╵
Apply complete! Resources: 6 added, 0 changed, 0 destroyed.
Note: Tears down before you leave!
AWS Mock
terrafrom --destroy --auto-approve
aws_kinesis_stream.web_raw_streaming: Destruction complete after 10s
╷
│ Warning: AWS account ID not found for provider
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on main.tf line 12, in provider "aws":
│ 12: provider "aws" {
│
│ See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.
╵
Destroy complete! Resources: 6 destroyed.
Docker
docker-compose down
[+] Running 2/1
✔ Container livestream_data_pipeline Removed 3.7s
✔ Network 2_docker_aws_default Removed