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

azurerm_synapse_workspace_aad_admin - fix dependency issue when removing azurerm_synapse_workspace_aad_admin for azurerm_synapse_workspace #27606

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

sinbai
Copy link
Contributor

@sinbai sinbai commented Oct 10, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

When deleting resource azurerm_synapse_workspace_aad_admin, if azuread_authentication_only is enabled for azurerm_synapse_workspace, the API returns the following error.

User tried to delete Azure Active Directory admin when AzureADOnlyAuthentication is set, please use azureADOnlyAuthentications API first.

Since the API requires that azurerm_synapse_workspace_aad_admin can be deleted only if azuread_authentication_only is disabled, submit this PR to disable azuread_authentication_only (if it is enabled) before deleting azurerm_synapse_workspace_aad_admin to fix the dependency issue.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Before applying this PR, after enabling azuread_authentication_only in the test case TestAccSynapseWorkspaceAADAdmin_basic, the error occurred as follows.

=== RUN   TestAccSynapseWorkspaceAADAdmin_basic
=== PAUSE TestAccSynapseWorkspaceAADAdmin_basic
=== CONT  TestAccSynapseWorkspaceAADAdmin_basic
    testcase.go:173: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: setting empty Synapse Workspace "acctestsw241010110304534387" AAD Admin (Resource Group "acctestRG-synapse-241010110304534387"): synapse.WorkspaceAadAdminsClient#Delete: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidAzureADAdminDeleteOperation" Message="User tried to delete Azure Active Directory admin when AzureADOnlyAuthentication is set, please use azureADOnlyAuthentications API first."       
--- FAIL: TestAccSynapseWorkspaceAADAdmin_basic (824.73s)

After applying this PR, the test case passes.
PASS: TestAccSynapseWorkspaceAADAdmin_basic (1040.62s)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_synapse_workspace_aad_admin - fix dependency issue when deleting azurerm_synapse_workspace_aad_admin

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

@sinbai
Copy link
Contributor Author

sinbai commented Oct 22, 2024

Hi @katbyte since I have received ping that there is customer waiting for this fix, could you please take another look at it, thank you very much.

@xiaoyuanzi1230
Copy link

Hello @katbyte This is Mars Xiang, the MSFT engineer with the related customer. The customer is waiting for this fix. So could you please kindly help check and approve this PR? thanks a lot!

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

We have a test failure

------- Stdout: -------
=== RUN   TestAccSynapseWorkspaceAADAdmin_basic
=== PAUSE TestAccSynapseWorkspaceAADAdmin_basic
=== CONT  TestAccSynapseWorkspaceAADAdmin_basic
    testcase.go:173: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: waiting for azuread_authentication_only to finish updating for /subscriptions/*******/resourceGroups/acctestRG-synapse-241028193534126001/providers/Microsoft.Synapse/workspaces/acctestsw241028193534126001: Code="UnexpectedError" Message="Microsoft.Analytics.Common.Http.Exceptions.ErrorContractException: {\"faultType\":0,\"errorResponse\":{\"errorResponse\":{\"code\":\"UnknownWorkflowFailure\",\"message\":\"An unknown error was encountered.\",\"target\":null,\"details\":null}},\"internalErrorResponse\":{\"errorResponse\":{\"code\":\"UnknownWorkflowFailure\",\"message\":\"DurableTask.Core.Exceptions.TaskFailedException : One or many partners failed ((SQL_And_Starlight, Failed)) to process the service bus message: {\\\"SQL_And_Starlight\\\":{\\\"status\\\":\\\"Failed\\\",\\\"debugErrorMessage\\\":\\\"System.Exception : Operation status update failed with: {\\\\\\\"code\\\\\\\":\\\\\\\"PartnerApiError\\\\\\\",\\\\\\\"message\\\\\\\":\\\\\\\"Internal error happened while processing the request.\\\\\\\",\\\\\\\"target\\\\\\\":null,\\\\\\\"details\\\\\\\":null}\\\\r\\\\n   at Microsoft.Analytics.SynapseMessagingConsumerSvc.PartnerNotificationHandlers.PartnerNotificationHandlerBase.<UpdateOperationStatus>d__7`1.MoveNext() in C:\\\\\\\\__w\\\\\\\\1\\\\\\\\s\\\\\\\\src\\\\\\\\services\\\\\\\\SynapseMessagingConsumer\\\\\\\\Microsoft.Analytics.SynapseMessagingConsumerSvc\\\\\\\\PartnerNotificationHandlers\\\\\\\\PartnerNotificationHandlerBase.cs:line 130\\\\r\\\\n--- End of stack trace from previous location where exception was thrown ---\\\\r\\\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\\\r\\\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\\\r\\\\n   at Microsoft.Analytics.SynapseMessagingConsumerSvc.PartnerNotificationHandlers.PartnerNotificationHandlerBase.<NotifyAzureADOnlyAuthentication>d__6.MoveNext() in C:\\\\\\\\__w\\\\\\\\1\\\\\\\\s\\\\\\\\src\\\\\\\\services\\\\\\\\SynapseMessagingConsumer\\\\\\\\Microsoft.Analytics.SynapseMessagingConsumerSvc\\\\\\\\PartnerNotificationHandlers\\\\\\\\PartnerNotificationHandlerBase.cs:line 96\\\"}}\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTaskInternal>d__17.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 102\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTaskToWorker>d__16`1.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 78\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTask>d__15`1.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 70\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at DurableTask.Core.RetryInterceptor`1.<Invoke>d__4.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\RetryInterceptor.cs:line 60\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at DurableTask.Core.RetryInterceptor`1.<Invoke>d__4.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\RetryInterceptor.cs:line 77\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at Microsoft.Analytics.Common.WorkflowEngine.OrchestrationContextExtensions.<ScheduleReliableActivity>d__2`1.MoveNext() in C:\\\\__w\\\\1\\\\s\\\\src\\\\services\\\\provisioning\\\\Microsoft.Analytics.ProvisioningWorkerSvc\\\\WorkflowEngine\\\\OrchestrationContextExtensions.cs:line 65\",\"target\":null,\"details\":null},\"faultSignature\":\"UnknownWorkflowFailure\"},\"faultedComponents\":[{\"partnerAttribution\":0,\"faultedComponentName\":\"Unknown\"}]}\r\n   at Microsoft.Analytics.Common.WorkflowEngine.OrchestrationContextExtensions.<ScheduleActivity>d__1`1.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\WorkflowEngine\\OrchestrationContextExtensions.cs:line 36\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Analytics.ProvisioningWorkerSvc.Workflows.AzureADOnlyAuthentication.Orchestration.CreateOrUpdateAzureADOnlyAuthenticationOrchestration.<WaitForExpectedPartnerStatus>d__9.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\Workflows\\AzureADOnlyAuthentication\\Orchestration\\CreateOrUpdateAzureADOnlyAuthenticationOrchestration.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Analytics.ProvisioningWorkerSvc.Workflows.AzureADOnlyAuthentication.Orchestration.CreateOrUpdateAzureADOnlyAuthenticationOrchestration.<ExecuteProvisioningWorkflow>d__5.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\Workflows\\AzureADOnlyAuthentication\\Orchestration\\CreateOrUpdateAzureADOnlyAuthenticationOrchestration.cs:line 56"
        
--- FAIL: TestAccSynapseWorkspaceAADAdmin_basic (525.55s)

@sinbai
Copy link
Contributor Author

sinbai commented Oct 29, 2024

TestAccSynapseWorkspaceAADAdmin_basic

We have a test failure

------- Stdout: -------
=== RUN   TestAccSynapseWorkspaceAADAdmin_basic
=== PAUSE TestAccSynapseWorkspaceAADAdmin_basic
=== CONT  TestAccSynapseWorkspaceAADAdmin_basic
    testcase.go:173: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: waiting for azuread_authentication_only to finish updating for /subscriptions/*******/resourceGroups/acctestRG-synapse-241028193534126001/providers/Microsoft.Synapse/workspaces/acctestsw241028193534126001: Code="UnexpectedError" Message="Microsoft.Analytics.Common.Http.Exceptions.ErrorContractException: {\"faultType\":0,\"errorResponse\":{\"errorResponse\":{\"code\":\"UnknownWorkflowFailure\",\"message\":\"An unknown error was encountered.\",\"target\":null,\"details\":null}},\"internalErrorResponse\":{\"errorResponse\":{\"code\":\"UnknownWorkflowFailure\",\"message\":\"DurableTask.Core.Exceptions.TaskFailedException : One or many partners failed ((SQL_And_Starlight, Failed)) to process the service bus message: {\\\"SQL_And_Starlight\\\":{\\\"status\\\":\\\"Failed\\\",\\\"debugErrorMessage\\\":\\\"System.Exception : Operation status update failed with: {\\\\\\\"code\\\\\\\":\\\\\\\"PartnerApiError\\\\\\\",\\\\\\\"message\\\\\\\":\\\\\\\"Internal error happened while processing the request.\\\\\\\",\\\\\\\"target\\\\\\\":null,\\\\\\\"details\\\\\\\":null}\\\\r\\\\n   at Microsoft.Analytics.SynapseMessagingConsumerSvc.PartnerNotificationHandlers.PartnerNotificationHandlerBase.<UpdateOperationStatus>d__7`1.MoveNext() in C:\\\\\\\\__w\\\\\\\\1\\\\\\\\s\\\\\\\\src\\\\\\\\services\\\\\\\\SynapseMessagingConsumer\\\\\\\\Microsoft.Analytics.SynapseMessagingConsumerSvc\\\\\\\\PartnerNotificationHandlers\\\\\\\\PartnerNotificationHandlerBase.cs:line 130\\\\r\\\\n--- End of stack trace from previous location where exception was thrown ---\\\\r\\\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\\\r\\\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\\\r\\\\n   at Microsoft.Analytics.SynapseMessagingConsumerSvc.PartnerNotificationHandlers.PartnerNotificationHandlerBase.<NotifyAzureADOnlyAuthentication>d__6.MoveNext() in C:\\\\\\\\__w\\\\\\\\1\\\\\\\\s\\\\\\\\src\\\\\\\\services\\\\\\\\SynapseMessagingConsumer\\\\\\\\Microsoft.Analytics.SynapseMessagingConsumerSvc\\\\\\\\PartnerNotificationHandlers\\\\\\\\PartnerNotificationHandlerBase.cs:line 96\\\"}}\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTaskInternal>d__17.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 102\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTaskToWorker>d__16`1.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 78\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at DurableTask.Core.TaskOrchestrationContext.<ScheduleTask>d__15`1.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\TaskOrchestrationContext.cs:line 70\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at DurableTask.Core.RetryInterceptor`1.<Invoke>d__4.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\RetryInterceptor.cs:line 60\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at DurableTask.Core.RetryInterceptor`1.<Invoke>d__4.MoveNext() in C:\\\\source\\\\durabletask\\\\src\\\\DurableTask.Core\\\\RetryInterceptor.cs:line 77\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at Microsoft.Analytics.Common.WorkflowEngine.OrchestrationContextExtensions.<ScheduleReliableActivity>d__2`1.MoveNext() in C:\\\\__w\\\\1\\\\s\\\\src\\\\services\\\\provisioning\\\\Microsoft.Analytics.ProvisioningWorkerSvc\\\\WorkflowEngine\\\\OrchestrationContextExtensions.cs:line 65\",\"target\":null,\"details\":null},\"faultSignature\":\"UnknownWorkflowFailure\"},\"faultedComponents\":[{\"partnerAttribution\":0,\"faultedComponentName\":\"Unknown\"}]}\r\n   at Microsoft.Analytics.Common.WorkflowEngine.OrchestrationContextExtensions.<ScheduleActivity>d__1`1.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\WorkflowEngine\\OrchestrationContextExtensions.cs:line 36\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Analytics.ProvisioningWorkerSvc.Workflows.AzureADOnlyAuthentication.Orchestration.CreateOrUpdateAzureADOnlyAuthenticationOrchestration.<WaitForExpectedPartnerStatus>d__9.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\Workflows\\AzureADOnlyAuthentication\\Orchestration\\CreateOrUpdateAzureADOnlyAuthenticationOrchestration.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Analytics.ProvisioningWorkerSvc.Workflows.AzureADOnlyAuthentication.Orchestration.CreateOrUpdateAzureADOnlyAuthenticationOrchestration.<ExecuteProvisioningWorkflow>d__5.MoveNext() in C:\\__w\\1\\s\\src\\services\\provisioning\\Microsoft.Analytics.ProvisioningWorkerSvc\\Workflows\\AzureADOnlyAuthentication\\Orchestration\\CreateOrUpdateAzureADOnlyAuthenticationOrchestration.cs:line 56"
        
--- FAIL: TestAccSynapseWorkspaceAADAdmin_basic (525.55s)

Hi @katbyte the test reset passed as follows. Could you please take another look?
https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_SYNAPSE/257768?buildTab=tests

image

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

@sinbai it seems the test is flakey? might be something to look into to prevent PRs being delayed in the future

as it stands thou PR is passing tests and LGTM 🌵

@katbyte katbyte merged commit f6a995d into hashicorp:main Oct 30, 2024
32 checks passed
@github-actions github-actions bot added this to the v4.8.0 milestone Oct 30, 2024
katbyte added a commit that referenced this pull request Oct 30, 2024
Copy link

github-actions bot commented Dec 2, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants