Creates the AWS-side resources needed by cluster-infra-argocd and publishes config values (mostly ARNs) for later gitops consumers as codeai-cluster-config.values.yaml.
Includes:
- Dex bootstrap secrets and IAM wiring
- Kargo writeback git credentials and GitHub org webhook bootstrap
Apply ../cluster/ first.
tofu init
# admin role required because it creates IAM
AWS_PROFILE=codeorg-admin tofu applyterraform.tfvars carries bootstrap values for secrets that must first land in
AWS Secrets Manager:
dex_google_client_secretkargo_k8s_gitops_repo_usernamekargo_k8s_gitops_repo_password
Remove those values after the first successful apply. This phase also creates the GitHub organization webhook for Kargo and generates its shared secret.
- Apply
../../codeai-k8s-dex/at least once. - Apply
../cluster/first. - Review and edit
terraform.tfvars:- Follow Bootstrapping Google OAuth Client for SSO
to set
dex_*variables. - Follow Bootstrapping Kargo secrets to set
kargo_*variables.
- Follow Bootstrapping Google OAuth Client for SSO
to set
- Run
AWS_PROFILE=codeorg-admin tofu apply. - Remove
dex_google_client_secretandkargo_k8s_gitops_repo_passwordfromterraform.tfvarsbefore you forget.
If this is a new cluster, you must manually create a Google OAuth 2.0 client. Google still does not expose an API for this.
This is per-cluster because the Dex redirect URI is cluster-specific and Google does not allow wildcard redirect URIs.
- The redirect URI for the current cluster is
https://dex.k8s.code.org/callback. - Create a new Google OAuth 2.0 client:
- Open
https://console.cloud.google.com/auth/clients - Click
Create client - Choose
Web application - Name it something like
codeai-k8s-dex - Add the redirect URI above as an
Authorized redirect URI - Create the client
- Note the client secret and client id to use in the next step
- Open
- Edit
terraform.tfvars:- set
dex_google_client_idif you need to override the default - set
dex_google_client_secretto bootstrap the secret into AWS Secrets Manager ask8s/tofu/${cluster_name}/dex_google_client_secret, but do not commit this line
- set
Kargo needs two GitHub-related secrets:
- Git credentials so it can push deployment updates to
code-dot-org/k8s-gitops - A webhook secret so GitHub can send org webhooks to Kargo. Kargo does not require this, but our setup depends on it for refresh performance.
- Pick a GitHub username and create a PAT with write access to
code-dot-org/k8s-gitops - Edit
terraform.tfvars:- set
kargo_k8s_gitops_repo_username - set
kargo_k8s_gitops_repo_passwordto bootstrap the secret into AWS Secrets Manager ask8s/tofu/${cluster_name}/kargo/gitops_repo_password, but do not commit this line
- set
This phase generates the GitHub webhook secret automatically and writes it to
k8s/tofu/${cluster_name}/kargo/github_org_webhook_secret in AWS Secrets
Manager.
After bootstrap, cluster-infra-argocd syncs these into Kubernetes as:
kargo-k8s-gitopsin namespacekargo-shared-resourcesgithub-org-webhook-secretin namespacekargo-system-resources