Skip to content

Add cloudstack_physicalnetwork and some underlying additional resources #201

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ianc769
Copy link

@ianc769 ianc769 commented Aug 18, 2025

Adding cloudstack_physicalnetwork , cloudstack_traffic_type and cloudstack_physicalnetwork as terraform managed resource options:

cloudstack_physicalnetwork -> https://cloudstack.apache.org/api/apidocs-4.20/apis/createPhysicalNetwork.html

cloudstack_traffic_type -> https://cloudstack.apache.org/api/apidocs-4.20/apis/addTrafficType.html

cloudstack_network_service_provider -> https://cloudstack.apache.org/api/apidocs-4.20/apis/addNetworkServiceProvider.html

Using this code for example:

resource "cloudstack_zone" "foo" {
  name          = "terraform-zone"
  dns1          = "8.8.8.8"
  internal_dns1 = "8.8.4.4"
  network_type  = "Advanced"
}

resource "cloudstack_physicalnetwork" "foo" {
  name                   = "terraform-physical-network"
  zone                   = cloudstack_zone.foo.name
  broadcast_domain_range = "ZONE"
  isolation_methods      = ["VLAN"]
}

resource "cloudstack_traffic_type" "foo" {
  physical_network_id = cloudstack_physicalnetwork.foo.id
  type                = "Management"
  kvm_network_label   = "cloudbr0"
}

resource "cloudstack_network_service_provider" "securitygroup" {
  name                = "SecurityGroupProvider"
  physical_network_id = cloudstack_physicalnetwork.foo.id
  state               = "Enabled"
}
  # cloudstack_network_service_provider.securitygroup will be created
  + resource "cloudstack_network_service_provider" "securitygroup" {
      + id                  = (known after apply)
      + name                = "SecurityGroupProvider"
      + physical_network_id = (known after apply)
      + state               = "Enabled"
    }

  # cloudstack_physicalnetwork.foo will be created
  + resource "cloudstack_physicalnetwork" "foo" {
      + broadcast_domain_range = "ZONE"
      + id                     = (known after apply)
      + isolation_methods      = [
          + "VLAN",
        ]
      + name                   = "terraform-physical-network"
      + zone                   = "terraform-zone"
    }

  # cloudstack_traffic_type.foo will be created
  + resource "cloudstack_traffic_type" "foo" {
      + id                  = (known after apply)
      + kvm_network_label   = "cloudbr0"
      + physical_network_id = (known after apply)
      + type                = "Management"
    }

  # cloudstack_zone.foo will be created
  + resource "cloudstack_zone" "foo" {
      + allocationstate = (known after apply)
      + dns1            = "8.8.8.8"
      + id              = (known after apply)
      + internal_dns1   = "8.8.4.4"
      + name            = "terraform-zone"
      + network_type    = "Advanced"
    }

Plan: 4 to add, 0 to change, 0 to destroy.

cloudstack_zone.foo: Creating...
cloudstack_zone.foo: Creation complete after 1s [id=da8a5cb8-3dbf-4c9d-9fe6-f28a8a00f7ed]
cloudstack_physicalnetwork.foo: Creating...
cloudstack_physicalnetwork.foo: Creation complete after 1s [id=bc5ff5dc-28a5-4dcf-b14c-af176a3fdc45]
cloudstack_network_service_provider.securitygroup: Creating...
cloudstack_traffic_type.foo: Creating...
cloudstack_traffic_type.foo: Creation complete after 1s [id=ff508483-8ee7-4a7b-b62a-4f22cb36c937]
cloudstack_network_service_provider.securitygroup: Creation complete after 1s [id=5be9b3d5-612a-42b0-8d8d-8d4f534437d0]

Apply complete! Resources: 4 added, 0 changed, 0 destroyed.

ianc769 added 3 commits July 28, 2025 10:28
- Implement data source for cloudstack_physicalnetwork to retrieve physical network details.
- Create resource for managing cloudstack_physicalnetwork, including CRUD operations.
- Add tests for both data source and resource functionalities.
- Update documentation for cloudstack_physicalnetwork data source and resource.
@kiranchavala kiranchavala added this to the v0.6.0 milestone Aug 19, 2025
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.

2 participants