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_palo_alto_next_generation_firewall_* - support for new properties marketplace_offer_id and plan_id #28537

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

neil-yechenwei
Copy link
Contributor

@neil-yechenwei neil-yechenwei commented Jan 17, 2025

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

Recently, I noticed that the test cases related to "azurerm_palo_alto_next_generation_firewall_" have been consistently failing with below error on TeamCity Daily Run. The error message indicates that "panw-cloud-ngfw-payg" has been deprecated. So service API doesn't allow it while provisioning the resource. Additionally, the service team has recently reached out to us, requesting that we update the default value of planId and make both planId and offerId configurable parameters. The following linked GitHub issue was also created by the service team.

Error Message:

Error: creating Firewall (Subscription: "xxxxx"
Resource Group Name: "acctestRG-PANGFWVN-250116020412783950"
Firewall Name: "acctest-ngfwvn-250116020412783950"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: PaymentRequired: SaaS Purchase Payment Check Failed as validationResponse was {"isEligible":false,"errorMessage":"Plan 'panw-cloud-ngfw-payg' is defined as stop sell in offer 'pan_swfw_cloud_ngfw'."}

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)

TF 4.x:

--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_basic (4366.40s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_complete (4361.24s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_update (4813.45s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_requiresImport (3872.96s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_complete (3997.53s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_basic (4025.60s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_update (5204.57s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_complete (2184.16s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_update (3017.18s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_basic (2178.90s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_requiresImport (2173.35s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_complete (2887.05s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_basic (2883.05s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_update (2896.55s)

TF 5.x:

--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_requiresImport (2165.04s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_complete (2184.11s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_basic (2190.58s)
--- PASS: TestAccPaloAltoNextGenerationFirewallLocalRulestackVNet_update (3403.93s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_requiresImport (4091.47s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_basic (4121.43s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_complete (4139.07s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubLocalRulestack_update (5167.42s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_update (3596.19s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_complete (2878.92s)
--- PASS: TestAccNextGenerationFirewallVNetPanoramaResource_basic (2941.79s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_update (5285.26s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_basic (4489.37s)
--- PASS: TestAccPaloAltoNextGenerationFirewallVHubPanoramaResource_complete (4416.25s)

Change Log

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

  • azurerm_palo_alto_next_generation_firewall_* - support for new properties marketplace_offer_id and plan_id

This is a (please select all that apply):

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

Related Issue(s)

Fixes #28267
Fixes #28526

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@neil-yechenwei neil-yechenwei marked this pull request as ready for review January 19, 2025 01:21
Comment on lines +177 to +195
if !features.FivePointOhBeta() {
return fmt.Sprintf(`
%[1]s
resource "azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack" "import" {
name = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.name
resource_group_name = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.resource_group_name
rulestack_id = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.rulestack_id
plan_id = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.plan_id
network_profile {
virtual_hub_id = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.network_profile.0.virtual_hub_id
network_virtual_appliance_id = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.network_profile.0.network_virtual_appliance_id
public_ip_address_ids = azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack.test.network_profile.0.public_ip_address_ids
}
}
`, r.basic(data))
}
return fmt.Sprintf(`
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is necessary since plan_id is an optional property, the existing config for the requires import test should still work?

Comment on lines +133 to +154
if !features.FivePointOhBeta() {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%[1]s
resource "azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack" "test" {
name = "acctest-ngfwvh-%[2]d"
resource_group_name = azurerm_resource_group.test.name
rulestack_id = azurerm_palo_alto_local_rulestack.test.id
plan_id = "panw-cngfw-payg"
network_profile {
virtual_hub_id = azurerm_virtual_hub.test.id
network_virtual_appliance_id = azurerm_palo_alto_virtual_network_appliance.test.id
public_ip_address_ids = [azurerm_public_ip.test.id]
}
}
`, r.template(data), data.RandomInteger)
}
Copy link
Member

Choose a reason for hiding this comment

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

The basic test config shouldn't include optional arguments. I think this can be removed since we've added plan_id to the complete test configuration

resource_group_name = azurerm_resource_group.test.name
rulestack_id = azurerm_palo_alto_local_rulestack.test.id
marketplace_offer_id = "pan_swfw_cloud_ngfw"
plan_id = "panw-cngfw-payg"
Copy link
Member

Choose a reason for hiding this comment

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

Can this be panw-cloud-ngfw-payg so we can test the update path of this property?

Comment on lines +113 to +135
if !features.FivePointOhBeta() {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}

%[1]s

resource "azurerm_palo_alto_next_generation_firewall_virtual_hub_panorama" "test" {
name = "acctest-ngfwvh-%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
panorama_base64_config = "%[3]s"
plan_id = "panw-cngfw-payg"

network_profile {
virtual_hub_id = azurerm_virtual_hub.test.id
network_virtual_appliance_id = azurerm_palo_alto_virtual_network_appliance.test.id
public_ip_address_ids = [azurerm_public_ip.test.id]
}
}
`, r.template(data), data.RandomInteger, os.Getenv("ARM_PALO_ALTO_PANORAMA_CONFIG"))
}
Copy link
Member

Choose a reason for hiding this comment

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

Same remark here, optional properties shouldn't be added to basic tests, I think this can be removed since it's been added to the complete config. This comment applies to all the other resource tests that have been modified in this PR.

Comment on lines +151 to +166
### `azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack`

* The `plan_id` property now defaults to `panw-cngfw-payg`.

### `azurerm_palo_alto_next_generation_firewall_virtual_hub_panorama`

* The `plan_id` property now defaults to `panw-cngfw-payg`.

### `azurerm_palo_alto_next_generation_firewall_virtual_network_local_rulestack`

* The `plan_id` property now defaults to `panw-cngfw-payg`.

### `azurerm_palo_alto_next_generation_firewall_virtual_network_panorama`

* The `plan_id` property now defaults to `panw-cngfw-payg`.

Copy link
Member

Choose a reason for hiding this comment

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

The upgrade guide follows alphabetical ordering, these need to be moved up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants