Skip to content

Commit

Permalink
chore: Cleanup deprecated parameter usage for Terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Aug 2, 2024
1 parent 0e737b5 commit a66cd0c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions infra/github-actions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "azuread_application" "deploy-production" {
}

resource "azuread_service_principal" "deploy-production" {
application_id = azuread_application.deploy-production.application_id
client_id = azuread_application.deploy-production.client_id
app_role_assignment_required = false
owners = [
data.azuread_client_config.current.object_id,
Expand All @@ -22,38 +22,38 @@ resource "azuread_application" "deploy-staging" {
}

resource "azuread_service_principal" "deploy-staging" {
application_id = azuread_application.deploy-staging.application_id
client_id = azuread_application.deploy-staging.client_id
app_role_assignment_required = false
owners = [
data.azuread_client_config.current.object_id,
]
}

resource "azuread_application_federated_identity_credential" "production" {
application_object_id = azuread_application.deploy-production.object_id
display_name = "Environment"
description = "Allows deployments from GitHub Actions to the 'Production' environment."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:environment:${var.production-environment}"
application_id = azuread_application.deploy-production.object_id
display_name = "Environment"
description = "Allows deployments from GitHub Actions to the 'Production' environment."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:environment:${var.production-environment}"
}

resource "azuread_application_federated_identity_credential" "staging" {
application_object_id = azuread_application.deploy-staging.object_id
display_name = "Environment"
description = "Allows deployments from GitHub Actions to the 'Staging' environment."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:environment:${var.staging-environment}"
application_id = azuread_application.deploy-staging.object_id
display_name = "Environment"
description = "Allows deployments from GitHub Actions to the 'Staging' environment."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:environment:${var.staging-environment}"
}

resource "azuread_application_federated_identity_credential" "prs" {
application_object_id = azuread_application.deploy-staging.object_id
display_name = "PRs"
description = "Allows deployments from GitHub Actions for pull requests."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:pull_request"
application_id = azuread_application.deploy-staging.object_id
display_name = "PRs"
description = "Allows deployments from GitHub Actions for pull requests."
audiences = ["api://AzureADTokenExchange"]
issuer = "https://token.actions.githubusercontent.com"
subject = "repo:${var.repository}:pull_request"
}

resource "azurerm_role_assignment" "deploy-production" {
Expand All @@ -72,14 +72,14 @@ output "deploy-production" {
value = {
tenant_id = data.azuread_client_config.current.tenant_id
subscription_id = data.azurerm_subscription.current.subscription_id
client_id = azuread_application.deploy-production.application_id
client_id = azuread_application.deploy-production.client_id
}
}

output "deploy-staging" {
value = {
tenant_id = data.azuread_client_config.current.tenant_id
subscription_id = data.azurerm_subscription.current.subscription_id
client_id = azuread_application.deploy-staging.application_id
client_id = azuread_application.deploy-staging.client_id
}
}

0 comments on commit a66cd0c

Please sign in to comment.