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_database: Fix extended_auditing_policy for Secondaries #13799

Conversation

aristosvo
Copy link
Collaborator

Fixes #13774

For some reason, extended_auditing_policy is returned for Secondaries nowadays, breaking every update of a secondary without this fix.

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Hey @aristosvo, thanks for this PR. Looks like there are some test failures though

------- Stdout: -------
=== RUN   TestAccMsSqlDatabase_createSecondaryMode
=== PAUSE TestAccMsSqlDatabase_createSecondaryMode
=== CONT  TestAccMsSqlDatabase_createSecondaryMode
testcase.go:108: Step 1/2 error: After applying this test step, the plan was not empty.
stdout:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# azurerm_mssql_database.secondary will be updated in-place
~ resource "azurerm_mssql_database" "secondary" {
+ extended_auditing_policy    = (known after apply)
id                          = "/subscriptions/*******/resourceGroups/acctestRG-mssql2-211020080224539510/providers/Microsoft.Sql/servers/acctest-sqlserver2-211020080224539510/databases/acctest-dbs-211020080224539510"
name                        = "acctest-dbs-211020080224539510"
# (14 unchanged attributes hidden)
# (3 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccMsSqlDatabase_createSecondaryMode (495.94s)
FAIL

@github-actions github-actions bot added size/S and removed size/XS labels Oct 20, 2021
@aristosvo
Copy link
Collaborator Author

aristosvo commented Oct 20, 2021

Thanks @stephybun, I noticed indeed. I created a fix, tests are passing locally:

❯ go install && make acctests SERVICE='mssql' TESTARGS='-run=TestAccMsSqlDatabase_createSecondaryMode'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/mssql -run=TestAccMsSqlDatabase_createSecondaryMode -timeout 180m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccMsSqlDatabase_createSecondaryMode
=== PAUSE TestAccMsSqlDatabase_createSecondaryMode
=== CONT  TestAccMsSqlDatabase_createSecondaryMode
--- PASS: TestAccMsSqlDatabase_createSecondaryMode (826.99s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql 828.639s

Edit:

  • Running test one more time locally to confirm working after cleanup
  • Some minor linting issues

@katbyte katbyte added this to the v2.82.0 milestone Oct 21, 2021
@katbyte katbyte added bug service/mssql Microsoft SQL Server labels Oct 21, 2021
@stephybun
Copy link
Member

Thanks @aristosvo, that test passes in TC now. There are some other test failures but they're failing in main and look unrelated to this change. LGTM!

@stephybun stephybun merged commit e5bdc0c into hashicorp:main Oct 21, 2021
@aristosvo aristosvo deleted the mssql/secondary-import-extended_auditing_policy branch October 21, 2021 10:14
@github-actions
Copy link

This functionality has been released in v2.82.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 21, 2021
@aristosvo aristosvo restored the mssql/secondary-import-extended_auditing_policy branch April 14, 2023 07:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug service/mssql Microsoft SQL Server size/S
Projects
None yet
3 participants