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

TF Apply on Role Assignment #104

Open
mgodfre3 opened this issue Jul 22, 2024 · 1 comment
Open

TF Apply on Role Assignment #104

mgodfre3 opened this issue Jul 22, 2024 · 1 comment

Comments

@mgodfre3
Copy link
Collaborator

Running Merge Action for additional Site, and running into an issue. I have given the SPN Contributor, Key Vault Admin and User Access Admin on the Resource Group. I have confirmed that the SPN is not Azure Connected Machine Onboarding, Azure Connected Machine Resource Administrator.

TF Apply Errors at:

Error: authorization.RoleAssignmentsClient#Create: Failure responding to request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=409 Code="RoleAssignmentExists" Message="The role assignment already exists."

│ with module.base.module.hci.azurerm_role_assignment.ServicePrincipalRoleAssign["ACMRM"],
│ on ....\modules\hci\rolebindings.tf line 13, in resource "azurerm_role_assignment" "ServicePrincipalRoleAssign":
│ 13: resource "azurerm_role_assignment" "ServicePrincipalRoleAssign" {


Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

https://github.com/mgodfre3/Edge-infrastructure-quickstart-template/actions/runs/9993532559

In the past I have pre-created SPN and provided specific rights to the Subscription, I would prefer to provide a SPN instead of create one during deployment, if possible.

@duzitong
Copy link
Collaborator

duzitong commented Jul 23, 2024

You may try to comment out this part https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/hci/rolebindings.tf#L21C1-L30C2

But be aware that this change will apply to all sites referencing this module. If the module was used to create a site, removing these lines will cause the role assignment for old sites being removed. You may need to manually add it back.

Another option is that you can copy the base module to another module. Then comment these out. You can reference the copied module in your new sites.

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

No branches or pull requests

2 participants