Add support to import ACL rules by ACL id#224
Merged
kiranchavala merged 3 commits intomainfrom Sep 23, 2025
Merged
Conversation
kiranchavala
approved these changes
Sep 22, 2025
Member
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM, Tested manually
TF_LOG=DEBUG terraform import cloudstack_network_acl_rule.default 44d043fa-3a87-4c20-8462-28099ba1920e
2025-09-22T12:56:31.776+0530 [INFO] Terraform version: 1.12.1
2025-09-22T12:56:31.777+0530 [DEBUG] using github.com/hashicorp/go-tfe v1.74.1
2025-09-22T12:56:31.777+0530 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.1-0.20250203194505-ba0759438da2
2025-09-22T12:56:31.777+0530 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-09-22T12:56:31.777+0530 [DEBUG] using github.com/zclconf/go-cty v1.16.2
2025-09-22T12:56:31.777+0530 [INFO] Go runtime version: go1.24.2
2025-09-22T12:56:31.777+0530 [INFO] CLI args: []string{"terraform", "import", "cloudstack_network_acl_rule.default", "44d043fa-3a87-4c20-8462-28099ba1920e"}
2025-09-22T12:56:31.777+0530 [DEBUG] Attempting to open CLI config file: /Users/kiranchavala/.terraformrc
2025-09-22T12:56:31.777+0530 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2025-09-22T12:56:31.777+0530 [DEBUG] checking for credentials in "/Users/kiranchavala/.terraform.d/plugins"
2025-09-22T12:56:31.777+0530 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2025-09-22T12:56:31.777+0530 [DEBUG] will search for provider plugins in /Users/kiranchavala/.terraform.d/plugins
2025-09-22T12:56:31.778+0530 [DEBUG] ignoring non-existing provider search directory /Users/kiranchavala/Library/Application Support/io.terraform/plugins
2025-09-22T12:56:31.778+0530 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2025-09-22T12:56:31.780+0530 [INFO] CLI command args: []string{"import", "cloudstack_network_acl_rule.default", "44d043fa-3a87-4c20-8462-28099ba1920e"}
2025-09-22T12:56:31.845+0530 [DEBUG] checking for provisioner in "."
2025-09-22T12:56:31.848+0530 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2025-09-22T12:56:31.848+0530 [DEBUG] checking for provisioner in "/Users/kiranchavala/.terraform.d/plugins"
2025-09-22T12:56:31.856+0530 [DEBUG] Building and walking import graph
2025-09-22T12:56:31.858+0530 [DEBUG] Not attaching any node states: overall state is nil
2025-09-22T12:56:31.858+0530 [DEBUG] No state, no orphan outputs
2025-09-22T12:56:31.858+0530 [DEBUG] ProviderTransformer: "cloudstack_network_acl_rule.default (expand)" (*terraform.nodeExpandPlannableResource) needs provider["localdomain/provider/cloudstack"]
2025-09-22T12:56:31.859+0530 [DEBUG] created provider logger: level=debug
2025-09-22T12:56:31.859+0530 [INFO] provider: configuring client automatic mTLS
2025-09-22T12:56:31.874+0530 [DEBUG] provider: starting plugin: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack args=[".terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack"]
2025-09-22T12:56:31.876+0530 [DEBUG] provider: plugin started: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack pid=73179
2025-09-22T12:56:31.876+0530 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack
2025-09-22T12:56:31.898+0530 [INFO] provider.terraform-provider-cloudstack: configuring server automatic mTLS: timestamp="2025-09-22T12:56:31.897+0530"
2025-09-22T12:56:31.907+0530 [DEBUG] provider.terraform-provider-cloudstack: plugin address: address=/var/folders/2f/6r19_y2s5p92vdzq4l29n0lr0000gn/T/plugin3546309284 network=unix timestamp="2025-09-22T12:56:31.907+0530"
2025-09-22T12:56:31.907+0530 [DEBUG] provider: using plugin: version=6
2025-09-22T12:56:31.931+0530 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-09-22T12:56:31.931+0530 [INFO] provider: plugin process exited: plugin=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack id=73179
2025-09-22T12:56:31.932+0530 [DEBUG] provider: plugin exited
2025-09-22T12:56:31.932+0530 [DEBUG] ReferenceTransformer: "var.cloudstack_secret_key" references: []
2025-09-22T12:56:31.932+0530 [DEBUG] ReferenceTransformer: "var.cloudstack_api_url" references: []
2025-09-22T12:56:31.932+0530 [DEBUG] ReferenceTransformer: "provider[\"localdomain/provider/cloudstack\"]" references: [var.cloudstack_secret_key var.cloudstack_api_key var.cloudstack_api_url]
2025-09-22T12:56:31.932+0530 [DEBUG] ReferenceTransformer: "cloudstack_network_acl_rule.default (expand)" references: []
2025-09-22T12:56:31.932+0530 [DEBUG] ReferenceTransformer: "var.cloudstack_api_key" references: []
2025-09-22T12:56:31.933+0530 [DEBUG] Starting graph walk: walkImport
2025-09-22T12:56:31.937+0530 [DEBUG] created provider logger: level=debug
2025-09-22T12:56:31.937+0530 [INFO] provider: configuring client automatic mTLS
2025-09-22T12:56:31.942+0530 [DEBUG] provider: starting plugin: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack args=[".terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack"]
2025-09-22T12:56:31.944+0530 [DEBUG] provider: plugin started: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack pid=73180
2025-09-22T12:56:31.944+0530 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack
2025-09-22T12:56:31.954+0530 [INFO] provider.terraform-provider-cloudstack: configuring server automatic mTLS: timestamp="2025-09-22T12:56:31.954+0530"
2025-09-22T12:56:31.964+0530 [DEBUG] provider: using plugin: version=6
2025-09-22T12:56:31.964+0530 [DEBUG] provider.terraform-provider-cloudstack: plugin address: address=/var/folders/2f/6r19_y2s5p92vdzq4l29n0lr0000gn/T/plugin2909772851 network=unix timestamp="2025-09-22T12:56:31.964+0530"
2025-09-22T12:56:31.979+0530 [DEBUG] ReferenceTransformer: "cloudstack_network_acl_rule.default (import id \"44d043fa-3a87-4c20-8462-28099ba1920e\")" references: []
cloudstack_network_acl_rule.default: Importing from ID "44d043fa-3a87-4c20-8462-28099ba1920e"...
2025-09-22T12:56:31.980+0530 [DEBUG] provider.terraform-provider-cloudstack: 2025/09/22 12:56:31 [DEBUG] Attempting to import ACL list with ID: 44d043fa-3a87-4c20-8462-28099ba1920e
2025-09-22T12:56:31.980+0530 [DEBUG] provider.terraform-provider-cloudstack: 2025/09/22 12:56:31 [DEBUG] Checking if ACL list exists: 44d043fa-3a87-4c20-8462-28099ba1920e
2025-09-22T12:56:32.523+0530 [DEBUG] provider.terraform-provider-cloudstack: 2025/09/22 12:56:32 [DEBUG] ACL list check result: count=1
2025-09-22T12:56:32.523+0530 [DEBUG] provider.terraform-provider-cloudstack: 2025/09/22 12:56:32 [DEBUG] Found ACL list with ID: 44d043fa-3a87-4c20-8462-28099ba1920e
2025-09-22T12:56:32.523+0530 [DEBUG] provider.terraform-provider-cloudstack: 2025/09/22 12:56:32 [DEBUG] Setting managed=true for ACL list import
cloudstack_network_acl_rule.default: Import prepared!
Prepared cloudstack_network_acl_rule for import
cloudstack_network_acl_rule.default: Refreshing state... [id=44d043fa-3a87-4c20-8462-28099ba1920e]
2025-09-22T12:56:33.075+0530 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-09-22T12:56:33.077+0530 [INFO] provider: plugin process exited: plugin=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack id=73180
2025-09-22T12:56:33.077+0530 [DEBUG] provider: plugin exited
2025-09-22T12:56:33.077+0530 [INFO] Writing state output to:
Member
|
@Pearl1594 can you add small documentation similar to network_acl |
Contributor
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, but add some unit-test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resource "cloudstack_network_acl_rule" "customAclRules" {
}
Where
6efef584-d405-41f7-92a0-a66625496c97is the UUID of the ACL from which the rules need to be importedterraform showand find the ACL rules now managed by terraform:Logs that the resource is successfully imported:
Did the same for project level - works as expected.