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

ManagementGroup: Run WhatIf test on e2e after deployment #250

Closed
wants to merge 1 commit into from

Conversation

olljanat
Copy link
Contributor

Overview/Summary

Run WhatIf deployment for management group on e2e tests. Also added new optional parameter parTopLevelManagementGroupParentId which was needed for it.

This PR fixes/adds/changes/removes

  1. First step to solve 💡 Feature Request - Make all modules compatible with WhatIf mode #249

Breaking Changes

N/A

Testing Evidence

Without parTopLevelManagementGroupParentId parameter new WhatIf test step failed to error and it that it passed without issues.

Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

Resource and property changes are indicated with these symbols:
  - Delete
  ~ Modify

The deployment will update the following scope:

Scope: /

  ~ Microsoft.Management/ManagementGroups/PR-test [2021-04-01]
    - properties.details:

        parent.id: "/providers/Microsoft.Management/managementGroups/13a69a3b-cf5f-4204-b274-3e9ce5240a60"


Resource changes: 1 to modify.

As part of this Pull Request I have

  • Read the Contribution Guide and ensured this PR is compliant with the guide
  • Checked for duplicate Pull Requests
  • Associated it with relevant GitHub Issues
  • (ALZ Bicep Core Team Only) Associated it with relevant ADO Items
  • Ensured my code/branch is up-to-date with the latest changes in the main branch
  • Performed testing and provided evidence.
  • Updated tests (if required) Unit - Linting - E2E (End-To-End)
  • Updated relevant and associated documentation (e.g. Contribution Guide, Module READMEs, Wiki Docs etc.)
  • If relevant, created or updated Code Tours here

@jtracey93
Copy link
Collaborator

Thanks @olljanat for this work. As mentioned yesterday (in another discussion IIRC) we are not merging any other changes until #227 is complete and merged as this is a big PR and we need to close it out first before we keep making more merge conflicts we need to resolve.

Can I propose we put this on hold until #227 is merged (hopefully next week) and then you can update this PR with the latest from the upstream (this repo) and then we can review and take it from there?

Let me know if all okay with that 👍

@jtracey93 jtracey93 added external community contribution and removed Needs: Triage 🔍 Needs triaging by the team labels May 26, 2022
@olljanat
Copy link
Contributor Author

@jtracey93 that's fine. I added my self to #227 notification list and will rebase my PRs after it is merged.

@olljanat
Copy link
Contributor Author

@jtracey93 rebased with main

Copy link
Collaborator

@jtracey93 jtracey93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the "all" parameters file with this new input please?

@jfaurskov can I also get your input here as I know you are re working the testing already.

@jfaurskov
Copy link
Contributor

/azp run ValidateAzCloud

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@jfaurskov
Copy link
Contributor

/azp run ValidateAzCloud

@azure-pipelines
Copy link

Azure Pipelines failed to run 1 pipeline(s).

@jfaurskov
Copy link
Contributor

/azp run ValidateAzCloud

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@olljanat
Copy link
Contributor Author

@jtracey93 updated "all" parameters file and rebased with main.

@jtracey93
Copy link
Collaborator

/azp run validateazcloud

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@jtracey93 jtracey93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olljanat a few more bits.

Also requesting @jfaurskov to review this PR too

@jfaurskov jfaurskov self-requested a review June 17, 2022 10:53
Copy link
Contributor

@jfaurskov jfaurskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me. We should expand on this going forward as we split validation and deployment tests up into individual chunks.

@jtracey93
Copy link
Collaborator

Looking good to me. We should expand on this going forward as we split validation and deployment tests up into individual chunks.

Agreed and think these should be included on the deployment phase as needs to run again post deployment as a check that the what-if doesn't kick off saying there's a change, when there clearly wouldn't be 👍

@ghost ghost removed the Needs: Author Feedback label Jun 17, 2022
@olljanat
Copy link
Contributor Author

@jtracey93 looks that your idea to use tenant().tenantId handles the WhatIf case nicely so there is no even need to have separate parameter at all \o/

@jtracey93
Copy link
Collaborator

@jtracey93 looks that your idea to use tenant().tenantId handles the WhatIf case nicely so there is no even need to have separate parameter at all \o/

Hey @olljanat I actually think having this as an input parameter is a nice idea as it enables some further use cases for nested ALZ deployments in some more complex scenarios 👍

@olljanat
Copy link
Contributor Author

@jtracey93 OK. Added it back but updated description because it is not really needed by WhatIf anymore (and not used in e2e because of that).

@jtracey93
Copy link
Collaborator

/azp run validateazcloud

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@jtracey93 jtracey93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of changes to make it more robust for all users @olljanat (thanks for your patience)

@@ -69,6 +72,11 @@ resource resTopLevelMg 'Microsoft.Management/managementGroups@2021-04-01' = {
name: parTopLevelManagementGroupPrefix
properties: {
displayName: parTopLevelManagementGroupDisplayName
details: {
parent: {
id: parTopLevelManagementGroupParentId
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the logic back here that if an empty string is provided that we pass in /providers/Microsoft.Management/managementGroups/${tenant().tenantId}?

If any other string is provided im happy for the error, like our test just picked up 😄

ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n  \"error\": {\r\n    \"code\": \"BadRequest\",\r\n    \"message\": \"Invalid management group creation parameters: expected 'parentId' format: '/providers/Microsoft.Management/managementGroups/ID'\",\r\n    \"details\": null\r\n  }\r\n}"}]}}

If you can make the change, then we can get this one merged 👍

@@ -20,6 +20,7 @@ The module requires the following inputs:

| Parameter | Type | Description | Requirements | Example |
| ------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | --------------------- |
| parTopLevelManagementGroupParentId | string | Optional Tenant Root Group ID. Used as top level management group parent. | | |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this to the example column for this please to help show what is expected: /providers/Microsoft.Management/managementGroups/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Thanks 👍

@ghost
Copy link

ghost commented Jun 27, 2022

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@jtracey93
Copy link
Collaborator

Closing this as have wrapped into #276

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

Successfully merging this pull request may close these issues.

3 participants