cloudstack-terraform-provider
cloudstack-terraform-provider copied to clipboard
Fix traffic type import due to incorrect parameter
This fix depends on : https://github.com/apache/cloudstack/pull/11875 https://github.com/apache/cloudstack-go/pull/127
To test it - update the go.mod with the following:
replace github.com/apache/cloudstack-go/v2 => <path_to_local_clone_of_cloudstack_go checked out to the fix>
Test performed
main.tf
resource "cloudstack_traffic_type" "management" {
physical_network_id = "03144da8-ecc6-4830-9d63-cce2f8aa2156"
traffic_type = "Management"
# Optional network labels - these will be set to defaults during import
kvm_network_label = "cloudbr0"
}
resource "cloudstack_traffic_type" "public" {
physical_network_id = "81d12fe1-3e62-406e-85f3-fc0df51553a0"
traffic_type = "Public"
kvm_network_label = "cloudbr1"
}
resource "cloudstack_traffic_type" "guest" {
physical_network_id = "81d12fe1-3e62-406e-85f3-fc0df51553a0"
traffic_type = "Guest"
kvm_network_label = "cloudbr1"
}
terraform imports
$ terraform import cloudstack_traffic_type.management df60cacc-a9eb-4e33-9a4e-84c8458ea076
cloudstack_traffic_type.management: Importing from ID "df60cacc-a9eb-4e33-9a4e-84c8458ea076"...
cloudstack_traffic_type.management: Import prepared!
Prepared cloudstack_traffic_type for import
cloudstack_traffic_type.management: Refreshing state... [id=df60cacc-a9eb-4e33-9a4e-84c8458ea076]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform import cloudstack_traffic_type.guest 20c3d446-0c87-4123-a399-0b56b00f9908
cloudstack_traffic_type.guest: Importing from ID "20c3d446-0c87-4123-a399-0b56b00f9908"...
cloudstack_traffic_type.guest: Import prepared!
Prepared cloudstack_traffic_type for import
cloudstack_traffic_type.guest: Refreshing state... [id=20c3d446-0c87-4123-a399-0b56b00f9908]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform import cloudstack_traffic_type.public 51ca4720-1f6c-4044-ad98-87adc3f15ef4
cloudstack_traffic_type.public: Importing from ID "51ca4720-1f6c-4044-ad98-87adc3f15ef4"...
cloudstack_traffic_type.public: Import prepared!
Prepared cloudstack_traffic_type for import
cloudstack_traffic_type.public: Refreshing state... [id=51ca4720-1f6c-4044-ad98-87adc3f15ef4]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
terraform state: post import
$ terraform show
# cloudstack_traffic_type.guest:
resource "cloudstack_traffic_type" "guest" {
id = "20c3d446-0c87-4123-a399-0b56b00f9908"
kvm_network_label = "cloudbr0"
physical_network_id = "81d12fe1-3e62-406e-85f3-fc0df51553a0"
traffic_type = "Guest"
xen_network_label = "xenbr0"
}
# cloudstack_traffic_type.management:
resource "cloudstack_traffic_type" "management" {
id = "df60cacc-a9eb-4e33-9a4e-84c8458ea076"
kvm_network_label = "cloudbr0"
physical_network_id = "03144da8-ecc6-4830-9d63-cce2f8aa2156"
traffic_type = "Management"
xen_network_label = "xenbr0"
}
# cloudstack_traffic_type.public:
resource "cloudstack_traffic_type" "public" {
id = "51ca4720-1f6c-4044-ad98-87adc3f15ef4"
kvm_network_label = "cloudbr0"
physical_network_id = "81d12fe1-3e62-406e-85f3-fc0df51553a0"
traffic_type = "Public"
xen_network_label = "xenbr0"
}