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

Nullable parameters for custom types #2489

Closed
BernieWhite opened this issue Oct 17, 2023 · 0 comments · Fixed by #2516
Closed

Nullable parameters for custom types #2489

BernieWhite opened this issue Oct 17, 2023 · 0 comments · Fixed by #2516
Assignees
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Milestone

Comments

@BernieWhite
Copy link
Collaborator

BernieWhite commented Oct 17, 2023

Existing rule

No response

Description of the issue

Similar to #2488 this issue occurs for custom types.

When nullable parameters are defined in a module and the consuming module does not pass through a value (resulting in a null) an expansion error is raised.

Error messages

The parameter named 'corsRules' was not set or a defaultValue was defined.

Reproduction

param minTLSVersion string?
param corsRules corsRule

type corsRule = {
  allowedHeaders: string[]
  allowedMethods: string[]
  allowedOrigins: string[]
  exposedHeaders: string[]
  maxAgeInSeconds: int
}[]?

resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
  name: 'test'
  #disable-next-line no-loc-expr-outside-params
  location: resourceGroup().location
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
  properties: {
    minimumTlsVersion: minTLSVersion ?? 'TLS1_2'
  }

  resource blob 'blobServices' = {
    name: 'default'
    properties: {
      cors: {
        corsRules: corsRules ?? []
      }
    }
  }
}

Version of PSRule

2.9.0

Version of PSRule for Azure

1.30.2

Additional context

Raised by @AlexanderSehr microsoft/PSRule#1640

@BernieWhite BernieWhite added bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep. labels Oct 17, 2023
@BernieWhite BernieWhite added this to the v1.31.0 milestone Oct 23, 2023
@BernieWhite BernieWhite self-assigned this Nov 4, 2023
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Nov 4, 2023
This was referenced Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant