Skip to content

Add import support to network rule resources#4

Open
msinhore wants to merge 1 commit into
mainfrom
feature/network-rule-import
Open

Add import support to network rule resources#4
msinhore wants to merge 1 commit into
mainfrom
feature/network-rule-import

Conversation

@msinhore

Copy link
Copy Markdown

What

Adds a passthrough Importer (same pattern as affinity_group / disk) so existing rules can be adopted with terraform import / import blocks:

  • cloudstack_ipaddress — id = public IP id
  • cloudstack_loadbalancer_rule — id = LB rule id
  • cloudstack_port_forward — id = the IP address id (Read lists that IP's forwards)
  • cloudstack_static_nat — id = the IP address id (Read checks static NAT on it)

All four Read functions are already id-driven, so the passthrough importer fully populates state.

Why

Enables adopting existing public-IP/LB/PF/static-NAT rules into Terraform state (reverse-engineering / brownfield workflows) without destroy/recreate.

🤖 Generated with Claude Code

Adds a passthrough Importer (same pattern as affinity_group and disk) so
existing rules can be adopted with `terraform import` / import blocks:

- cloudstack_ipaddress         (id = public IP id)
- cloudstack_loadbalancer_rule (id = LB rule id)
- cloudstack_port_forward      (id = the IP address id; Read lists its forwards)
- cloudstack_static_nat        (id = the IP address id; Read checks static NAT)

All four Read functions are already id-driven, so no further changes are
required for import to populate state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Marco Sinhoreli <msinhore@gmail.com>
@msinhore

Copy link
Copy Markdown
Author

Note for reviewers: the OpenTofu acceptance jobs here are red due to a pre-existing CI bug (expired HashiCorp signing key in hc-install), not this change — fixed by #5. build, RAT and the Terraform matrix pass. Please merge #5 first, then re-run; the OpenTofu matrix will go green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant