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_firewall: allow multiple ip_configuration blocks #4639

Merged
merged 11 commits into from
Nov 15, 2019

Conversation

houkms
Copy link
Contributor

@houkms houkms commented Oct 17, 2019

Allow enable_ip_configuration to accept multiple ip_configurations.

(fixes #4045)

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

@houkms

Thanks for the PR, this mostly LGTM, but I left a few comments I would like to see addressed. Once you fix those up we can get this merged. 🚀

azurerm/data_source_firewall.go Outdated Show resolved Hide resolved
azurerm/data_source_firewall.go Outdated Show resolved Hide resolved
azurerm/data_source_firewall_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
website/docs/d/firewall.html.markdown Outdated Show resolved Hide resolved
@WodansSon WodansSon changed the title Bugfix/#4045 enable ip_configuration list in firewall Bug: enable ip_configuration list to contain multiple ip_configurations Oct 17, 2019
@WodansSon WodansSon added this to the v1.36.0 milestone Oct 17, 2019
@WodansSon WodansSon changed the title Bug: enable ip_configuration list to contain multiple ip_configurations Bug: enable ip_configuration list to contain multiple ip_configurations Oct 17, 2019
@houkms
Copy link
Contributor Author

houkms commented Oct 18, 2019

@WodansSon

Thanks for your suggestions. All the ip_configurations are reverted to ip_configuration now.
I addressed the reason about ConflictsWith inline, waiting for your advice.

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

@houkms this is looking good, left a few comments. Thanks for the updates! 🚀

azurerm/data_source_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
@houkms
Copy link
Contributor Author

houkms commented Oct 22, 2019

@WodansSon Thanks for your suggestions. I added the validate function for ip_configuration and addressed the reason for the change of subnet_id.

@houkms houkms requested a review from WodansSon October 24, 2019 04:40
@tombuildsstuff tombuildsstuff modified the milestones: v1.36.0, v1.37.0 Oct 25, 2019
Copy link
Contributor

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

hi @houkms

Thanks for pushing those changes - I've taken a look through and left some comments inline.

Thanks!

azurerm/data_source_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
@tombuildsstuff tombuildsstuff removed this from the v1.37.0 milestone Oct 25, 2019
@houkms houkms requested a review from tombuildsstuff October 28, 2019 03:23
@houkms
Copy link
Contributor Author

houkms commented Oct 30, 2019

@WodansSon I addressed the comments, would you please help review the codes?

@ghost ghost removed the waiting-response label Oct 30, 2019
@katbyte katbyte changed the title Bug: enable ip_configuration list to contain multiple ip_configurations azurerm_firewall: allow multiple ip_configuration blocks Nov 1, 2019
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.

Hi @houkms

I have a question before i continue reviewing this: what is the difference between public_ip_address_id and internal_public_ip_address_id ? Do they do different things or is this just renaming the property?

thanks 🙂

azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
@houkms
Copy link
Contributor Author

houkms commented Nov 4, 2019

Hi @katbyte

It's a property renaming. I think it's a way to deal with breaking change, which was already introduced before this PR.

@ghost ghost removed the waiting-response label Nov 4, 2019
@houkms houkms requested a review from katbyte November 4, 2019 01:58
@timja
Copy link
Contributor

timja commented Nov 7, 2019

I missed this PR and implemented it myself as well, I implemented pretty much the same thing except there's more validation here, and I implemented a test.

I've submitted the test as a PR to your fork @houkms, if you're interested in taking it to give more confidence in this PR:
houkms#1

Either way would love to get this in,
ping @katbyte , @tombuildsstuff , @WodansSon

azurerm_firewall: test for multiple public ip_configuration
@ghost ghost added size/L and removed size/M labels Nov 8, 2019
@houkms
Copy link
Contributor Author

houkms commented Nov 8, 2019

@timja Thanks for your test codes. It looks good to me. Lets wait for the reviews.

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 for the revisions @houkms,

IN addtion to one comment i've left inline i think your going to need to update some of the tag tests:


------- Stdout: -------
=== RUN   TestAccAzureRMFirewallApplicationRuleCollection_updateFirewallTags
=== PAUSE TestAccAzureRMFirewallApplicationRuleCollection_updateFirewallTags
=== CONT  TestAccAzureRMFirewallApplicationRuleCollection_updateFirewallTags
--- FAIL: TestAccAzureRMFirewallApplicationRuleCollection_updateFirewallTags (1096.26s)
    testing.go:569: Step 1 error: errors during apply:
        
        Error: Error validating Firewall "acctestfirewall191110000748156502" (Resource Group "acctestRG-191110000748156502"): The "ip_configuration" is invalid, both "public_ip_address_id" and "internal_public_ip_address_id" have been set, all defined "ip_configuration" blocks must use the same attribute name.
        
          on /opt/teamcity-agent/temp/buildTmp/tf-test745137549/main.tf line 30:
          (source code not available)
        
        
FAIL

------- Stderr: -------
2019/11/10 00:07:48 [DEBUG] Registering Data Sources for "Compute"..

these ones failed too

TestAccAzureRMFirewallNatRuleCollection_updateFirewallTags |  
TestAccAzureRMFirewallNetworkRuleCollection_updateFirewallTags |  
TestAccAzureRMFirewall_withTags

azurerm/resource_arm_firewall.go Outdated Show resolved Hide resolved
@houkms
Copy link
Contributor Author

houkms commented Nov 12, 2019

The tests fail because my validation function doesn't allow internal_public_ip_address_id and public_ip_address_id both exist before creating or updating.

While in the Read function, both of them will be set (see here) if we use any one of them, which will make they both appear in tfstate thus result in validation error in the next time we call create/update.

CONCLUSION

  • I removed the conflicts validation of the two properties (follow an existing resource), and the tests work well now.

@ghost ghost removed the waiting-response label Nov 12, 2019
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 for the revisions @houkms! LGTM now 👍

@katbyte katbyte added this to the v1.37.0 milestone Nov 15, 2019
@katbyte katbyte merged commit be85c17 into hashicorp:master Nov 15, 2019
katbyte added a commit that referenced this pull request Nov 15, 2019
jackbatzner pushed a commit to jackbatzner/terraform-provider-azurerm that referenced this pull request Nov 15, 2019
…#4639)

Allow enable_ip_configuration to accept multiple ip_configurations.

(fixes hashicorp#4045)
jackbatzner pushed a commit to jackbatzner/terraform-provider-azurerm that referenced this pull request Nov 15, 2019
@ghost
Copy link

ghost commented Nov 26, 2019

This has been released in version 1.37.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 = "~> 1.37.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 29, 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!

@ghost ghost locked and limited conversation to collaborators Mar 29, 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.

azurerm_firewall: support multiple ip_configuration blocks
5 participants