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_policy_set_definition: fix acceptance test policy set with no parameter #23155

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Sep 4, 2023

We should set Parameters only when specified in configuration.

current test will fail with:

=== CONT  TestAccAzureRMPolicySetDefinition_customNoParameter
    testcase.go:113: 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_policy_set_definition.test will be updated in-place
          ~ resource "azurerm_policy_set_definition" "test" {
                id           = "/subscriptions/*******/providers/Microsoft.Authorization/policySetDefinitions/acctestPolSet-230901045501469094"
                name         = "acctestPolSet-230901045501469094"
                # (3 unchanged attributes hidden)
              ~ policy_definition_reference {
                  - parameter_values     = jsonencode({})
                  + policy_group_names   = []
                    # (2 unchanged attributes hidden)
                }
            }
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccAzureRMPolicySetDefinition_customNoParameter (218.84s)

Test Pass now:

=== RUN   TestAccAzureRMPolicySetDefinition_customNoParameter
=== PAUSE TestAccAzureRMPolicySetDefinition_customNoParameter
=== CONT  TestAccAzureRMPolicySetDefinition_customNoParameter
--- PASS: TestAccAzureRMPolicySetDefinition_customNoParameter (243.94s)

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@tombuildsstuff tombuildsstuff merged commit 0b972fd into hashicorp:main Sep 4, 2023
20 checks passed
@tombuildsstuff tombuildsstuff added this to the v3.72.0 milestone Sep 4, 2023
tombuildsstuff added a commit that referenced this pull request Sep 4, 2023
@wuxu92 wuxu92 deleted the pol/noparam branch September 5, 2023 01:53
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 May 15, 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.

2 participants