Skip to content

fix: update required providers in resource.tf and add lifecycle ignore_changes for billing_policy_id in tests#1158

Open
mawasile wants to merge 2 commits intomainfrom
mawsile/fix-TestAccBillingPolicy
Open

fix: update required providers in resource.tf and add lifecycle ignore_changes for billing_policy_id in tests#1158
mawasile wants to merge 2 commits intomainfrom
mawsile/fix-TestAccBillingPolicy

Conversation

@mawasile
Copy link
Copy Markdown
Contributor

This pull request makes updates to the Power Platform billing policy resource example and its associated acceptance tests. The main changes involve how required providers are defined and how the billing_policy_id property is managed in test resources to improve test reliability.

Provider configuration updates:

  • Moved the terraform block specifying required providers from terraform.tf to resource.tf, and removed the version constraint for the azurerm provider. This centralizes provider requirements and simplifies version management. [1] [2]

Acceptance test improvements:

  • Updated the acceptance test for billing policy environments to use a lifecycle { ignore_changes = [billing_policy_id] } block instead of directly setting the billing_policy_id property. This change helps prevent unnecessary test failures due to external changes in the billing policy association. [1] [2] [3]

Copilot AI review requested due to automatic review settings April 20, 2026 10:51
@mawasile mawasile requested a review from a team as a code owner April 20, 2026 10:51
@mawasile mawasile added bug Something isn't working run-acceptance-tests PR tag for triggering acceptance tests skip-changelog and removed bug Something isn't working labels Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Power Platform billing policy resource example and acceptance tests to make provider requirements clearer in examples and to reduce test flakiness from billing policy association drift.

Changes:

  • Moved terraform { required_providers { ... } } from terraform.tf into the billing policy example’s resource.tf, and removed the pinned azurerm version.
  • Updated the billing policy environment acceptance test to use lifecycle { ignore_changes = [billing_policy_id] } on powerplatform_environment resources instead of setting billing_policy_id directly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/services/licensing/resource_billing_policy_environment_test.go Makes acceptance test configs resilient to external/side-effect changes in billing_policy_id by ignoring drift on the environment resources.
examples/resources/powerplatform_billing_policy/terraform.tf Removes the standalone terraform block file now that provider requirements are centralized elsewhere.
examples/resources/powerplatform_billing_policy/resource.tf Adds required_providers into the main example configuration and removes the azurerm version pin.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.70%. Comparing base (586eb3c) to head (41f399c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1158      +/-   ##
==========================================
- Coverage   73.71%   73.70%   -0.02%     
==========================================
  Files         133      133              
  Lines       16522    16522              
==========================================
- Hits        12179    12177       -2     
- Misses       3208     3209       +1     
- Partials     1135     1136       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-acceptance-tests PR tag for triggering acceptance tests skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants