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

palo_alto_next_generation_firewall make Marketplace Details and Plan Data configurable #28402

Conversation

aochsner
Copy link
Contributor

@aochsner aochsner commented Dec 31, 2024

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

Closes #28267

Palo Alto changed the plan id and the one hard coded in the provider is no longer valid. This keeps the old one for backwards compatibility. Would like to backport this to v3.

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. - I'm unable to run this as my company doesn't let me.
  • (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)

Change Log

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

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

Note

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

@@ -73,6 +75,10 @@ func (r NextGenerationFirewallVHubLocalRuleStackResource) Arguments() map[string

"destination_nat": schema.DestinationNATSchema(),

"plan_data": schema.PlanDataSchema(),

"marketplace_details": schema.MarketplaceDetailsSchema(),
Copy link
Contributor

@neil-yechenwei neil-yechenwei Jan 8, 2025

Choose a reason for hiding this comment

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

Suggest to arrange the newly added fields in alphabetical order. So please swap the position of "plan_data" and "marketplace_details". Other places also need to be updated. Thanks.

"plan_id": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Copy link
Contributor

@neil-yechenwei neil-yechenwei Jan 8, 2025

Choose a reason for hiding this comment

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

Could you double confirm that this property is updateable once it's created since service team mentioned that planId should be updateable without the need to delete and recreate the resource? Please also check if "billing_cycle" and "usage_type" is updateable. Thanks.

Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "panw-cloud-ngfw-payg",
Copy link
Contributor

@neil-yechenwei neil-yechenwei Jan 8, 2025

Choose a reason for hiding this comment

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

Service team mentioned that the default value is changed to "panw-cngfw-payg". Could you double check it? Thanks.

Optional: true,
ForceNew: true,
Default: "panw-cloud-ngfw-payg",
ValidateFunc: validation.StringIsNotEmpty,
Copy link
Contributor

@neil-yechenwei neil-yechenwei Jan 8, 2025

Choose a reason for hiding this comment

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

Suggest adding validation per property description.

@@ -0,0 +1,72 @@
// Copyright (c) HashiCorp, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest adding these new properties to resource docs. Thanks.

@@ -29,10 +29,12 @@ type NextGenerationFirewallVHubLocalRuleStackModel struct {
ResourceGroupName string `tfschema:"resource_group_name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest triggering the related test cases for the changed resources on your local environment to ensure there is no regression issue. Please also paste the test result in this PR. Thanks.

@@ -29,10 +29,12 @@ type NextGenerationFirewallVHubLocalRuleStackModel struct {
ResourceGroupName string `tfschema:"resource_group_name"`
RuleStackId string `tfschema:"rulestack_id"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest add/update test case for newly added properties. Thanks.

Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: firewalls.UsageTypePAYG,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you double check if it has the default value since Swagger indicates it's not a required property? Thanks.

result.PlanId = p.PlanId
}

if p.UsageType != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest use "pointer.To(firewalls.UsageType(p.UsageType))".

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Jan 13, 2025

@aochsner , thanks for raising this PR. I've taken a look through and left some comments inline. If we can fix those up, this should be good to go. May I ask if there is ETA for the fix? Your PR is also very useful for other customers, which is why both Microsoft and Hashicorp are paying attention to it.

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Jan 16, 2025

@aochsner , Thanks for raising this issue. If we have not received your comments or fixes by this Friday, we will take over the fix. Thank you for your understanding.

@aochsner
Copy link
Contributor Author

Hi sorry for not responding sooner. I will do my best to review the comments. Thank you for the feedback. I have no problem letting yall take over for it. We have been able to work around our immediate blockers via the azapi provider. But I did a best effort to raise the issue for a proper fix while it's all fresh in my mind

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Jan 16, 2025

@aochsner , I noticed that you also made "marketplaceDetails.publisherId," "planData.BillingCycle," and "planData.usageType" configurable parameters. However, the service team only expects planId and offerId to be configurable. Therefore, I will submit a new PR where only planId and offerId will be made configurable parameters. Would that be okay? If you agree, please close this PR. Thanks.

@aochsner
Copy link
Contributor Author

Yep I agree. Happy to close

@aochsner aochsner closed this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Palo Alto Networks: Cloud NGFW - Support for parametrized OfferId and PlanId attributes
2 participants