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_mssql_server: user_assigned_identity_ids and primary_user_assigned_identity_id #13683

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

aristosvo
Copy link
Collaborator

@aristosvo aristosvo commented Oct 11, 2021

@katbyte katbyte added this to the v2.81.0 milestone Oct 13, 2021
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.

Thanks @aristosvo - overall looks good! but we have a test failure

------- Stdout: -------
=== RUN   TestAccMsSqlServer_update
=== PAUSE TestAccMsSqlServer_update
=== CONT  TestAccMsSqlServer_update
    testcase.go:88: Step 5/8 error: Error running apply: exit status 1
        
        Error: waiting for creation/update of Server: (Name "acctestsqlserver211013215508481696" / Resource Group "acctestRG-mssql-211013215508481696"): Code="MissingPrimaryIdentity" Message="A primary user assigned managed identity has not been specified. Please specify the primary managed identity that you would like to use for the server 'acctestsqlserver211013215508481696'."
        
          with azurerm_mssql_server.test,
          on terraform_plugin_test.tf line 50, in resource "azurerm_mssql_server" "test":
          50: resource "azurerm_mssql_server" "test" {
        
--- FAIL: TestAccMsSqlServer_update (656.49s)
FAIL

@aristosvo
Copy link
Collaborator Author

aristosvo commented Oct 14, 2021

Ah, nice. Forgot to update part of the primary managed identity, commit incoming! 🚀

Test 🏃🏽‍♀️:
Edit: I think overall it's fixed but it seems like my networking is not as stable as I wanted:

=== CONT  TestAccMsSqlServer_update
    testcase.go:88: Step 5/8 error: Error running apply: exit status 1
        
        Error: issuing create/update request for Server: (Name "acctestsqlserver211014083206192636" / Resource Group "acctestRG-mssql-211014083206192636"): sql.ServersClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="BadGatewayConnection" Message="The network connectivity issue encountered for 'Microsoft.Sql'; cannot fulfill the request."
        
          with azurerm_mssql_server.test,
          on terraform_plugin_test.tf line 50, in resource "azurerm_mssql_server" "test":
          50: resource "azurerm_mssql_server" "test" {

.. and another weird error:

=== CONT  TestAccMsSqlServer_update
    testcase.go:88: Step 3/8 error: Error running apply: exit status 1
        
        Error: waiting for creation of Private Endpoint "acctest-privatelink-211014091236295698" (Resource Group "acctestRG-mssql-211014091236295698"): Code="BadGatewayConnection" Message="Call to Microsoft.Sql/servers failed. Error message: The network connectivity issue encountered for 'Microsoft.Sql'; cannot fulfill the request." Details=[]
        
          with azurerm_private_endpoint.test,
          on terraform_plugin_test.tf line 85, in resource "azurerm_private_endpoint" "test":
          85: resource "azurerm_private_endpoint" "test" {

.. and then it worked, but some new problems showed up:

=== CONT  TestAccMsSqlServer_update
    testcase.go:88: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
        
        (map[string]string) {
        }
        
        
        (map[string]string) (len=1) {
         (string) (len=33) "primary_user_assigned_identity_id": (string) ""
        }
--- FAIL: TestAccMsSqlServer_update (745.03s)

.. which I fixed with always setting primary_user_assigned_identity_id and making it Computed:

--- PASS: TestAccMsSqlServer_complete (362.48s)
--- PASS: TestAccMsSqlServer_update (929.68s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql      931.270s

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.

Thanks @aristosvo! LGTM 🍰

@katbyte katbyte changed the title azurerm_mssql_server: Support UserAssigned Identities azurerm_mssql_server: user_assigned_identity_ids and primary_user_assigned_identity_id Oct 14, 2021
@katbyte katbyte merged commit f70eae1 into hashicorp:main Oct 14, 2021
katbyte added a commit that referenced this pull request Oct 14, 2021
@github-actions
Copy link

This functionality has been released in v2.81.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 Nov 14, 2021
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.

Support for sql server user assigned identities
2 participants