Skip to content
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

CP-49724 Implement xenserver_network provider resource #16

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

acefei
Copy link
Member

@acefei acefei commented Jun 12, 2024

source .env && TF_ACC=1 go test ./xenserver/ -v   -timeout 120m
=== RUN   TestAccNetworkResource
--- PASS: TestAccNetworkResource (54.00s)
=== RUN   TestAccPifDataSource
--- PASS: TestAccPifDataSource (20.26s)
=== RUN   TestAccSRDataSource
--- PASS: TestAccSRDataSource (18.06s)
=== RUN   TestAccVMResource
--- PASS: TestAccVMResource (57.10s)
PASS
ok      terraform-provider-xenserver/xenserver  149.444s
$make apply
...
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create

Terraform will perform the following actions:

  # xenserver_network.network will be created
  + resource "xenserver_network" "network" {
      + id               = (known after apply)
      + name_label       = "Network of VM"
      + other_config     = {}
        # (1 unchanged attribute hidden)
    }

  # xenserver_vm.vm will be created
  + resource "xenserver_vm" "vm" {
      + id            = (known after apply)
      + name_label    = "Test CentOS VM"
      + other_config  = {
          + "flag" = "1"
        }
      + snapshots     = (known after apply)
      + template_name = "CentOS 7"
    }

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

Changes to Outputs:
  + network_out  = (known after apply)
  + pif_data_out = {
      + device     = "eth0"
      + management = true
      + network    = "d9e981a6-7251-8794-7bbd-acb8662b9633"
    }
  + vm_out       = {
      + id            = (known after apply)
      + name_label    = "Test CentOS VM"
      + other_config  = {
          + flag = "1"
        }
      + snapshots     = (known after apply)
      + template_name = "CentOS 7"
    }
xenserver_vm.vm: Creating...
xenserver_network.network: Creating...
xenserver_network.network: Creation complete after 2s [id=504d2d5b-ca73-01a4-3735-69522e16995b]
xenserver_vm.vm: Creation complete after 2s [id=1913bddd-c718-246b-057a-4137328c11cc]

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

Outputs:

network_out = "504d2d5b-ca73-01a4-3735-69522e16995b"
pif_data_out = {
  "device" = "eth0"
  "management" = true
  "network" = "d9e981a6-7251-8794-7bbd-acb8662b9633"
}
vm_out = {
  "id" = "1913bddd-c718-246b-057a-4137328c11cc"
  "name_label" = "Test CentOS VM"
  "other_config" = tomap({
    "flag" = "1"
  })
  "snapshots" = tolist([])
  "template_name" = "CentOS 7"
}
$make import resource=xenserver_network.network id=504d2d5b-ca73-01a4-3735-69522e16995b
xenserver_network.network: Importing from ID "504d2d5b-ca73-01a4-3735-69522e16995b"...
data.xenserver_pif.pif_data: Reading...
xenserver_network.network: Import prepared!
  Prepared xenserver_network for import
xenserver_network.network: Refreshing state... [id=504d2d5b-ca73-01a4-3735-69522e16995b]
data.xenserver_pif.pif_data: Read complete after 0s

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 used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # xenserver_network.network will be updated in-place
  ~ resource "xenserver_network" "network" {
        id               = "504d2d5b-ca73-01a4-3735-69522e16995b"
      ~ name_label       = "Network of VM" -> "Network of VM 1"
        # (2 unchanged attributes hidden)
    }

  # xenserver_vm.vm will be created
  + resource "xenserver_vm" "vm" {
      + id            = (known after apply)
      + name_label    = "Test CentOS VM"
      + other_config  = {
          + "flag" = "1"
        }
      + snapshots     = (known after apply)
      + template_name = "CentOS 7"
    }

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

Changes to Outputs:
  + vm_out       = {
      + id            = (known after apply)
      + name_label    = "Test CentOS VM"
      + other_config  = {
          + flag = "1"
        }
      + snapshots     = (known after apply)
      + template_name = "CentOS 7"
    }
xenserver_vm.vm: Creating...
xenserver_network.network: Modifying... [id=504d2d5b-ca73-01a4-3735-69522e16995b]
xenserver_network.network: Modifications complete after 2s [id=504d2d5b-ca73-01a4-3735-69522e16995b]
xenserver_vm.vm: Creation complete after 2s [id=1bc08df5-4233-c1df-851c-d7bf7660a4c0]

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

Outputs:

network_out = "504d2d5b-ca73-01a4-3735-69522e16995b"
pif_data_out = {
  "device" = "eth0"
  "management" = true
  "network" = "d9e981a6-7251-8794-7bbd-acb8662b9633"
}
vm_out = {
  "id" = "1bc08df5-4233-c1df-851c-d7bf7660a4c0"
  "name_label" = "Test CentOS VM"
  "other_config" = tomap({
    "flag" = "1"
  })
  "snapshots" = tolist([])
  "template_name" = "CentOS 7"
}

@acefei acefei requested a review from xueqingz June 12, 2024 10:17
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_utils.go Show resolved Hide resolved
xenserver/network_resource.go Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
examples/terraform-main/main.tf Outdated Show resolved Hide resolved
@acefei acefei force-pushed the private/feis/CP-49382 branch 2 times, most recently from 25c42a3 to 365bd5f Compare June 13, 2024 06:29
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
xenserver/network_resource.go Show resolved Hide resolved
xenserver/network_utils.go Show resolved Hide resolved
xenserver/network_resource.go Outdated Show resolved Hide resolved
@acefei acefei force-pushed the private/feis/CP-49382 branch 3 times, most recently from d199386 to 8e5db3d Compare June 14, 2024 10:04
GNUmakefile Show resolved Hide resolved
@acefei acefei force-pushed the private/feis/CP-49382 branch 2 times, most recently from 7f79d7b to 4394eb4 Compare June 18, 2024 06:22
@acefei acefei force-pushed the private/feis/CP-49382 branch from 4394eb4 to 6e1ccec Compare June 18, 2024 06:53
@acefei acefei merged commit c3ccaed into xenserver:master Jun 18, 2024
2 checks passed
@acefei acefei deleted the private/feis/CP-49382 branch June 18, 2024 07:14
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.

3 participants