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 Report]: Storage Account Bicep Linting - Warning BCP329 #4250

Closed
russellds opened this issue Nov 15, 2023 · 1 comment · Fixed by #4262
Closed

[Bug Report]: Storage Account Bicep Linting - Warning BCP329 #4250

russellds opened this issue Nov 15, 2023 · 1 comment · Fixed by #4262
Assignees
Labels
bug Something isn't working

Comments

@russellds
Copy link

Describe the bug

Getting the following linting warning when using the Storage Account module:

WARNING: ...\modules\storage\storage-account\blob-service\main.bicep(82,24) : Warning BCP329: The provided value can be as small as 0 and may be too small to assign to a target with a configured minimum of 1.

To reproduce

Use Storage Account bicep module to deploy a storage account.

Code snippet

No response

Relevant log output

No response

@russellds russellds added the bug Something isn't working label Nov 15, 2023
@github-project-automation github-project-automation bot moved this to Needs triage in Bug board Nov 15, 2023
@AlexanderSehr
Copy link
Contributor

Hey @russellds,
thanks for brining this up. This seems to be an issue with this line:

retentionInDays: changeFeedEnabled == true ? (changeFeedRetentionInDays != 0 ? changeFeedRetentionInDays : null) : null

in which retentionInDays must be larger than 0, yet the parameter changeFeedRetentionInDays can be 0.

As you may already figured by looking at the above if else statement, this is actually a false-positive. If changeFeedRetentionInDays were to be 0, Bicep would actually set the value to null not 0.

I can only assume this was implemented this way because originally, it wasn't able to specify optional parameter in Bicep without also providing a default (in this case 0).

Now that nullable types are available, the parameter could change to something like param changeFeedRetentionInDays int? and the logic in the template could change to

param changeFeedRetentionInDays int?

(...)
retentionInDays: changeFeedRetentionInDays
(...)

@AlexanderSehr AlexanderSehr moved this from Needs triage to Low priority in Bug board Nov 16, 2023
@AlexanderSehr AlexanderSehr self-assigned this Nov 19, 2023
@AlexanderSehr AlexanderSehr linked a pull request Nov 19, 2023 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from Low priority to Closed in Bug board Nov 19, 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
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

2 participants