-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_nginx_deployment - support NGINX App Protect WAF #27454
base: main
Are you sure you want to change the base?
Conversation
NGINXaaS now supports NGINX App Protect WAF. This commit includes changes to enable/disable WAF while creation or updating an NGINXaaS deployment.
Looks like some vendor checks are failing? |
c4c0a47
to
4f6d8ec
Compare
I like the newly flattened structure (less nested) to invoke this new feature as well 👍 |
Hi @katbyte @stephybun, when you get time would you be able to take a look at this PR. Thanks in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, we have a test failure needing fixing:
------- Stdout: -------
=== RUN TestAccNginxDeploymentDataSource_nginxappprotect
=== PAUSE TestAccNginxDeploymentDataSource_nginxappprotect
=== CONT TestAccNginxDeploymentDataSource_nginxappprotect
testcase.go:173: Step 1/1 error: Error running apply: exit status 1
Error: scaling is required for `sku` 'standardv2_Monthly', please provide `capacity` or `auto_scale_profiles`
with azurerm_nginx_deployment.test,
on terraform_plugin_test.tf line 75, in resource "azurerm_nginx_deployment" "test":
75: resource "azurerm_nginx_deployment" "test" {
scaling is required for `sku` 'standardv2_Monthly', please provide `capacity`
or `auto_scale_profiles`
--- FAIL: TestAccNginxDeploymentDataSource_nginxappprotect (92.49s)
FAIL
Hi @katbyte!! I see @arpith-f5 pushed a fix for the test. Can you please re-run the tests and see if the issue persists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pr @arpith-f5 - i've given it a quick review and made some schema suggestions. let me know what you think
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ValidateFunc: validation.StringInSlice( | ||
[]string{ | ||
"Enabled", | ||
"Disabled", | ||
}, false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bool? so we should
Type: pluginsdk.TypeString, | |
Required: true, | |
ValidateFunc: validation.StringInSlice( | |
[]string{ | |
"Enabled", | |
"Disabled", | |
}, false), | |
Type: pluginsdk.TypeBool, | |
Required: true, |
and then in the provider code translate true/false to Enabled Disabled, unless there is going to be a 3rd state here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The state is an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless there is going to be a 3rd setting there in the future? this is a bool just represented as an enum and should be as such in the schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we initially designed the activation_state to be a bool in the schema but later changed to enum after recommendation from microsoft ARM team. Here is their reasoning
ARM recommends enums over booleans for future proof APIs. Standard guidance is: replace boolean/switch properties with a more meaningful enum whenever possible.
A boolean will forever have two valid values (true or false). A string enum type is always preferred. Also, properties should always provide better values just than True and False. For example two switches "isTypeA" and "isTypeB" should be replaced with one enum "type": [A, B, DefaultType]. Enums are always a more flexible and future proof option because they allow additional values to be added in the future in a non-breaking way, e.g. [Enabled, Disabled, Suspended, Deallocated].
Note: do NOT define a 'boolean enum' with two values 'True and False'. This might be easier to 'extend' in terms of types, but semantically its confusing, and no better than a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our guidelines enums that are actually just booleans with different names should be booleans in schema with the correct name to telegraph what the boolean does https://github.com/hashicorp/terraform-provider-azurerm/blob/main/contributing/topics/reference-naming.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@katbyte updated the PR to use a bool instead of the enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pr @arpith-f5 - i've given it a quick review and made some schema suggestions. let me know what you think
714e6b6
to
f65af79
Compare
@katbyte would appreciate another look at this PR when convenient. Thanks in advance! |
f65af79
to
d472fb0
Compare
d472fb0
to
8f5233a
Compare
Community Note
Description
NGINXaaS now supports NGINX App Protect WAF. In order to use WAF, customers need to explicitly enable it while creating/update their NGINXaaS deployment. This commit includes changes to support a new block
nginx_app_protect
inazurerm_nginx_deployment
resource to enable/disable WAF while creation or updating an NGINXaaS deployment.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Manually tested create and update of a NGINXaaS deployment with WAF enabled/disabled
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_nginx_deployment
- support NGINX App Protect WAFThis is a (please select all that apply):
Related Issue(s)
Note
If this PR changes meaningfully during the course of review please update the title and description as required.