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_ip_group - support for firewall_ids, firewall_policy_ids #19845

Merged
merged 8 commits into from
Jan 17, 2023

Conversation

sponte
Copy link
Contributor

@sponte sponte commented Jan 3, 2023

Resolves #19843

PS: If accepted and merged, could this be released into v2.99? The reason for the ask is that we use Azure CAF for landing zones and CAF is still using v2 of the provider.

@sponte sponte force-pushed the feature/fix-ip-group-provisioning branch from 90542e3 to dd289ed Compare January 3, 2023 19:41
@sponte
Copy link
Contributor Author

sponte commented Jan 3, 2023

Hello, I noticed one of the checks is failing due to using d.Get in the delete function - what is the alternative? to query the API to get the information required i.e. in this case to get the list of linked firewalls and firewall policies?

@sponte
Copy link
Contributor Author

sponte commented Jan 3, 2023

Judging by the firewall example, one needs to query the API as suspected. will refactor

image

@sponte
Copy link
Contributor Author

sponte commented Jan 3, 2023

Refactored

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 @sponte - just need to add the properties to the docs and i think we're good to merge!

internal/services/network/ip_group_resource.go Outdated Show resolved Hide resolved
@sponte
Copy link
Contributor Author

sponte commented Jan 5, 2023

Hey @katbyte - how would we go about releasing this into v2 if at all possible?

@sponte
Copy link
Contributor Author

sponte commented Jan 9, 2023

Hello, gentle nudge. Is there anything else required to progress this PR?

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 @sponte - i'm sorry i missed this on my first review but exported (computed only) properties should only be lists (otherwise you need to know the hash)

As for porting it back to 2.x we try not to do so and encourage people to update to the latest version of the provider. Is there a reason you cannot upgrade?

internal/services/network/ip_group_resource.go Outdated Show resolved Hide resolved
internal/services/network/ip_group_resource.go Outdated Show resolved Hide resolved
@sponte
Copy link
Contributor Author

sponte commented Jan 10, 2023

Hello @katbyte, I addressed the type comments.

With regards to v2 - I completely understand where you're coming from. The reason for the ask, is that we use Microsoft's Azure CAF framework which is pinned to ~> 2.99 version in https://github.com/aztfmod/terraform-azurerm-caf/blob/main/main.tf - the v3 upgrade is on the roadmap for the project but it is a substantial amount of work and is likely not going to be available for a considerable amount of time.

The fix proposed in this PR would go a long way to help with v2.x deployments, especially for people in the similar situation to ours.

Hope it makes sense and is not too big of an ask.

Thank you,
Stan Wozniak

@katbyte
Copy link
Collaborator

katbyte commented Jan 12, 2023

@sponte - you are also going to need to update the handling of the properties expand/flatter:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccFirewallPolicy_completePremium
=== PAUSE TestAccFirewallPolicy_completePremium
=== CONT  TestAccFirewallPolicy_completePremium

------- Stderr: -------
panic: interface conversion: interface {} is []interface {}, not *schema.Set

goroutine 520 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/network.resourceIpGroupCreateUpdate(0xc000323400, {0x5ddac40?, 0xc002d38800})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/internal/services/network/ip_group_resource.go:91 +0x12d5

@sponte
Copy link
Contributor Author

sponte commented Jan 13, 2023

Hey @katbyte , apologies, I didn't run the tests before submitting last change. I have now ran the following two tests and here are their outputs:

ARM_TEST_LOCATION_ALT2=uksouth ARM_TEST_LOCATION_ALT=uksouth ARM_TEST_LOCATION=uksouth TF_ACC=true go test -v github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall -run TestAccFirewallPolicy_completePremium
=== RUN   TestAccFirewallPolicy_completePremium
=== PAUSE TestAccFirewallPolicy_completePremium
=== CONT  TestAccFirewallPolicy_completePremium
--- PASS: TestAccFirewallPolicy_completePremium (475.19s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall      476.490s

and

ARM_TEST_LOCATION_ALT2=uksouth ARM_TEST_LOCATION_ALT=uksouth ARM_TEST_LOCATION=uksouth TF_ACC=true go test -v github.com/hashicorp/terraform-provider-azurerm/internal/services/network -run TestAccIpGroup_updateWithAttachedPolicy  -timeout 126m
=== RUN   TestAccIpGroup_updateWithAttachedPolicy
=== PAUSE TestAccIpGroup_updateWithAttachedPolicy
=== CONT  TestAccIpGroup_updateWithAttachedPolicy
--- PASS: TestAccIpGroup_updateWithAttachedPolicy (1651.22s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/network       1652.559s

@sponte sponte requested a review from katbyte January 17, 2023 20:04
@katbyte katbyte changed the title Feature/fix ip group provisioning azurerm_ip_group - support for firewall_ids, firewall_policy_ids Jan 17, 2023
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.

No worried @sponte - tests pass now and LGTM 🔐

@katbyte katbyte merged commit 66fea6e into hashicorp:main Jan 17, 2023
katbyte added a commit that referenced this pull request Jan 17, 2023
@github-actions github-actions bot added this to the v3.40.0 milestone Jan 17, 2023
@github-actions
Copy link

This functionality has been released in v3.40.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@sponte
Copy link
Contributor Author

sponte commented Jan 21, 2023

Excellent, thank you for merging @katbyte.

I wanted to follow up on the v2 release? Would this be possible? Do you need me to do anything to help with that?

@sponte sponte deleted the feature/fix-ip-group-provisioning branch January 24, 2023 10:13
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2023
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.

Azure Firewall: Updating multiple IP Group objects at the same time causes firewall/policy to fail
2 participants