-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add self-complete terraform example
- Loading branch information
Showing
10 changed files
with
195 additions
and
122 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
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
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 @@ | ||
.terraform/ |
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,35 @@ | ||
# Test it out | ||
|
||
```shell | ||
$ terraform workspace new dev | ||
$ terraform workspace new stage | ||
$ goal | ||
Available goals: | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| GOAL | ENVIRONMENT | CLI | DESCRIPTION | ASSERTIONS | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| tf-plan | dev | terraform plan -var-file | Terraform plan on dev | [workspace] Check if on dev | | ||
| | | vars/dev.tfvars | | workspace | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| tf-plan | stage | terraform plan -var-file | Terraform plan on stage | [workspace] Check if on stage | | ||
| | | vars/stage.tfvars | | workspace | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| tf-apply | dev | terraform apply -var-file | Terraform apply on dev | [workspace] Check if on dev | | ||
| | | vars/dev.tfvars | | workspace | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| tf-apply | stage | terraform apply -var-file | Terraform apply on stage | [workspace] Check if on stage | | ||
| | | vars/stage.tfvars | | workspace | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
| workspace | | terraform workspace show | Current terraform workspace | | | ||
+-----------+-------------+--------------------------------+-----------------------------+--------------------------------+ | ||
$ terraform workspace show | ||
stage | ||
$ goal tf-plan --on dev | ||
Running on dev | ||
⚙️ Exec tf-plan | ||
⌛ Check precondition: Check if on dev workspace | ||
❗ Precondition failed: workspace | ||
Output: "stage" | ||
Expected: "dev" | ||
CLI: terraform workspace show | ||
``` |
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
Empty file.
Empty file.
Empty file.
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,79 +1,56 @@ | ||
# Note: this on is not implemented yet! | ||
date: | ||
desc: Current date | ||
cmd: date | ||
|
||
current-context: | ||
desc: Current kubectl context | ||
cmd: kubectl | ||
workspace: | ||
desc: Current terraform workspace | ||
cmd: terraform | ||
args: | ||
- config | ||
- current-context | ||
- workspace | ||
- show | ||
|
||
helm-dry-run: | ||
tf-plan: | ||
envs: | ||
dev: | ||
desc: Dry run upgrade on dev | ||
desc: Terraform plan on dev | ||
assert: | ||
desc: Check if on dev cluster | ||
ref: current-context | ||
expect: dev-cluster | ||
cmd: helm | ||
desc: Check if on dev workspace | ||
ref: workspace # References goal above | ||
expect: dev # Checks whether trimmed output from 'ref' goal is equal to "dev" | ||
cmd: terraform | ||
args: | ||
- upgrade | ||
- release-name | ||
- -f | ||
- values.yaml | ||
- -f | ||
- values/dev.yaml | ||
- . | ||
- --dry-run | ||
- plan | ||
- -var-file | ||
- vars/dev.tfvars | ||
stage: | ||
desc: Dry run upgrade on stage | ||
desc: Terraform plan on stage | ||
assert: | ||
desc: Check if on stage cluster | ||
ref: current-context | ||
expect: stage-cluster | ||
cmd: helm | ||
desc: Check if on stage workspace | ||
ref: workspace # References goal above | ||
expect: stage # Checks whether trimmed output from 'ref' goal is equal to "stage" | ||
cmd: terraform | ||
args: | ||
- upgrade | ||
- release-name | ||
- -f | ||
- values.yaml | ||
- -f | ||
- values/stage.yaml | ||
- . | ||
- --dry-run | ||
- plan | ||
- -var-file | ||
- vars/stage.tfvars | ||
|
||
helm-upgrade: | ||
tf-apply: | ||
envs: | ||
dev: | ||
desc: Upgrade on dev | ||
desc: Terraform apply on dev | ||
assert: | ||
desc: Check if on dev cluster | ||
ref: current-context | ||
expect: dev-cluster | ||
cmd: helm | ||
desc: Check if on dev workspace | ||
ref: workspace # References goal above | ||
expect: dev # Checks whether trimmed output from 'ref' goal is equal to "dev" | ||
cmd: terraform | ||
args: | ||
- upgrade | ||
- release-name | ||
- -f | ||
- values.yaml | ||
- -f | ||
- values/dev.yaml | ||
- . | ||
- apply | ||
- -var-file | ||
- vars/dev.tfvars | ||
stage: | ||
desc: Upgrade on stage | ||
desc: Terraform apply on stage | ||
assert: | ||
desc: Check if on stage cluster | ||
ref: current-context | ||
expect: stage-cluster | ||
cmd: helm | ||
desc: Check if on stage workspace | ||
ref: workspace # References goal above | ||
expect: stage # Checks whether trimmed output from 'ref' goal is equal to "stage" | ||
cmd: terraform | ||
args: | ||
- upgrade | ||
- release-name | ||
- -f | ||
- values.yaml | ||
- -f | ||
- values/stage.yaml | ||
- . | ||
- apply | ||
- -var-file | ||
- vars/stage.tfvars |