better file organization

main
Ricard Illa 2022-08-25 10:18:32 +02:00
parent bdee978dce
commit dea4066e3b
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
8 changed files with 11 additions and 10 deletions

View File

@ -12,7 +12,7 @@ pipeline:
image: registry.monotremata.xyz/terraform image: registry.monotremata.xyz/terraform
pull: true pull: true
commands: commands:
- terraform init -backend-config="conn_str=$BACKEND_CONN_STR" - terraform -chdir=tf init -backend-config="conn_str=$BACKEND_CONN_STR"
secrets: secrets:
[backend_conn_str] [backend_conn_str]
@ -20,8 +20,8 @@ pipeline:
image: registry.monotremata.xyz/terraform image: registry.monotremata.xyz/terraform
pull: true pull: true
commands: commands:
- terraform plan -out=tfplan - terraform -chdir=tf plan -out=tfplan
- terraform show -json tfplan - terraform -chdir=tf show -json tfplan
environment: environment:
- HTTP_PROXY=caladan:8888 - HTTP_PROXY=caladan:8888
- HTTPS_PROXY=caladan:8888 - HTTPS_PROXY=caladan:8888
@ -34,7 +34,7 @@ pipeline:
image: registry.monotremata.xyz/terraform image: registry.monotremata.xyz/terraform
pull: true pull: true
commands: commands:
- terraform apply tfplan - terraform -chdir=tf apply tfplan
environment: environment:
- HTTP_PROXY=caladan:8888 - HTTP_PROXY=caladan:8888
- HTTPS_PROXY=caladan:8888 - HTTPS_PROXY=caladan:8888

View File

@ -27,13 +27,14 @@ create resources manually and import them later to terraform.
## Wrapper scripts ## Wrapper scripts
I run Terrafrom through two wrapper scripts: `init.sh` and `run_terraform`. I run Terrafrom through two wrapper scripts: `scripts/init.sh` and
`scripts/run_terraform`.
`init.sh` is used just to run `terraform init`. It fetches the PostgreSQL `scripts/init.sh` is used just to run `terraform init`. It fetches the
phssword (from `pass`) and it passes the connection string manually to the PostgreSQL phssword (from `pass`) and it passes the connection string manually
partially-configured pg backend. to the partially-configured pg backend.
`run_terraform` is used to run other terraform commands. It sets up the `scripts/run_terraform` is used to run other terraform commands. It sets up the
`HTTP_PROXY` and `HTTPS_PROXY` variables to use `caladan` as a proxy. It also `HTTP_PROXY` and `HTTPS_PROXY` variables to use `caladan` as a proxy. It also
fetches the secrets (from `pass`) and exports the variables for api keys and fetches the secrets (from `pass`) and exports the variables for api keys and
tokens needed by the different providers. tokens needed by the different providers.

View File

@ -11,4 +11,4 @@ export NAMECHEAP_API_KEY
export LINODE_TOKEN export LINODE_TOKEN
export VULTR_API_KEY export VULTR_API_KEY
terraform "$@" terraform -chdir=./tf "$@"

View File

View File