Page MenuHomePhabricator

[terraform] Replace all config options with terraform variables and remove sops
ClosedPublic

Authored by will on Wed, Jun 5, 5:06 PM.
Tags
None
Referenced Files
F2161815: D12324.id41078.diff
Mon, Jul 1, 12:49 PM
Unknown Object (File)
Thu, Jun 27, 5:58 AM
Unknown Object (File)
Tue, Jun 25, 1:35 AM
Unknown Object (File)
Sat, Jun 22, 4:39 PM
Unknown Object (File)
Thu, Jun 20, 5:26 AM
Unknown Object (File)
Wed, Jun 19, 12:47 PM
Unknown Object (File)
Wed, Jun 19, 6:33 AM
Unknown Object (File)
Sun, Jun 16, 10:59 PM
Subscribers

Details

Summary

Bartek pointed out that SOPS was overkill for self-hosting. Additionally, several configuration options required the user to make terraform changes.

In this diff, I introduce the usage of terraform variables to

  1. configure mariadb username/password that was previously configured through sops
  2. configure the aws region, subnets, and user ip

Depends on D12323

Test Plan

terraform apply and successfully connected mysql client to rds endpoint

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will retitled this revision from [terraform] Replace all config options with .tfvars and remove sops to [terraform] Replace all config options with terraform variables and remove sops.Wed, Jun 5, 5:07 PM
will added inline comments.
services/terraform/self-host/aws_vpc.tf
9 ↗(On Diff #41000)

Changed to numbers to avoid possible confusion with the letters used by availability zones

will requested review of this revision.Wed, Jun 5, 5:23 PM
will edited the summary of this revision. (Show Details)EditedWed, Jun 5, 5:49 PM

Was thinking similar to the dev folder, we can create a simple run.sh script with:

terraform init

terraform apply -var-file="secrets.tfvars"
services/terraform/self-host/aws_vpc.tf
33 ↗(On Diff #41000)

32 as the mask means the block resolves to a single exact ip address

Two comments here:

  • When using one of "default" filenames (I recall terraform.tfvars), you don't have to use the -var-file="secrets.tfvars" arg
  • It's a good practice to commit terraform.tfvars.example (while gitignoring actual terraform.tfvars) with example variables (usually required ones, that don't have defaults in variables.tf). This file can be copied and renamed by individual users.

What do you think?

I like @bartek's suggestions. I'm probably a bad reviewer for Terraform stuff since I'm not familiar

Two comments here:

  • When using one of "default" filenames (I recall terraform.tfvars), you don't have to use the -var-file="secrets.tfvars" arg
  • It's a good practice to commit terraform.tfvars.example (while gitignoring actual terraform.tfvars) with example variables (usually required ones, that don't have defaults in variables.tf). This file can be copied and renamed by individual users.

What do you think?

Really good ideas. Adding to new next rebase and modified the notion doc to use terraform.tfvars
https://www.notion.so/commapp/Moving-local-Keyserver-MariaDB-data-to-a-Self-hosted-AWS-RDS-instance-ed4fd1b02f944e3ab1ea074c65f553f3

This revision is now accepted and ready to land.Thu, Jun 6, 12:02 PM

to be removed but zones should be included in the terraform variables for this diff