~rogeruiz/dns

11605a477a48f4cb73d9e05c293b4fb1d6a5fa07 — Roger Steve Ruiz 2 months ago f544b5d adding-automated-build
Fixing the script to run with files; 🙄

I tried to use the Terraform environment variables that are referenced
in the documentation, pero no no no y no. They just don't work. Me gusta
la solución que que le hice but it's just not right. No quiero ser esto
de esta via.
3 files changed, 32 insertions(+), 3 deletions(-)

M .build.yml
A ci/build-tfc-rc.sh
A ci/build-tfvars-file.sh
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