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_application_gateway - support WAF Policies #6105

Merged
merged 12 commits into from May 13, 2020

Conversation

sirlatrom
Copy link
Contributor

Fixes #4667.

Copy link
Member

@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.

hey @sirlatrom

Thanks for this PR :)

I've taken a look through and left a few comments inline but this is mostly looking good to me, if we can fix those up then this should otherwise be good 👍

Thanks!

@sirlatrom
Copy link
Contributor Author

@tombuildsstuff I applied your fixes, thanks for the review!

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hey @sirlatrom,

thanks for the PR. Iv'e left one question inline about simplifying the firewall_policy to firewall_policy_id. Its a SubResource type so i think it makes sense.

@sirlatrom
Copy link
Contributor Author

Also see #6126 to be able to create said policies.

@ghost ghost removed the waiting-response label Mar 18, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hey @sirlatrom, thanks for that change. I've left some more comments that need attention - the docs need updating also could we set this property in the complete/another test? thanks!

Comment on lines 1439 to 1442
if res, ok := d.GetOk("firewall_policy_id"); ok {
vs := res.([]interface{})
id := vs[0].(string)
gateway.ApplicationGatewayPropertiesFormat.FirewallPolicy = &network.SubResource{
ID: &id,
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can/should be

Suggested change
if res, ok := d.GetOk("firewall_policy_id"); ok {
vs := res.([]interface{})
id := vs[0].(string)
gateway.ApplicationGatewayPropertiesFormat.FirewallPolicy = &network.SubResource{
ID: &id,
}
}
if v, ok := d.GetOk("firewall_policy_id"); ok {
gateway.ApplicationGatewayPropertiesFormat.FirewallPolicy = &network.SubResource{
ID: &utils.String(v.(string)),
}
}

?

Comment on lines 1626 to 1625
if setErr := d.Set("firewall_policy_id", flattenApplicationGatewayFirewallPolicy(props.FirewallPolicy)); setErr != nil {
return fmt.Errorf("Error setting `firewall_policy_id`: %+v", setErr)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

given this is no longer a block or complex set we can:

Suggested change
if setErr := d.Set("firewall_policy_id", flattenApplicationGatewayFirewallPolicy(props.FirewallPolicy)); setErr != nil {
return fmt.Errorf("Error setting `firewall_policy_id`: %+v", setErr)
}
if props.FirewallPolicy !=nil {
d.Set("firewall_policy_id", props.FirewallPolicy.ID)
}

@@ -167,6 +167,8 @@ The following arguments are supported:

* `custom_error_configuration` - (Optional) One or more `custom_error_configuration` blocks as defined below.

* `firewall_policy` - (Optional) A `firewall_policy` block as defined below.
Copy link
Collaborator

Choose a reason for hiding this comment

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

and we'll need to update the docs here

@sirlatrom
Copy link
Contributor Author

I believe I've addressed the changes in 896fcb8.

@ghost ghost removed the waiting-response label Mar 18, 2020
@sirlatrom sirlatrom requested a review from katbyte March 18, 2020 17:28
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @sirlatrom, one last thing is could we set that property in a test?

@katbyte katbyte modified the milestones: v2.2.0, v2.3.0 Mar 18, 2020
@ghost ghost added size/M and removed size/XS labels Mar 19, 2020
@sirlatrom sirlatrom requested a review from katbyte March 19, 2020 10:20
@sirlatrom
Copy link
Contributor Author

@katbyte I've tried writing a test that sets the property, but when running the test it does not seem to matter what assertions I make, so maybe there's some documentation somewhere on what I can do to run the test properly?

@sirlatrom sirlatrom requested a review from katbyte April 27, 2020 06:58
@katbyte katbyte modified the milestones: v2.8.0, v2.9.0 Apr 30, 2020
@sirlatrom sirlatrom force-pushed the fix-4667 branch 2 times, most recently from 15907a5 to d9d4d7f Compare May 7, 2020 12:33
@sirlatrom
Copy link
Contributor Author

Rebased on master to resolve conflicts. No manual merge work was needed.

@ghost

This comment has been minimized.

@sirlatrom
Copy link
Contributor Author

@katbyte I see this has been marked as included in v2.9.0, but it hasn't been merged as such. I suppose now the release has been cut, it would have to be moved to v2.10.0?

@katbyte katbyte modified the milestones: v2.9.0, v2.10.0 May 8, 2020
sirlatrom and others added 12 commits May 11, 2020 09:58
Fixes hashicorp#4667.

Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
…wall policy

Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @sirlatrom! LGTM 🙂

@katbyte katbyte merged commit 8d09d93 into hashicorp:master May 13, 2020
katbyte added a commit that referenced this pull request May 13, 2020
@sirlatrom sirlatrom deleted the fix-4667 branch May 13, 2020 23:53
@ghost
Copy link

ghost commented May 15, 2020

This has been released in version 2.10.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.10.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jun 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jun 13, 2020
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.

WAF Policy association to an Application Gateway
3 participants