Various updates to modernize the Terraform stack#19
Open
john-opal wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modernization notes (branch: modernize-terraform-stack)
This branch responds to a customer review that flagged this repo as badly out
of date. Summary of changes, by original comment:
RDS Postgres 15.10 (EOL May 2026) - replaced by moving to Aurora
PostgreSQL (see [OPAL-9463] Adding PR guidelines to the onprem repo #7); if you stay on plain RDS Postgres instead, bump
engine_versionto a current supported release (17.x as of mid-2026 -check https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.DBVersions.html).
k8s 1.32 (standard support ended Mar 2026, extended support only) -
variable.cluster_versiondefault bumped to 1.35. This ages fast; checkhttps://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html
before every deploy.
AWS provider 4.67 -> 6.43+ -
main.tfnow requires>= 6.43, < 7.0.This is a 2 major-version jump; review the v5 and v6 upgrade guides on the
registry for resource-level breaking changes beyond what's covered here.
EKS module 18.31.0 -> ~> 21.0 - also a multi-major jump. v21 removed
aws-auth configmap management entirely, so this branch switches cluster
auth to EKS access entries (
authentication_mode = "API",access_entriesblock ineks.tf).EKS Auto Mode - enabled via
cluster_compute_configineks.tf. Thisreplaces the hand-rolled VPC CNI / EBS CSI / AWS Load Balancer Controller
IRSA roles and Helm release, and the
eks_managed_node_group*config, allof which have been deleted.
main.tfno longer configures thekubernetes/helmproviders since nothing in this repo uses them anymore.Post-merge finding:
module.eks.node_security_group_id, whicheks.tfpreviously used for the node-to-RDS security group rule, doesnot correspond to the security group Auto Mode nodes actually use - Auto
Mode nodes attach to AWS's auto-created cluster security group instead.
This was silently broken (the rule attached to an unused SG, causing RDS
connection timeouts with no obvious error) until fixed by switching to
module.eks.cluster_primary_security_group_id. If you see connectiontimeouts to RDS from cluster workloads after a fresh apply, check this
first.
Write-only password + ephemeral Secrets Manager -
rds.tfgeneratesthe master password with an
ephemeral "random_password"resource,stores it in Secrets Manager via
secret_string_wo, and feeds it to thedatabase via
master_password_wo/master_password_wo_version. Theplaintext password is never written to state or plan files, and the old
rds_passwordsensitive output (which held the cleartext value) has beenremoved from
outputs.tfin favor ofrds_password_secret_arn.Requires Terraform >= 1.11.
Aurora PostgreSQL vs RDS Postgres -
rds.tfnow provisions anaws_rds_cluster(1 writer +var.db_reader_countreaders) instead of asingle
aws_db_instance. Aurora fails over to a reader in ~30s;RDS Postgres Multi-AZ has no automatic failover between instances.
Manual steps required after
terraform applyEKS Auto Mode provides the underlying capability for two things but does not
auto-configure them - both require a one-time manual
kubectl applyagainstthe live cluster before deploying any PVC- or Ingress-using workload (e.g.
before installing Opal via KOTS):
creates no StorageClass pointing at it. Without one, PVC-backed
workloads (KOTS's own datastore, Opal's app) hang
Pendingindefinitely.for any Ingress until these exist; AWS's own docs confirm this isn't
automatic even under Auto Mode.
Both are intentionally not managed in this Terraform: doing so requires
the
kubernetesprovider, which needs network access to the cluster'sprivate API endpoint (
endpoint_public_access = false), meaning everyfuture
apply- even ones unrelated to these two resources - would onlywork from inside the VPC. See the comment block in
main.tffor the exactmanifests and rationale.
Things that still need a human before you
terraform applyThese are suggested changes for review, not a tested migration plan.
want to destroy the
aws_db_instanceand create a newaws_rds_cluster.Plan an actual migration (snapshot restore into Aurora, or logical
dump/restore) and cut Opal over during a maintenance window.
version isn't validated against AWS provider 6.x and would likely break
planning). This also jumps several majors - diff the plan carefully.
once on the cluster's control plane and auth model. Consider sequencing
these as separate applies against a non-prod cluster first.
version) were current as of mid-2026 research for this branch - re-check
the registry/AWS docs for anything newer before applying.
Follow-ups (not urgent, tracked for later)
kubectl get pods -Astep.It documents the old self-managed node group output (
aws-node,ebs-csi-controller,ebs-csi-node,kube-proxyDaemonSets across 3nodes). With Auto Mode enabled, none of those run as visible workloads -
Auto Mode manages networking and storage internally - so the real output
is just
corednspods (2 here) and nothing else. This is expected, not abug, but the doc should be updated so it doesn't look like a failed
deployment to the next person following it.
Helm chart configures the ALB via the legacy
kubernetes.io/ingress.class: albannotation andalb.ingress.kubernetes.io/*annotations - both silently ignored/unrecognized by Auto Mode, which requires
spec.ingressClassNameplus aseparate
IngressClassParamsresource for scheme/certificate config.Workaround in use: disable Opal's "pre-packaged K8s ingress" in the KOTS
config and manage the Ingress independently (see runbook / ask John for
the manifest). Worth reporting to Opal as a packaging gap - likely
affects GKE Autopilot similarly.