M .build.yml => .build.yml +8 -3
@@ 6,13 6,18 @@ secrets:
- 3b922da4-d093-4870-85eb-393a4c83dd78
environment:
project: dns
- TFENV_INSTALL_DIR: ~/.tfenv/
- TF_VAR_gandi_api_key: "$(cat ~/.gandi-api-key)"
- TF_TOKEN_app_terraform_io: "$(cat ~/.user-token-tf-gandi-dns)"
tasks:
+ - set-envs: |
+ echo "shh, setting some secrets!"
+ set +x
+ bash ${project}/ci/build-tfc-rc.sh
+ bash ${project}/ci/build-tfvars-file.sh
+ set -x
+ echo "ok, back to work."
- install-tfenv: |
pushd "${project}"
sudo tfenv install
+ sudo tfenv use
popd
- terraform-init: |
pushd "${project}"
A ci/build-tfc-rc.sh => ci/build-tfc-rc.sh +13 -0
@@ 0,0 1,13 @@
+#!/bin/bash
+
+set +x
+
+# README: I really don't want to do this but I don't seem to have a choice
+# here. The TF CLI doesn't work with the `TF_TOKEN_app_terraform_io` variable.
+cat << TFCRC > ~/.terraformrc
+credentials "app.terraform.io" {
+ token = "$(cat ~/.user-token-tf-gandi-dns)"
+}
+TFCRC
+
+set -x
A ci/build-tfvars-file.sh => ci/build-tfvars-file.sh +11 -0
@@ 0,0 1,11 @@
+#!/bin/bash
+
+set +x
+
+# README: I really don't want to do this but I don't seem to have a choice
+# here. The TF CLI doesn't work with the `TF_VAR_gandi_api_key` variable.
+cat << TFVARS > ~/${project}/terraform.tfvars
+gandi_api_key = "$(cat ~/.gandi-api-key)"
+TFVARS
+
+set -x