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

Bug in passing certain parameter types using "azure/arm-deploy@v1" to an Azure bicep file #169

Open
gary-RR opened this issue Feb 22, 2024 · 1 comment

Comments

@gary-RR
Copy link

gary-RR commented Feb 22, 2024

I have a workflow that consists of two jobs:

Job1:

A step in the first job calls a bicep script file to create a vnet (Virtual Network). The bicep creates the vnet and a number of subnets together with vnet ID and outputs them to the caller. Here are the types and sample info that the bicep returns:

output frontendSubnet object=vnet.properties.subnets[0]
output backendSubnet object=vnet.properties.subnets[1]
output vnetId string=vnet.id

Sample frontendSubnet info
{"name":"backendSubnet","id":"/*****************************/resourceGroups/GithubWorkflowIssue/providers/Microsoft.Network/virtualNetworks/vnet-cosmo-epvypfxupyhic/subnets/backendSubnet","etag":"W/"40085f0c-f1c4-4bd2-93a5-d9ddf8f40834"","properties":{"provisioningState":"Succeeded","addressPrefix":"10.0.1.0/24","delegations":[],"privateEndpointNetworkPolicies":"Disabled","privateLinkServiceNetworkPolicies":"Enabled"},"type":"Microsoft.Network/virtualNetworks/subnets"}

Sample vnetId
/subscriptions/*************/resourceGroups/GithubWorkflowIssue/providers/Microsoft.Network/virtualNetworks/vnet-cosmo-epvypfxupyhic

Job 2:

The outputs from the step in job 1 are used to call another bicep script:

  • uses: azure/arm-deploy@v1
    name: Run preflight validation
    with:
    deploymentName: ${{ github.run_number }}
    resourceGroupName: ${{ inputs.resourceGroupName }}
    template: ./deploy/azure_sql_private_endpoint.bicep
    parameters: >
    vnetId=${{ needs.deploy-vnet.outputs.vnetId }}
    frontendSubnet=${{ needs.deploy-vnet.outputs.frontendSubnet }}
    backendSubnet=${{ needs.deploy-vnet.outputs.backendSubnet }}

The issue is that the deploy step does not dispatch those parameters correctly and Azure ARM cannot interpret them and throws errors as shown below. It looks like it has trouble with "object" types and multiple "/" in strings. I have created a simplified version of the situation here where you can experiment for yourself, just make sure to change the "resourceGroupName" in "workflow.yaml" and also set up your Azure application and Githup to Azure federated credentials:
https://github.com/gary-RR/github_workflow_issues

Errors in Azure deployment logs
Run azure/arm-deploy@v1
with:
deploymentName: 6
resourceGroupName: GithubWorkflowIssue
template: ./deploy/azure_sql_private_endpoint.bicep
parameters: vnetId= frontendSubnet= backendSubnet=

Validating template...
Warning: ERROR: Failed to parse string as JSON:

Error detail: Expecting value: line 1 column 1 (char 0)

Warning: Template validation failed.
Creating deployment...
Error: ERROR: Failed to parse string as JSON:

Error detail: Expecting value: line 1 column 1 (char 0)

@gary-RR
Copy link
Author

gary-RR commented Feb 24, 2024

Are these issues actually and actively being looked at? This is a serious issue and a show-stopper for us. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant