Skip to content

Commit

Permalink
add retry for az login in e2e action, add tags for azurerm_resource_g…
Browse files Browse the repository at this point in the history
…roup_template_deployment so we can pass tflint check
  • Loading branch information
lonegunmanb committed Mar 22, 2024
1 parent 1d4556c commit 3ba8e44
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ jobs:
shell: bash
run: |
set -e
az login --identity --username $MSI_ID > /dev/null
MAX_RETRIES=10
RETRY_COUNT=0
until [ $RETRY_COUNT -ge $MAX_RETRIES ]
do
az login --identity --username $MSI_ID > /dev/null && break
RETRY_COUNT=$[$RETRY_COUNT+1]
sleep 10
done
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
echo "Failed to login after $MAX_RETRIES attempts."
exit 1
fi
export ARM_SUBSCRIPTION_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .id')
export ARM_TENANT_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .tenantId')
export ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId')
Expand Down
1 change: 1 addition & 0 deletions main.telemetry.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ resource "azurerm_resource_group_template_deployment" "telemetry" {
deployment_mode = "Incremental"
name = local.telem_arm_deployment_name
resource_group_name = var.resource_group_name
tags = var.resource_group_template_deployment_tags
template_content = local.telem_arm_template_content
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ A map of private endpoints to create on this resource. The map key is deliberate
DESCRIPTION
}

variable "resource_group_template_deployment_tags" {
type = map(string)
default = null
description = "(Optional) A mapping of tags which should be assigned to the Resource Group Template Deployment."
}

variable "role_assignments" {
type = map(object({
role_definition_id_or_name = string
Expand Down

0 comments on commit 3ba8e44

Please sign in to comment.