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: #423

Open
danie1blackmore opened this issue Oct 11, 2024 · 3 comments
Open

bug: #423

danie1blackmore opened this issue Oct 11, 2024 · 3 comments
Labels
Needs: Attention 👋 Needs attention from the maintainers

Comments

@danie1blackmore
Copy link

danie1blackmore commented Oct 11, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

Please paste the output of terraform version command from within the initialized directory:

Terraform v1.9.7

Please enter the module version that you are using:

4.1.4

Description

When making future changes to the subscription, the changes are not applied. For example, if the subscription was previously placed in the contoso-management management, changing the subscription_management_group_id to contoso-connectivity and then running a terraform apply does not re-associate the subscription to the contoso-connectivity management group

Steps to Reproduce

  1. Using the examples, provision a new subscription and populate the subscription_management_group_id
  2. Run terraform apply
  3. Change the subscription_management_group_id to another management group
  4. Run terraform apply

Following this, the subscription should still be in the original management group

Screenshots

Additional context

No workaround found for changing management group ids - instead just a manual move.

@matt-FFFFFF
Copy link
Member

Hi - this is strange as we use the management group association resource to manage this - what does your module input look like?

@matt-FFFFFF matt-FFFFFF added the Needs: Author Feedback ✏️ Needs the author to provide feedback label Oct 30, 2024
@danie1blackmore
Copy link
Author

Hi,

It's pretty typical of some of the examples. While testing I'm just hard-coding, but variables would eventually be used. Just to note as well I wasn't able to copy and paste so just had to re-type the below. The original code works without errors so the inputs appear correct.

module lz_vending {
   source = "azure/lz-vending/azurerm"
   subscription_id = "subid"
   subscription_alias_enabled = false
   subscription_billing_scope = ""
   subscription_display_name = "test sub"
   subscription_alias_name = "test sub"
   subscription_workload = "production"
   subscription_management_group_id = "contoso-online"
}

At the moment, the subscription is currently under the "contoso-sandbox" management group id, and running a terraform plan doesnt detect it or apply doesn't change it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Needs attention from the maintainers and removed Needs: Author Feedback ✏️ Needs the author to provide feedback labels Oct 30, 2024
@danie1blackmore
Copy link
Author

Just to note as well, I tried to use the azurerm_management_group_subscription_association as outlined in the terraform documentation (using the data blocks as well) which did successfully associate to the correct management group using the exact same information as outlined above, so it looks like it's something within the lz_vending module rather than the azurerm module

data azurerm_management_group test {
   name = "contoso-online"
}

data azurerm_subscription test {
   subscription_id = "subid" 
}

resource azurerm_management_group_subscription_association test {
   management_group_id = data.azurerm_management_group.test.id
   subscription_id = data.azurerm_subscription.test.id
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention 👋 Needs attention from the maintainers
Projects
None yet
Development

No branches or pull requests

2 participants