Context
Per vedhavyas's review on PR #520, secrets like the RabbitMQ password should be managed via Infisical through common.auto.tfvars rather than generated inside the module. This aligns with the pattern used across other projects in this repo.
Candidates
1. RabbitMQ password — modules/auto-drive/broker.tf lines 1-5
Currently generated inside the module via random_password.rabbitmq_password. This should be:
- Generated once externally (or via a one-time bootstrap)
- Stored in Infisical
- Passed into the module as a variable (e.g.,
var.rabbitmq.password)
- Added to
common.auto.tfvars (managed by Infisical)
# Current (in-module generation)
resource "random_password" "rabbitmq_password" {
length = 15
special = true
override_special = "!@#$%^&*()-_=+[]{}<>:?"
}
2. RabbitMQ username — resources/terraform/auto-drive-production/variables.tf lines 13-18
Currently has a hardcoded default value ("guru") and is marked sensitive = true. Should be:
- Removed from
variables.tf default
- Stored in Infisical
- Passed via
common.auto.tfvars
# Current (hardcoded default)
variable "rabbitmq_username" {
description = "RabbitMQ username"
type = string
sensitive = true
default = "guru"
}
Tasks
⚠️ Migration note
The current random_password resource already has a value in state, so the existing broker password is stable (it doesn't regenerate on every apply). When migrating to Infisical, the current password value must be extracted from Terraform state (terraform output or terraform state show) and stored in Infisical to avoid a password rotation on the live broker.
Related
Context
Per vedhavyas's review on PR #520, secrets like the RabbitMQ password should be managed via Infisical through
common.auto.tfvarsrather than generated inside the module. This aligns with the pattern used across other projects in this repo.Candidates
1. RabbitMQ password —
modules/auto-drive/broker.tflines 1-5Currently generated inside the module via
random_password.rabbitmq_password. This should be:var.rabbitmq.password)common.auto.tfvars(managed by Infisical)2. RabbitMQ username —
resources/terraform/auto-drive-production/variables.tflines 13-18Currently has a hardcoded default value (
"guru") and is markedsensitive = true. Should be:variables.tfdefaultcommon.auto.tfvarsTasks
rabbitmq_passwordas a new field in the module'srabbitmqvariable objectrandom_password.rabbitmq_passwordresource frombroker.tfbroker.tfline 39 to usevar.rabbitmq.passwordinstead ofrandom_password.rabbitmq_password.resultrabbitmq_usernamevariablerabbitmq_usernameandrabbitmq_passwordtocommon.auto.tfvarsvia Infisicalcommon.auto.tfvars.examplewith the expected keysThe current
random_passwordresource already has a value in state, so the existing broker password is stable (it doesn't regenerate on every apply). When migrating to Infisical, the current password value must be extracted from Terraform state (terraform outputorterraform state show) and stored in Infisical to avoid a password rotation on the live broker.Related