https://github.com/pedrofurtado/terraform-demo
Terraform demo. Just for fun.
https://github.com/pedrofurtado/terraform-demo
Last synced: about 1 month ago
JSON representation
Terraform demo. Just for fun.
- Host: GitHub
- URL: https://github.com/pedrofurtado/terraform-demo
- Owner: pedrofurtado
- Created: 2024-04-07T10:27:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T12:04:44.000Z (about 1 year ago)
- Last Synced: 2025-01-25T23:55:22.877Z (3 months ago)
- Language: HCL
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform demo
Terraform demo. Just for fun.
## Requirements
- Github token to allow Github Actions post comments in pull requests
- AWS IAM user (with access key) that have a IAM inline policy like `iam-policy.json`
- AWS S3 Bucket `my-bucket-external-state-of-terraform` created with default configs provided by AWS
- Terraform v1.7.5## Use
```bash
# Export required environment variables
export TF_LOG=INFO
export TF_INPUT=false
export AWS_ACCESS_KEY_ID=xxx
export AWS_SECRET_ACCESS_KEY=xxx
export AWS_REGION=us-east-1
export TF_VAR_S3_BUCKET_NAME=my-bucket-external-state-of-terraform
export TF_VAR_S3_KEY=path/to/my/state.tfstate# Init
terraform init -backend-config="bucket=$TF_VAR_S3_BUCKET_NAME" -backend-config="key=$TF_VAR_S3_KEY" -backend-config="region=$AWS_REGION"# Lint / Validate
terraform fmt -check
terraform validate# Plan
terraform plan# Apply
terraform apply
```