https://github.com/willfarrell/terraform-prime
Super lightweight wrapper over terraform to allow `${var.*****}` inside backends.
https://github.com/willfarrell/terraform-prime
Last synced: 2 months ago
JSON representation
Super lightweight wrapper over terraform to allow `${var.*****}` inside backends.
- Host: GitHub
- URL: https://github.com/willfarrell/terraform-prime
- Owner: willfarrell
- License: mit
- Created: 2018-10-02T16:01:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-08T22:18:02.000Z (over 7 years ago)
- Last Synced: 2025-01-19T13:27:12.794Z (about 1 year ago)
- Language: Shell
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-prime
Super lightweight wrapper over terraform to allow `${var.*****}` inside backends. This allows for flatter folder structure in your terraform projects.
- [hashcorp/terraform#13022](https://github.com/hashicorp/terraform/issues/13022)
- [hashcorp/terraform#17288](https://github.com/hashicorp/terraform/issues/17288)
## Getting Started
### Prerequisites
- `terraform` must be installed. `$ brew install terraform coreutils`
### Installing
Copy `terraform-prime` to `/usr/local/bin/` and ensure its executable (`chmod u+x /usr/local/bin/terraform-prime`).
Update `bashrc` to include
```bash
alias tf=terraform-prime
```
## Running the test
Run `tf test production`. Check `terraform` configuration has all variables replaced.
## Running
To allow deploying between ... ** TODO
```bash
environments
|- app
| |- env.production.tfvars
| |- env.staging.tfvars
| |- terraform.tfvars
| |- main.tf
```
env.production.tfvars
```hcl-terraform
environment=production
```
terraform.tfvars
```hcl-terraform
name=appname
profile=codename
```
main.tf
```hcl-terraform
terraform {
backend "s3" {
bucket = "terraform-state-${var.name}"
key = "${var.environment}/account/terraform.tfstate"
region = "us-east-1"
profile = "${var.profile}"
dynamodb_table = "terraform-state-${var.name}"
}
}
...
```
### Running
```bash
$ tf init staging
# tf {action} {environment} [args]
$ tf plan staging
# clear current env cache
$ tf clear
# clear and init env
$ tf switch production
```
## Built With
- bash
- [terraform](https://www.terraform.io/)
## Contributing
## Versioning
## Authors
- [will Farrell](https://github.com/willfarrell)
## License
This project is licensed under the MIT License - see the [LICENSE]() file for details
## TODO
- [ ] Streamline installation (brew?)
- [ ] recursively check for tfvars in parent dirs