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

BadRequest error when setting property to empty string, but setting it to null gives BCP036 in VS Code #2111

Open
doubleyouvdb opened this issue Sep 13, 2021 · 2 comments

Comments

@doubleyouvdb
Copy link

doubleyouvdb commented Sep 13, 2021

Bicep version
0.4.63

Describe the bug
Property needs to be set on 'null' instead of empty string '', otherwise the pipeline crashes with a BadRequest error. At the same time, setting it to 'null' gives a warning in Vistual Studio Code:
The property "logAnalyticsWorkspaceResourceID" expected a value of type "string" but the provided value is of type "null | string".bicep(BCP036)

Relevant code:

resource aksClusterRes 'Microsoft.ContainerService/managedClusters@2020-09-01' = {
   name: aksCluster.name
  location: resourceGroup().location
  tags: tags
  sku: {
    name: 'Basic'
    tier: aksCluster.sla
  }
  properties: {
    kubernetesVersion: aksCluster.kubernetesVersion
    addonProfiles: {
      omsAgent: {
        enabled: aksCluster.logAnalyticsWorkspace.enableContainerMonitoring
        config: {
          //needs to be set to null, not '', otherwise badRequest error:
          logAnalyticsWorkspaceResourceID: aksCluster.logAnalyticsWorkspace.enableContainerMonitoring ? logAnalyticsWorkspace.id : null
        }
      }
      ingressApplicationGateway: {
        enabled: !empty(aksCluster.network.ingressApplicationGateway.name)
        config: {
          //needs to be set to null, not '', otherwise badRequest error:
          applicationGatewayId: !empty(aksCluster.network.ingressApplicationGateway.name) ? ingressApplicationGateway.id : null
        }
      }
    }
    agentPoolProfiles: [
      agentPoolProfiles[0]
    ]
  }
}

To Reproduce
Replace both the 'null'-s in code above to '' and pipeline crashes with BadRequest error.

Additional context
Add any other context about the problem here.

@ghost ghost added the Needs: Triage 🔍 label Sep 13, 2021
@slavizh
Copy link

slavizh commented Sep 13, 2021

+1

@alex-frankel alex-frankel added bug Something isn't working and removed Needs: Triage 🔍 labels Sep 15, 2021
@anthony-c-martin anthony-c-martin transferred this issue from Azure/bicep Mar 28, 2024
@anthony-c-martin anthony-c-martin added Service Attention Container Service and removed bug Something isn't working labels Mar 28, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @qike-ms, @jwilder, @thomas1206, @seanmck. Please see https://aka.ms/biceptypesinfo for troubleshooting help.

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

No branches or pull requests

4 participants