8000 📦Adding acm-member-portal deployment by clee231 · Pull Request #158 · acm-uic/IaC · GitHub
[go: up one dir, main page]

Skip to content

📦Adding acm-member-portal deployment - #158

Merged
clee231 merged 9 commits into
mainfrom
feature/acm-member-portal
Sep 29, 2026
Merged

clee231 merged 9 commits into
mainfrom
feature/acm-member-portal

Conversation

@clee231
@clee231 clee231 commented Sep 1, 2026
Copy link
Copy Markdown
Contributor

Adding the acm-member-portal deployment. This is an Azure and Kubernetes deployment via Terraform.

This will require both access to Azure via a managed-identity and also on-prem access to deploy the Kubernetes secret.

This will likely not work until the on-prem runners are active again.

@clee231 clee231 self-assigned this Sep 1, 2026
@clee231 clee231 added ☁️ Azure Microsoft Azure related work ☸️ k8s Kubernetes related stuff 🏗️ Terraform Terraform related work 🚧 Actions labels Sep 1, 2026
special = false
}

resource "kubernetes_secret_v1" "portal" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README calls this out, but I think we should just fix it instead of documenting it. kubernetes_secret_v1 owns the whole portal-secrets object, so the SMTP/Discord/Windows keys added by hand get wiped on every apply and every rotation.
▎
▎ Easy fix is kubernetes_secret_v1_data with force = true. It only manages the keys declared here and leaves the rest alone (we're on provider 2.38 so it's available). Then the "re-add them after apply" paragraph in the README can go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see nothing wrong with any changes made by hand getting overridden. In the spirit of Infrastructure as code, the state of the infrastructure should be defined... well... in code, so anything done to cause the infrastructure to drift should be reconciled by the IaC deployments.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, but then the README shouldnt tell people to add the SMTP/Discord/Windows keys to that secret by hand. either pull them into terraform too (sensitive vars or a key vault data source) or give them their own secret the chart also mounts. right now the doc is describing drift on purpose

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️Oh, good point. I get what you mean now.
Fixed in 3d09040. I took your suggestion and just added force = true and updated the README.

I think later on, the other secrets will be pulled from Vault and populated in the secret. (That won't be part of this PR though. 😉)

}
}

resource "time_rotating" "rotation" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, what happens to the running pods when the 180 day rotation fires? The password gets replaced (destroy then create) and the Secret updates, but the pods keep the old env value until they restart. The old password is gone at that point so Microsoft login would break until someone does a rollout.
▎
▎ Either create_before_destroy = true on the password so both are valid during the swap, or a Reloader / checksum annotation on the deployment so it picks up Secret changes. Probably worth a line in the README either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you an AI bot? 😮

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im hurt Chase

@clee231 clee231 Sep 1, 2026 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just doesn't seem like something you'd write, so I was confused. 🤔

But anyways, after the 180 days, the password will get rotated after the 180 day rotation occurs. The expectation is the operator will handle the credential switchover pretty shortly after the run, so we don't really need to have both passwords valid at a time.
Eventually, we'll get this automated, so we will soon™️be able to have a closed loop with no human intervention.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:( thats how i write though

@github-actions
github-actions Bot commented Sep 29, 2026 •
Copy link
Copy Markdown

Terraform plan in kubernetes/terraform/stacks/acm-member-portal in the prod workspace
With var files: kubernetes/terraform/stacks/acm-member-portal/configuration/prod.tfvars

Plan: 7 to add, 0 to change, 0 to destroy. Changes to Outputs.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+   create

Terraform will perform the following actions:

  # azuread_application.portal will be created
+   resource "azuread_application" "portal" {
+       app_role_ids                = (known after apply)
+       client_id                   = (known after apply)
+       disabled_by_microsoft       = (known after apply)
+       display_name                = "acm-member-portal-prod"
+       id                          = (known after apply)
+       logo_url                    = (known after apply)
+       oauth2_permission_scope_ids = (known after apply)
+       object_id                   = (known after apply)
+       owners                      = [
+           "21ec2c63-534d-4cfb-bc43-83773ce40e54",
+           "920bf583-cb9b-4365-a61e-bb33988c5484",
        ]
+       prevent_duplicate_names     = false
+       publisher_domain            = (known after apply)
+       sign_in_audience            = "AzureADMyOrg"
+       tags                        = (known after apply)
+       template_id                 = (known after apply)

+       feature_tags (known after apply)

+       optional_claims {
+           id_token {
+               essential = false
+               name      = "email"
            }
+           id_token {
+               essential = false
+               name      = "upn"
            }
+           id_token {
+               additional_properties = [
+                   "sam_account_name",
                ]
+               essential             = false
+               name                  = "groups"
            }
        }

+       required_resource_access {
+           resource_app_id = "************************************"

+           resource_access {
+               id   = "37f7f235-527c-4136-accd-4f02faf2b745"
+               type = "Scope"
            }
+           resource_access {
+               id   = "64a6cdd6-4a97-4e60-a3e8-d57ef873a778"
+               type = "Scope"
            }
        }

+       web {
+           logout_url    = "https://portal.acmuic.org"
+           redirect_uris = [
+               "https://portal.acmuic.org/api/auth/callback/microsoft",
            ]
        }
    }

  # azuread_application_password.portal will be created
+   resource "azuread_application_password" "portal" {
+       application_id      = (known after apply)
+       display_name        = "portal-prod"
+       end_date            = (known after apply)
+       id                  = (known after apply)
+       key_id              = (known after apply)
+       rotate_when_changed = (known after apply)
+       start_date          = (known after apply)
+       value               = (sensitive value)
    }

  # azuread_service_principal.portal will be created
+   resource "azuread_service_principal" "portal" {
+       account_enabled             = true
+       app_role_ids                = (known after apply)
+       app_roles                   = (known after apply)
+       application_tenant_id       = (known after apply)
+       client_id                   = (known after apply)
+       display_name                = (known after apply)
+       homepage_url                = (known after apply)
+       id                          = (known after apply)
+       logout_url                  = (known after apply)
+       oauth2_permission_scope_ids = (known after apply)
+       oauth2_permission_scopes    = (known after apply)
+       object_id                   = (known after apply)
+       owners                      = [
+           "21ec2c63-534d-4cfb-bc43-83773ce40e54",
+           "920bf583-cb9b-4365-a61e-bb33988c5484",
        ]
+       redirect_uris               = (known after apply)
+       saml_metadata_url           = (known after apply)
+       service_principal_names     = (known after apply)
+       sign_in_audience            = (known after apply)
+       tags                        = (known after apply)
+       type                        = (known after apply)
+       use_existing                = true

+       feature_tags (known after apply)

+       features (known after apply)
    }

  # kubernetes_secret_v1.portal will be created
+   resource "kubernetes_secret_v1" "portal" {
+       data                           = (sensitive value)
+       id                             = (known after apply)
+       type                           = "Opaque"
+       wait_for_service_account_token = true

+       metadata {
+           generation       = (known after apply)
+           name             = "portal-secrets"
+           namespace        = "acm-portal"
+           resource_version = (known after apply)
+           uid              = (known after apply)
        }
    }

  # kubernetes_secret_v1_data.portal will be created
+   resource "kubernetes_secret_v1_data" "portal" {
+       data          = (known after apply)
+       field_manager = "terraform-acm-member-portal"
+       force         = true
+       id            = (known after apply)

+       metadata {
+           name      = "portal-secrets"
+           namespace = "acm-portal"
        }
    }

  # random_password.auth will be created
+   resource "random_password" "auth" {
+       bcrypt_hash = (sensitive value)
+       id          = (known after apply)
+       length      = 48
+       lower       = true
+       min_lower   = 0
+       min_numeric = 0
+       min_special = 0
+       min_upper   = 0
+       number      = true
+       numeric     = true
+       result      = (sensitive value)
+       special     = false
+       upper       = true
    }

  # time_rotating.rotation will be created
+   resource "time_rotating" "rotation" {
+       day              = (known after apply)
+       hour             = (known after apply)
+       id               = (known after apply)
+       minute           = (known after apply)
+       month            = (known after apply)
+       rfc3339          = (known after apply)
+       rotation_days    = 180
+       rotation_rfc3339 = (known after apply)
+       second           = (known after apply)
+       unix             = (known after apply)
+       year             = (known after apply)
    }

Plan: 7 to add, 0 to change, 0 to destroy.

Changes to Outputs:
+   application_id              = (known after apply)
+   client_id                   = (known after apply)
+   secret_name                 = "portal-secrets"
+   service_principal_object_id = (known after apply)

❌ Error applying plan in Terraform Apply on Kubernetes #1

@clee231
clee231 marked this pull request as ready for review September 29, 2026 04:05
@clee231
clee231 merged commit c21a295 into main Sep 29, 2026
1 check passed
@clee231
clee231 deleted the feature/acm-member-portal branch September 29, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏗️ Terraform Terraform related work ☁️ Azure Microsoft Azure related work 🚧 Actions ☸️ k8s Kubernetes related stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0