-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from paulRbr/0.10.4
Release 0.10.4 in sync with terraform's version
- Loading branch information
Showing
7 changed files
with
115 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ install: | |
script: | ||
# Basic run | ||
- make | ||
- ./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM hashicorp/terraform:0.10.4 | ||
|
||
RUN apk add --update make bash | ||
|
||
WORKDIR /opt/terraform | ||
COPY . . | ||
|
||
VOLUME [ /opt/terraform/providers ] | ||
VOLUME [ /opt/terraform/modules ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,72 @@ | ||
# Makefile for Terraform users | ||
|
||
This repository provides a Makefile to give you a simple interface for Terraform. | ||
This repository provides a Makefile to give you a simple interface for [Terraform](https://www.terraform.io/). | ||
|
||
## Why? | ||
|
||
- Simplify your CLI terraform runs | ||
- Don't Repeat Yourself while typing terraform commands | ||
- Easier adoption for people that are not used to Terraform | ||
- Document common usage | ||
- Unique entrypoint script for credentials management | ||
- Unique entrypoint script for credentials management (only for AWS, Azure, DigitalOcean, Google and Scaleway for now) | ||
- either passing ENV variables. E.g. `<PROVIDER>_<ENV>_SECRET` will be mapped to `DIGITALOCEAN_TOKEN` if `provider=do` is provided as variable | ||
- either using [`pass`](https://www.passwordstore.org/) as local secret manager. E.g. password `terraform/<provider>/<env>/secret` will be mapped to `DIGITALOCEAN_TOKEN` if `provider=do` is provided as variable | ||
|
||
## Installation | ||
|
||
Simply download the `Makefile` and the `terraform.sh` files in your terraform configuration directory. | ||
|
||
wget -O Makefile https://raw.githubusercontent.com/paulRbr/terraform-makefile/master/Makefile | ||
wget -O terraform.sh https://raw.githubusercontent.com/paulRbr/terraform-makefile/master/terraform.sh | ||
wget -N https://raw.githubusercontent.com/paulRbr/terraform-makefile/master/{Makefile,terraform.sh} | ||
|
||
## Convention | ||
|
||
This makefile assumes your terraform configuration files are stored as such: | ||
|
||
``` | ||
providers/ | ||
├── aws | ||
│ ├── prod | ||
│ │ └── empty.tf | ||
│ └── test | ||
│ └── empty.tf | ||
├── do | ||
│ └── prod | ||
│ └── empty.tf | ||
│ ├── prod | ||
│ │ └── empty.tf | ||
│ └── test | ||
│ └── empty.tf | ||
└── scaleway | ||
└── prod | ||
└── empty.tf | ||
``` | ||
|
||
I.e. `providers/<provider>/<env>/*.tf` | ||
|
||
## Commands | ||
|
||
This is the list of commands made available | ||
List of commands made available | ||
|
||
~~~bash | ||
> make | ||
Terraform-makefile v0.10.4 | ||
destroy make destroy # Destroy resources | ||
dry-run make dry-run # Dry run resources changes | ||
install make install # Install terraform and dependencies | ||
lint make lint # Rewrites config to canonical format | ||
list make list # List infra resources | ||
run make run # Execute resources changes | ||
validate make validate # Basic syntax check | ||
~~~ | ||
|
||
## Variables | ||
|
||
This is the explanation of variables that can be passed to commands: | ||
Details of the variables that can be passed to commands: | ||
|
||
|
||
| Name | Default | Description | Example | | ||
| --------- | ------- | ----------- | ------- | | ||
| `provider`| - | Name of the cloud provider to target | If you have an terraform file in `provider/aws/production/production.tf` you will be able to `make run provider=aws env=production` | | ||
| `env` | - | Name of the environment you want to use | If you have an terraform file in `provider/google/production/production.tf` you will be able to `make run provider=google env=production` | | ||
| `args` | - | Add terraform understandable arguments | `make dry-run args='-no-color'` | | ||
| Name | Default | Values | Description | Example | | ||
| --------- | ------- | ------ | ----------- | ------- | | ||
| `provider`| - | `aws`<br/>`azure`<br/>`do`<br/>`google`<br/>`scaleway` | Name of the cloud provider to target | With your terraform file in `provider/aws/production/production.tf` you will be able to `make dry-run provider=aws env=production` | | ||
| `env` | - | `String` | Name of the environment you want to use | With a terraform file in `provider/google/production/production.tf` you will be able to `make dry-run provider=google env=production` | | ||
| `args` | - | `String` | Add terraform understandable arguments | `make dry-run args='-no-color'` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.10.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
|
||
echo "Checking difference between README.md and make help output..." | ||
readme_help="$(awk '/> make/{f=1;next} /~~~/{f=0} f' README.md)" | ||
make_help="$(make | sed 's,\x1B\[[0-9;]*[a-zA-Z],,g')" | ||
diff <(echo "$readme_help") <(echo "$make_help") || (printf "\033[31mFAILED!\033[0m\n" && exit 1) | ||
printf "\033[32mOK\033[0m\n" | ||
|
||
echo "Checking version..." | ||
[ "$(git grep $(cat VERSION) | wc -l)" -eq 6 ] || (printf "\033[31mFAILED!\033[0m\n" && exit 1) | ||
printf "\033[32mOK\033[0m\n" |