From 7302f61ddf7d0af789ddb326a52ec5f4dd569513 Mon Sep 17 00:00:00 2001 From: Valentin Matton Date: Wed, 27 Sep 2023 10:20:31 +0200 Subject: [PATCH] chore: single multienv directory --- .../staging => }/.terraform.lock.hcl | 0 deployment/README.md | 10 ++-- .../{environments/staging => }/backend.tf | 0 deployment/docker-compose.yml | 1 - deployment/environments/staging/README.md | 47 ------------------- deployment/{environments/staging => }/main.tf | 2 +- 6 files changed, 6 insertions(+), 54 deletions(-) rename deployment/{environments/staging => }/.terraform.lock.hcl (100%) rename deployment/{environments/staging => }/backend.tf (100%) delete mode 100644 deployment/environments/staging/README.md rename deployment/{environments/staging => }/main.tf (98%) diff --git a/deployment/environments/staging/.terraform.lock.hcl b/deployment/.terraform.lock.hcl similarity index 100% rename from deployment/environments/staging/.terraform.lock.hcl rename to deployment/.terraform.lock.hcl diff --git a/deployment/README.md b/deployment/README.md index bdcd59f71..2c6951c63 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -34,7 +34,7 @@ This is preferably shared by environments. Use the `-chdir=` option to target a specific environment: ```bash -docker compose run --rm tf -chdir=environments/staging plan +docker compose run --rm tf plan ``` ### initializing the state backend @@ -43,7 +43,7 @@ docker compose run --rm tf -chdir=environments/staging plan ```bash set +o history -docker compose run --rm tf -chdir=environments// init \ +docker compose run --rm tf init \ -backend-config "bucket=data-inclusion-terraform" \ -backend-config "key=stack_data/" \ -backend-config "region=fr-par" \ @@ -60,7 +60,7 @@ The deployment is configured through variables. The set of variables will be dif To generate a configuration file for a specific environment: ```bash -USER_ID=$(id -u) docker compose run --rm tf-vars environments/ +USER_ID=$(id -u) docker compose run --rm tf-vars . ``` The generated `terraform.tfvars.json` file can be filled with the appropriate values for that environment. @@ -73,10 +73,10 @@ The generated `terraform.tfvars.json` file can be filled with the appropriate va ```bash # review changes -docker compose run --rm tf -chdir=environments/staging plan +docker compose run --rm tf plan # apply -docker compose run --rm tf -chdir=environments/staging apply +docker compose run --rm tf apply ``` ### updating auto generated documentation diff --git a/deployment/environments/staging/backend.tf b/deployment/backend.tf similarity index 100% rename from deployment/environments/staging/backend.tf rename to deployment/backend.tf diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 3355b709c..da8cd5760 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -17,7 +17,6 @@ services: user: "${USER_UID:-1000}:0" working_dir: /deployment entrypoint: terraform-docs markdown --recursive --recursive-path ../../modules --output-file README.md - command: environments/staging volumes: - .:/deployment diff --git a/deployment/environments/staging/README.md b/deployment/environments/staging/README.md deleted file mode 100644 index f1e770435..000000000 --- a/deployment/environments/staging/README.md +++ /dev/null @@ -1,47 +0,0 @@ - -## Requirements - -No requirements. - -## Providers - -No providers. - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [stack\_data](#module\_stack\_data) | ../../modules/stack_data | n/a | - -## Resources - -No resources. - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [airflow\_admin\_password](#input\_airflow\_admin\_password) | Password for airflow admin panel | `string` | n/a | yes | -| [api\_secret\_key](#input\_api\_secret\_key) | Secret key used for cryptographic signing by the api | `string` | n/a | yes | -| [api\_version](#input\_api\_version) | Version (e.g. sha or semver) of the api to deploy | `string` | n/a | yes | -| [datawarehouse\_admin\_password](#input\_datawarehouse\_admin\_password) | Password for the first user of the postgres datawarehouse | `string` | n/a | yes | -| [datawarehouse\_admin\_username](#input\_datawarehouse\_admin\_username) | Identifier for the first user of the postgres datawarehouse | `string` | n/a | yes | -| [datawarehouse\_di\_database](#input\_datawarehouse\_di\_database) | Identifier for the data inclusion database | `string` | n/a | yes | -| [datawarehouse\_di\_password](#input\_datawarehouse\_di\_password) | Password for the main user of the postgres datawarehouse | `string` | n/a | yes | -| [datawarehouse\_di\_username](#input\_datawarehouse\_di\_username) | Identifier for the main user of the postgres datawarehouse | `string` | n/a | yes | -| [environment](#input\_environment) | Identifier of the target environment | `string` | n/a | yes | -| [scaleway\_access\_key](#input\_scaleway\_access\_key) | Scaleway access key (https://console.scaleway.com/iam/api-keys) | `string` | n/a | yes | -| [scaleway\_project\_id](#input\_scaleway\_project\_id) | Scaleway project id (https://console.scaleway.com/project/settings) | `string` | n/a | yes | -| [scaleway\_secret\_key](#input\_scaleway\_secret\_key) | Scaleway secret key (https://console.scaleway.com/iam/api-keys) | `string` | n/a | yes | -| [ssh\_private\_key](#input\_ssh\_private\_key) | The associated public key will be deployed to the instance | `string` | n/a | yes | - -## Outputs - -| Name | Description | -|------|-------------| -| [airflow\_conn\_pg](#output\_airflow\_conn\_pg) | Connection string to the datawarehouse for airflow | -| [airflow\_conn\_s3](#output\_airflow\_conn\_s3) | Connection string to the datalake for airflow | -| [object\_storage\_access\_key](#output\_object\_storage\_access\_key) | Access key for the datalake object storage | -| [object\_storage\_secret\_key](#output\_object\_storage\_secret\_key) | Secret key for the datalake object storage | -| [public\_ip](#output\_public\_ip) | Publicly reachable IP (with `ssh root@`) | - \ No newline at end of file diff --git a/deployment/environments/staging/main.tf b/deployment/main.tf similarity index 98% rename from deployment/environments/staging/main.tf rename to deployment/main.tf index 38768ca41..ef0f66c3e 100644 --- a/deployment/environments/staging/main.tf +++ b/deployment/main.tf @@ -71,7 +71,7 @@ variable "ssh_private_key" { } module "stack_data" { - source = "../../modules/stack_data" + source = "./modules/stack_data" scaleway_access_key = var.scaleway_access_key scaleway_secret_key = var.scaleway_secret_key