cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
25 stars 9 forks source link

Fix: terraform source control block #2160

Closed thekaveman closed 3 weeks ago

thekaveman commented 3 weeks ago

After deleting all of the Azure Webhooks in this git repo, we saw one show up for the dev app:

image

(I disabled this webhook for working on this PR, we should delete it before merging to ensure Azure doesn't re-create).

It seems like this was created because the Azure Deployment Center settings didn't take for GitHub Actions with the old Container Registry still being selected with unsaved pending state.

image

Now that we know the Terraform state is aligned, this PR introduces some changes to hopefully get the UI where we want.

github-actions[bot] commented 3 weeks ago

Coverage report

This PR does not seem to contain any modification to coverable code.

thekaveman commented 3 weeks ago

terraform plan

From the Azure pipeline run, none of this is really a surprise since changing some of these settings causes the whole block to be recreated:

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # azurerm_app_service_source_control.main must be replaced
-/+ resource "azurerm_app_service_source_control" "main" {
      ~ id                     = "/subscriptions/xxx/resourceGroups/RG-CDT-PUB-VIP-CALITP-D-001/providers/Microsoft.Web/sites/AS-CDT-PUB-VIP-CALITP-D-001" -> (known after apply)
      ~ scm_type               = "GitHub" -> (known after apply)
      ~ use_manual_integration = false -> true # forces replacement
      ~ uses_github_action     = false -> (known after apply)
        # (6 unchanged attributes hidden)

      + github_action_configuration { # forces replacement
          + generate_workflow_file = false # forces replacement
          + linux_action           = (known after apply)

          + container_configuration {
              + image_name   = "cal-itp/benefits" # forces replacement
              + registry_url = "https://ghcr.io/" # forces replacement
            }
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.
thekaveman commented 3 weeks ago

I just deleted the webhook shown above, and I'm going to merge. :crossed_fingers: that the webhook is not created and this change is reflected correctly in the Azure UI.

thekaveman commented 3 weeks ago

The apply failed, apparently these options don't work together :roll_eyes:

creating Source Control configuration for Web App: (Site Name
│ "AS-CDT-PUB-VIP-CALITP-D-001" / Resource Group
│ "RG-CDT-PUB-VIP-CALITP-D-001"): web.AppsClient#UpdateSourceControl: Failure
│ responding to request: StatusCode=400 -- Original Error: autorest/azure:
│ Service returned an error. Status=400 Code="BadRequest" Message="Operation
│ not supported: ManualIntegration does not support GitHubAction."