Skip to content

Feature: Add dest_cidr_list support to egress firewall - #298

Open
elivlo wants to merge 4 commits into
apache:mainfrom
elivlo:feature/egress-firewall-destcidrlist
Open

Feature: Add dest_cidr_list support to egress firewall#298
elivlo wants to merge 4 commits into
apache:mainfrom
elivlo:feature/egress-firewall-destcidrlist

Conversation

@elivlo

@elivlo elivlo commented Jun 25, 2026

Copy link
Copy Markdown

Hi :)

This PR adds the optional set dest_cidr_list to cloudstack_egress_firewall rules to restrict egress traffic destinations, mapping to the CloudStack destcidrlist API parameter. It also refactors the rule-read path for some cleanup.

Please keep in mind that I ran the following tests in the cloudstack simulator:

make testacc TESTARGS='-run ^TestAccCloudStackEgressFirewall_'

It fixes #296 - @artem-sidorenko Does that fit your needs?
It is a complete implementation of #265

elivlo added 4 commits June 25, 2026 09:51
Adds the destcidrlist parameter to egress firewall rules, allowing
users to restrict the destination of egress traffic. The field is
optional and maps to the CloudStack API's destcidrlist parameter.

Fixes apache#296
Restructure resourceCloudStackEgressFirewallRead to use a switch on the
protocol and extract the repeated CIDR set-building into a single
cidrSetFromList helper.

The helper returns an empty set for an empty list, restoring the guard
against empty Destcidrlist consistently across all branches.

Verified with the egress firewall acceptance tests against the
cloudstack simulator.
@artem-sidorenko

Copy link
Copy Markdown

@elivlo many thanks! It is :)

@elivlo

elivlo commented Aug 5, 2026

Copy link
Copy Markdown
Author

@sureshanaparti Any update on this one?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Terraform support for restricting egress firewall rule destinations via a new optional dest_cidr_list attribute, mapping to CloudStack’s destcidrlist API parameter. It also refactors the egress firewall rule read logic to simplify CIDR parsing and protocol handling.

Changes:

  • Add dest_cidr_list to cloudstack_egress_firewall rules and send it via SetDestcidrlist(...) on rule creation.
  • Refactor rule-read logic with a shared cidrSetFromList helper and a protocol-based switch for clearer flow.
  • Update the egress firewall resource documentation example/arguments and extend .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
website/docs/r/egress_firewall.html.markdown Documents dest_cidr_list, updates example usage, and clarifies supported protocols.
cloudstack/resource_cloudstack_egress_firewall.go Implements dest_cidr_list in schema/create/read and refactors CIDR parsing/read flow.
.gitignore Ignores .worktrees/ and .env.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +73 to +78
"dest_cidr_list": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
@sudo87
sudo87 requested a review from vishesh92 August 11, 2026 06:40
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.

destcidrlist isn't supported for cloudstack_egress_firewall

5 participants