From 8a1a5e902df1aec8050074e182c22613a81aaa87 Mon Sep 17 00:00:00 2001 From: Michael Barroco Date: Fri, 12 Apr 2024 18:25:13 +0200 Subject: [PATCH] [terraform] Rename generated files to ease reviews (#1019) * [terraform] Rename generated files to ease reviews * Update links --- .../dependencies/terraform-aws-kubernetes/README.md | 2 +- .../{variables.tf => variables.gen.tf} | 0 .../dependencies/terraform-commons-dss/README.md | 2 +- .../{variables.tf => variables.gen.tf} | 0 .../dependencies/terraform-google-kubernetes/README.md | 2 +- .../{variables.tf => variables.gen.tf} | 0 deploy/infrastructure/modules/terraform-aws-dss/README.md | 8 ++++---- .../terraform-aws-dss/{TFVARS.md => TFVARS.gen.md} | 0 .../terraform-aws-dss/{variables.tf => variables.gen.tf} | 0 .../infrastructure/modules/terraform-google-dss/README.md | 6 +++--- .../terraform-google-dss/{TFVARS.md => TFVARS.gen.md} | 0 .../{variables.tf => variables.gen.tf} | 0 deploy/infrastructure/utils/README.md | 2 +- deploy/infrastructure/utils/variables.py | 4 ++-- .../ci/aws-1/{variables.tf => variables.gen.tf} | 0 15 files changed, 13 insertions(+), 13 deletions(-) rename deploy/infrastructure/dependencies/terraform-aws-kubernetes/{variables.tf => variables.gen.tf} (100%) rename deploy/infrastructure/dependencies/terraform-commons-dss/{variables.tf => variables.gen.tf} (100%) rename deploy/infrastructure/dependencies/terraform-google-kubernetes/{variables.tf => variables.gen.tf} (100%) rename deploy/infrastructure/modules/terraform-aws-dss/{TFVARS.md => TFVARS.gen.md} (100%) rename deploy/infrastructure/modules/terraform-aws-dss/{variables.tf => variables.gen.tf} (100%) rename deploy/infrastructure/modules/terraform-google-dss/{TFVARS.md => TFVARS.gen.md} (100%) rename deploy/infrastructure/modules/terraform-google-dss/{variables.tf => variables.gen.tf} (100%) rename deploy/operations/ci/aws-1/{variables.tf => variables.gen.tf} (100%) diff --git a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/README.md b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/README.md index 7f270a8ea..aec8d2a21 100644 --- a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/README.md +++ b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/README.md @@ -7,7 +7,7 @@ Kubernetes in AWS. ## Configuration -See [variables.tf](variables.tf). +See [variables.gen.tf](variables.gen.tf). ## Design diff --git a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/variables.tf b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/variables.gen.tf similarity index 100% rename from deploy/infrastructure/dependencies/terraform-aws-kubernetes/variables.tf rename to deploy/infrastructure/dependencies/terraform-aws-kubernetes/variables.gen.tf diff --git a/deploy/infrastructure/dependencies/terraform-commons-dss/README.md b/deploy/infrastructure/dependencies/terraform-commons-dss/README.md index ca0589ee5..c10eabdd9 100644 --- a/deploy/infrastructure/dependencies/terraform-commons-dss/README.md +++ b/deploy/infrastructure/dependencies/terraform-commons-dss/README.md @@ -8,4 +8,4 @@ and operate the cluster. ## Configuration -See [variables.tf](variables.tf). +See [variables.gen.tf](variables.gen.tf). diff --git a/deploy/infrastructure/dependencies/terraform-commons-dss/variables.tf b/deploy/infrastructure/dependencies/terraform-commons-dss/variables.gen.tf similarity index 100% rename from deploy/infrastructure/dependencies/terraform-commons-dss/variables.tf rename to deploy/infrastructure/dependencies/terraform-commons-dss/variables.gen.tf diff --git a/deploy/infrastructure/dependencies/terraform-google-kubernetes/README.md b/deploy/infrastructure/dependencies/terraform-google-kubernetes/README.md index fbcc655ce..fd4e86fe1 100644 --- a/deploy/infrastructure/dependencies/terraform-google-kubernetes/README.md +++ b/deploy/infrastructure/dependencies/terraform-google-kubernetes/README.md @@ -6,4 +6,4 @@ This folder only contains the terraform module which deploys the kubernetes clus ## Configuration -See [variables.tf](variables.tf). +See [variables.gen.tf](variables.gen.tf). diff --git a/deploy/infrastructure/dependencies/terraform-google-kubernetes/variables.tf b/deploy/infrastructure/dependencies/terraform-google-kubernetes/variables.gen.tf similarity index 100% rename from deploy/infrastructure/dependencies/terraform-google-kubernetes/variables.tf rename to deploy/infrastructure/dependencies/terraform-google-kubernetes/variables.gen.tf diff --git a/deploy/infrastructure/modules/terraform-aws-dss/README.md b/deploy/infrastructure/modules/terraform-aws-dss/README.md index f151b9f9f..9d91288bd 100644 --- a/deploy/infrastructure/modules/terraform-aws-dss/README.md +++ b/deploy/infrastructure/modules/terraform-aws-dss/README.md @@ -30,14 +30,14 @@ Download & install the following tools to your workstation: ### Deployment of the Kubernetes cluster 1. Create a new folder in `/deploy/infrastructure/personal/` named, for instance, `terraform-aws-dss-dev`. -2. Copy main.tf, output.tf and variables.tf to the new folder. +2. Copy main.tf, output.tf and variables.gen.tf to the new folder. 3. Copy `terraform.dev.example.tfvars` and rename to `terraform.tfvars` 4. Check that your new directory contains the following files: - main.tf - output.tf - terraform.tfvars - - variables.tf -5. Set the variables in `terraform.tfvars` according to your environment. See [TFVARS.md](TFVARS.md) for variables descriptions. + - variables.gen.tf +5. Set the variables in `terraform.tfvars` according to your environment. See [TFVARS.gen.md](TFVARS.gen.md) for variables descriptions. 6. In the new directory (ie /deploy/infrastructure/personal/terraform-aws-dss-dev), initialize terraform: `terraform init`. 7. Run `terraform plan` to check that the configuration is valid. It will display the resources which will be provisioned. 8. Run `terraform apply` to deploy the cluster. (This operation may take up to 15 min.) @@ -70,4 +70,4 @@ It contains scripts to operate the cluster and setup the services. 2. To delete all resources, run `tk delete .` in the workspace folder. 3. Make sure that all [load balancers](https://eu-west-1.console.aws.amazon.com/ec2/home#LoadBalancers:) and [target groups](https://eu-west-1.console.aws.amazon.com/ec2/home#TargetGroups:) have been deleted from the AWS region before next step. 4. `terraform destroy` in your infrastructure folder. -5. On the [EBS page](https://eu-west-1.console.aws.amazon.com/ec2/home#Volumes:), make sure to manually clean up the persistent storage. Note that the correct AWS region shall be selected. \ No newline at end of file +5. On the [EBS page](https://eu-west-1.console.aws.amazon.com/ec2/home#Volumes:), make sure to manually clean up the persistent storage. Note that the correct AWS region shall be selected. diff --git a/deploy/infrastructure/modules/terraform-aws-dss/TFVARS.md b/deploy/infrastructure/modules/terraform-aws-dss/TFVARS.gen.md similarity index 100% rename from deploy/infrastructure/modules/terraform-aws-dss/TFVARS.md rename to deploy/infrastructure/modules/terraform-aws-dss/TFVARS.gen.md diff --git a/deploy/infrastructure/modules/terraform-aws-dss/variables.tf b/deploy/infrastructure/modules/terraform-aws-dss/variables.gen.tf similarity index 100% rename from deploy/infrastructure/modules/terraform-aws-dss/variables.tf rename to deploy/infrastructure/modules/terraform-aws-dss/variables.gen.tf diff --git a/deploy/infrastructure/modules/terraform-google-dss/README.md b/deploy/infrastructure/modules/terraform-google-dss/README.md index ab1ea2f4b..62b6c6dbc 100644 --- a/deploy/infrastructure/modules/terraform-google-dss/README.md +++ b/deploy/infrastructure/modules/terraform-google-dss/README.md @@ -30,14 +30,14 @@ Download & install the following tools to your workstation: ### Deployment of the Kubernetes cluster 1. Create a new folder in `/deploy/infrastructure/personal/` named for instance `terraform-google-dss-dev`. -2. Copy main.tf, output.tf and variables.tf to the new folder. (Note that the modules can be added to existing projects) +2. Copy main.tf, output.tf and variables.gen.tf to the new folder. (Note that the modules can be added to existing projects) 3. Copy `terraform.dev.example.tfvars` and rename to `terraform.tfvars` 4. Check that your new directory contains the following files: - main.tf - output.tf - terraform.tfvars - - variables.tf -5. Set the variables in `terraform.tfvars` according to your environment. See [TFVARS.md](TFVARS.md) for variables descriptions. + - variables.gen.tf +5. Set the variables in `terraform.tfvars` according to your environment. See [TFVARS.gen.md](TFVARS.gen.md) for variables descriptions. 6. In the new directory (ie /deploy/infrastructure/personal/terraform-google-dss-dev), initialize terraform: `terraform init`. 7. Run `terraform plan` to check that the configuration is valid. It will display the resources which will be provisioned. 8. Run `terraform apply` to deploy the cluster. (This operation may take up to 15 min.) diff --git a/deploy/infrastructure/modules/terraform-google-dss/TFVARS.md b/deploy/infrastructure/modules/terraform-google-dss/TFVARS.gen.md similarity index 100% rename from deploy/infrastructure/modules/terraform-google-dss/TFVARS.md rename to deploy/infrastructure/modules/terraform-google-dss/TFVARS.gen.md diff --git a/deploy/infrastructure/modules/terraform-google-dss/variables.tf b/deploy/infrastructure/modules/terraform-google-dss/variables.gen.tf similarity index 100% rename from deploy/infrastructure/modules/terraform-google-dss/variables.tf rename to deploy/infrastructure/modules/terraform-google-dss/variables.gen.tf diff --git a/deploy/infrastructure/utils/README.md b/deploy/infrastructure/utils/README.md index 013fe8afd..e5bb35b32 100644 --- a/deploy/infrastructure/utils/README.md +++ b/deploy/infrastructure/utils/README.md @@ -5,5 +5,5 @@ This directory contains the following tools to simplify the management of the te ## `generate_terraform_variables.sh` Terraform variables can't be shared between modules without repeating their definition at every level of encapsulation. To prevent repeating ourselves and to maintain a consistent level of quality for every module and dependencies, this script takes variables -in the `definitions` directory and creates a `variables.tf` file in each modules with the appropriate content. +in the `definitions` directory and creates a `variables.gen.tf` file in each modules with the appropriate content. Assignment of `definitions` files to modules is made in `variables.py`. diff --git a/deploy/infrastructure/utils/variables.py b/deploy/infrastructure/utils/variables.py index e91d72769..2d2e794dd 100755 --- a/deploy/infrastructure/utils/variables.py +++ b/deploy/infrastructure/utils/variables.py @@ -10,8 +10,8 @@ import hcl2 DEFINITIONS_PATH = join(abspath(dirname(__file__)), "definitions") -GENERATED_TFVARS_MD_FILENAME = "TFVARS.md" -GENERATED_VARIABLES_FILENAME = "variables.tf" +GENERATED_TFVARS_MD_FILENAME = "TFVARS.gen.md" +GENERATED_VARIABLES_FILENAME = "variables.gen.tf" INTERNAL_VARIABLES_FILENAME = "variables_internal.tf" GENERATED_COMMENT = """ # This file has been automatically generated by /deploy/infrastructure/utils/generate_terraform_variables.py. diff --git a/deploy/operations/ci/aws-1/variables.tf b/deploy/operations/ci/aws-1/variables.gen.tf similarity index 100% rename from deploy/operations/ci/aws-1/variables.tf rename to deploy/operations/ci/aws-1/variables.gen.tf