-
Notifications
You must be signed in to change notification settings - Fork 381
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
fix: Bug Updated delegatedSubnetResourceId to work as attended for db-for-my-sql flexible server module #3775
base: main
Are you sure you want to change the base?
Conversation
…edSubnetResourceId
Hey @FallenHoot , Firstly, thanks for your work on this PR! We have made some changes to the AVM CI, detailed below, which means we need you to update your fork to pull in these latest changes and re-run your tests to show they still are passing prior to approving and merging this PR, as we don't and it fails once merged the publishing of your module will fail and will be blocked going forward until the test pass again via additional PRs. Changes to CI That Have Been Made That You Need To Take Action On
Any questions reach out to the AVM Core Team by tagging us in your PR here or internally via Teams Thanks Jack (AVM Core Team) |
@FallenHoot the pipeline badge you can get from your fork and the workflow. See the screenshot. |
I can't complete the pipeline, because of how pester treats "Conditional". How did this get passed in previous code? What is the workaround, without changing how pester is configured? During the Pester test for validating parameters in an Azure template. The error message suggests that a parameter (managedIdentities) is not labeled as "Required." in its description, even though it is conditionally required based on the value of another parameter (customerManagedKey). @description('Conditional. The managed identity definition for this resource. Required if 'customerManagedKey' is not empty.') I don't really want to rewrite the logic behind this code, but I do think it is overcomplicated. My suggestion:
What is in the code today with correct linters
The above code is doing 100 things and it only needs to do one thing. Suggestions/Feedback |
Something wrong with this code that doesn't allow the Max to deploy anymore. |
Fixed the "Max" issue but now ran into a "Private" issue. It states that you can't run mysql/administrators without having an "Identity" assigned after the latest Bicep Update.
|
avm/res/db-for-my-sql/flexible-server/tests/e2e/private/main.test.bicep
Outdated
Show resolved
Hide resolved
@description('Conditional. The managed identity definition for this resource. Required if \'customerManagedKey\' is not empty.') | ||
param managedIdentities managedIdentitiesType | ||
@description('Optional. The managed identity definition for this resource.') | ||
param userAssignedIdentities object = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @FallenHoot,
be aware this is breaking with several AVM specs (most notably this one). The interface was defined in the way it is to allow or a consistent user experience accross all AVM modules.
I appreciate your comment that for this module it may be an overkill, but in that case I'd rather strongly advice to define a new spec, than to diverge completely.
On that note also one question:
- The original implementation allowed the user to define an array of user-assiged identities via their resource ID
- The new implementation only allows for exact one user assigned identity
Does the resource only allow for one single identity?
Again, I'd rather like to keep the consistency high and if only one single identity is allowed, stick to the same user-defined type be it only with the change to allow for a single resource ID, and only adjust all the ther pieces.
Before I add even more to this comment, let me wait for your reply and then let's go from there 😄
cc: @Azure/avm-module-reviewers-bicep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works with multiple objects as well. I never changed how the test works, but I understand the need to keep the AVM specs.
I’ve spent considerable time attempting to implement a simple fix for this module. However, due to the numerous linter errors in the current version, it wasn't feasible to proceed.
I will simply go back to not using this module going forward until someone fixes the main linter issues, that caused me to change all of this in the first place. As it sits now, it can't deploy with the latest linters.
@AlexanderSehr, can we get the team to fix the below error?
Expected $null or empty, because required parameters in the template file should have a description that starts with "Required.". Found incorrect items: [managedIdentities.userAssignedResourceIds]., but got 'managedIdentities.userAssignedResourceIds'.
This is the main reason why I had to change how this worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @FallenHoot,
please excuse the late reply. Let me look into this in the next couple days - I just returned from some time off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @FallenHoot,
I can't find the reason for the Expected $null or empty, because required parameters in the template file should have a description that starts with "Required.". Found incorrect items: [managedIdentities.userAssignedResourceIds]., but got 'managedIdentities.userAssignedResourceIds'.
error as the userAssignedResourceIds
property of the corresponding type looks absolutely fine to me.
Anyways - considering the latest state of the module in main
this should not be an issue anymore anyways as the local UDT was replaced with a reference from the avm-common-types
utility module:
import { managedIdentityOnlyUserAssignedType } from 'br/public:avm/utl/types/avm-common-types:0.4.0' | |
@description('Conditional. The managed identity definition for this resource. Required if \'customerManagedKey\' is not empty.') | |
param managedIdentities managedIdentityOnlyUserAssignedType? |
I'd recommend pulling in the latest changes from main as at least the reason for this comment should be gone now :)
@FallenHoot see if this #3959 does what you're needing here. |
Description
When to Use mysqlFirewallRule
Public Network Access: If your MySQL flexible server has public network access enabled (publicNetworkAccess: 'Enabled'), you should use firewall rules to restrict access to specific IP addresses or ranges. This helps prevent unauthorized access from the internet.
Specific IP Restrictions: If you need to allow access only from certain IP addresses or ranges, even within a virtual network, firewall rules are necessary.
When You Might Not Need mysqlFirewallRule
Private Network Access Only: If your MySQL flexible server is configured to be accessible only within a virtual network (publicNetworkAccess: 'Disabled'), and you have other network security measures in place (e.g., Network Security Groups, Azure Firewall), you might not need additional firewall rules.
Controlled Environment: If the server is in a highly controlled environment where access is already restricted by other means, firewall rules might be redundant.
Before this fix, you didn't have the option to not use mysqlFirewallRule well still using delegatedSubnetResourceId.
The test in this module don't check for the above bug fix, because they don't have vnet/subnets/dns. I have added another dependency to include those missing test.
Fixes #3717
Pipeline Reference
I assume you need the following:
publicNetworkAccess: Enabled
publicNetworkAccess: Disabled
Type of Change
version.json
:version.json
.version.json
.Checklist
Set-AVMModule
locally to generate the supporting module files.