Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: terraform source control block #2160

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Jun 12, 2024

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 github-actions bot added the infrastructure Terraform, Azure, etc. label Jun 12, 2024
Copy link

github-actions bot commented Jun 12, 2024

Coverage report

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

@thekaveman thekaveman self-assigned this Jun 12, 2024
@thekaveman thekaveman linked an issue Jun 12, 2024 that may be closed by this pull request
@thekaveman thekaveman force-pushed the fix/terraform-source-control branch from 4de1dcc to d71e3b1 Compare June 12, 2024 21:49
@thekaveman thekaveman marked this pull request as ready for review June 12, 2024 21:53
@thekaveman thekaveman requested a review from a team as a code owner June 12, 2024 21:53
@thekaveman thekaveman marked this pull request as draft June 12, 2024 21:55
we don't want Azure continuous deployment / webhooks
it seems like Deployment Center is stuck with pending changes
@thekaveman thekaveman force-pushed the fix/terraform-source-control branch from d71e3b1 to f7951f7 Compare June 12, 2024 22:10
@thekaveman thekaveman marked this pull request as ready for review June 12, 2024 22:20
@thekaveman
Copy link
Member Author

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.

app_id = azurerm_linux_web_app.main.id
repo_url = "https://github.com/cal-itp/benefits"
branch = local.env_name
use_manual_integration = true
Copy link
Member

Choose a reason for hiding this comment

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

Hopefully this was the missing piece

@thekaveman
Copy link
Member Author

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

@thekaveman thekaveman merged commit 61645c9 into dev Jun 13, 2024
10 checks passed
@thekaveman thekaveman deleted the fix/terraform-source-control branch June 13, 2024 17:29
@thekaveman
Copy link
Member Author

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

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Terraform, Azure, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Terraform config for new deployment setup
2 participants