-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update examples to cover a few phases for more throughout testing
- Loading branch information
Showing
10 changed files
with
395 additions
and
87 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/testout | ||
/helmfile-*.yaml | ||
/*.log | ||
/USE | ||
/temp.values-*.yaml | ||
/*.tf | ||
/terraform.tfstate* |
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,43 @@ | ||
TF ?= terraform-v0.12.29 | ||
TEST_OUT_DIR ?= testout/$(shell cat USE | tr -d '\n' || echo current) | ||
TF_LOG ?= TRACE | ||
|
||
.PHONY: dev | ||
dev: | ||
rm tf.log tf.*.log || true | ||
rm -rf ./tf.*.pprof || true | ||
make testdata/01-bootstrap init plan apply | ||
make testdata/02-more-resources plan apply | ||
make testdata/03-add-prom plan apply | ||
make destroy | ||
|
||
.PHONY: init | ||
init: | ||
cd .. ; make build | ||
mv ../dist/darwin_amd64/terraform-provider-helmfile .terraform/plugins/darwin_amd64/terraform-provider-helmfile | ||
$(TF) init | ||
|
||
.PHONY: testout | ||
testout: | ||
mkdir -p $(TEST_OUT_DIR) | ||
|
||
.PHONY: apply | ||
apply: testout | ||
TF_LOG=$(TF_LOG) TF_LOG_PATH=$(TEST_OUT_DIR)/apply.log time -l $(TF) apply -auto-approve | ||
|
||
.PHONY: destroy | ||
destroy: testout | ||
TF_LOG=$(TF_LOG) TF_LOG_PATH=$(TEST_OUT_DIR)/destroy.log time -l $(TF) destroy -auto-approve | ||
|
||
.PHONY: plan | ||
plan: testout | ||
TF_LOG=$(TF_LOG) TF_LOG_PATH=$(TEST_OUT_DIR)/plan.log time -l $(TF) plan | ||
|
||
STEPS = $(wildcard testdata/*) | ||
|
||
.PHONY: $(STEPS) | ||
.SECONDEXPANSION: | ||
$(STEPS):%:$$(wildcard %/*.yaml) | ||
@echo Preparing $@ | ||
cp $@/*.{tf,yaml} . | ||
@echo $(shell basename $@) > USE |
This file was deleted.
Oops, something went wrong.
8 changes: 6 additions & 2 deletions
8
examples/helmfile.yaml → examples/testdata/01-bootstrap/helmfile.yaml
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,8 +1,12 @@ | ||
repositories: | ||
- name: sp | ||
url: https://stefanprodan.github.io/podinfo | ||
|
||
releases: | ||
- name: {{ .Values.name }}-{{ requiredEnv "FOO" }} | ||
chart: sp/podinfo | ||
values: | ||
- image: | ||
tag: foobar2abcd | ||
- values.yaml | ||
labels: | ||
labelkey1: value1 | ||
labelkey2: value2 |
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,33 @@ | ||
provider "helmfile" {} | ||
|
||
resource "helmfile_release_set" "mystack" { | ||
content = file("./helmfile.yaml") | ||
|
||
helm_binary = "helm3" | ||
|
||
working_directory = path.module | ||
|
||
environment = "default" | ||
|
||
environment_variables = { | ||
FOO = "foo" | ||
} | ||
|
||
values = [ | ||
<<EOF | ||
{"name": "myapp"} | ||
EOF | ||
] | ||
|
||
selector = { | ||
labelkey1 = "value1" | ||
} | ||
} | ||
|
||
output "mystack_diff" { | ||
value = helmfile_release_set.mystack.diff_output | ||
} | ||
|
||
output "mystack_apply" { | ||
value = helmfile_release_set.mystack.apply_output | ||
} |
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,12 @@ | ||
repositories: | ||
- name: sp | ||
url: https://stefanprodan.github.io/podinfo | ||
|
||
releases: | ||
- name: {{ .Values.name }}-{{ requiredEnv "FOO" }} | ||
chart: sp/podinfo | ||
values: | ||
- values.yaml | ||
labels: | ||
labelkey1: value1 | ||
labelkey2: value2 |
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,136 @@ | ||
provider "helmfile" {} | ||
|
||
resource "helmfile_embedding_example" "emb1" { | ||
embedded { | ||
path = "./helmfile.yaml" | ||
|
||
helm_binary = "helm3" | ||
|
||
|
||
|
||
working_directory = path.module | ||
|
||
environment = "default" | ||
|
||
environment_variables = { | ||
FOO = "emb1" | ||
} | ||
|
||
values = [ | ||
<<EOF | ||
{"name": "myapp"} | ||
EOF | ||
] | ||
|
||
selector = { | ||
labelkey1 = "value1" | ||
} | ||
} | ||
} | ||
|
||
resource "helmfile_release_set" "mystack" { | ||
content = file("./helmfile.yaml") | ||
|
||
helm_binary = "helm3" | ||
|
||
|
||
|
||
working_directory = path.module | ||
|
||
environment = "default" | ||
|
||
environment_variables = { | ||
FOO = "foo" | ||
} | ||
|
||
values = [ | ||
<<EOF | ||
{"name": "myapp"} | ||
EOF | ||
] | ||
|
||
selector = { | ||
labelkey1 = "value1" | ||
} | ||
} | ||
|
||
resource "helmfile_release_set" "mystack2" { | ||
content = <<EOF | ||
releases: | ||
- name: myapp2 | ||
chart: sp/podinfo | ||
values: | ||
- image: | ||
tag: "123" | ||
labels: | ||
labelkey1: value1 | ||
- name: myapp3 | ||
chart: sp/podinfo | ||
values: | ||
- image: | ||
tag: "2345" | ||
EOF | ||
|
||
helm_binary = "helm3" | ||
|
||
// working_directory = path.module | ||
working_directory = "mystack2" | ||
|
||
environment = "default" | ||
|
||
environment_variables = { | ||
FOO = "foo" | ||
} | ||
|
||
values = [ | ||
<<EOF | ||
{"name": "myapp"} | ||
EOF | ||
] | ||
|
||
selector = { | ||
labelkey1 = "value1" | ||
} | ||
} | ||
|
||
output "mystack_diff" { | ||
value = helmfile_release_set.mystack.diff_output | ||
} | ||
|
||
output "mystack_apply" { | ||
value = helmfile_release_set.mystack.apply_output | ||
} | ||
|
||
output "mystack2_diff" { | ||
value = helmfile_release_set.mystack2.diff_output | ||
} | ||
|
||
output "mystack2_apply" { | ||
value = helmfile_release_set.mystack2.apply_output | ||
} | ||
|
||
resource "helmfile_release" "myapp" { | ||
name = "myapp" | ||
namespace = "default" | ||
chart = "sp/podinfo" | ||
helm_binary = "helm3" | ||
|
||
// working_directory = path.module | ||
// working_directory = "myapp" | ||
values = [ | ||
<<EOF | ||
{ "image": {"tag": "3.1455" } } | ||
EOF | ||
] | ||
} | ||
|
||
|
||
output "myapp_diff" { | ||
value = helmfile_release.myapp.diff_output | ||
} | ||
|
||
output "myapp_apply" { | ||
value = helmfile_release.myapp.apply_output | ||
} | ||
|
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,16 @@ | ||
repositories: | ||
- name: sp | ||
url: https://stefanprodan.github.io/podinfo | ||
|
||
releases: | ||
- name: {{ .Values.name }}-{{ requiredEnv "FOO" }} | ||
chart: sp/podinfo | ||
values: | ||
- values.yaml | ||
labels: | ||
labelkey1: value1 | ||
labelkey2: value2 | ||
|
||
- name: prom-operator | ||
chart: stable/prometheus-operator | ||
disableValidation: true |
Oops, something went wrong.