Skip to content

Commit

Permalink
fix: Trim spaces for vm comment field
Browse files Browse the repository at this point in the history
Fixes: 194
  • Loading branch information
amhn authored and smutel committed Mar 14, 2023
1 parent 67e7628 commit 18ec0e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions netbox/virtualization/resource_netbox_virtualization_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func ResourceNetboxVirtualizationVM() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Default: nil,
StateFunc: util.TrimString,
Description: "Comments for this VM (virtualization module).",
},
"content_type": {
Expand Down
27 changes: 13 additions & 14 deletions netbox/virtualization/resource_netbox_virtualization_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,14 @@ func TestAccNetboxVirtualizationVMMinimalFullMinimal(t *testing.T) {

func testAccCheckNetboxVirtualizationVMConfig(nameSuffix string, resourceFull, extraResources bool) string {
template := `
#resource "netbox_virtualization_cluster_type" "test" {
# name = "test-{{ .namesuffix }}"
# slug = "test-{{ .namesuffix }}"
#}
#resource "netbox_virtualization_cluster" "test" {
# name = "test-{{ .namesuffix }}"
# type_id = netbox_virtualization_cluster_type.test.id
#}
data "netbox_virtualization_cluster" "cluster_test" {
name = "Test Cluster"
resource "netbox_virtualization_cluster_type" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
}
resource "netbox_virtualization_cluster" "test" {
name = "test-{{ .namesuffix }}"
type_id = netbox_virtualization_cluster_type.test.id
}
{{ if eq .extraresources "true" }}
Expand All @@ -129,11 +126,13 @@ func testAccCheckNetboxVirtualizationVMConfig(nameSuffix string, resourceFull, e
resource "netbox_virtualization_vm" "test" {
name = "test-{{ .namesuffix }}"
#cluster_id = netbox_virtualization_cluster.test.id
cluster_id = data.netbox_virtualization_cluster.cluster_test.id
cluster_id = netbox_virtualization_cluster.test.id
{{ if eq .resourcefull "true" }}
comments = "VM created by terraform"
comments = <<-EOT
VM created by terraform
Multiline
EOT
role_id = netbox_dcim_device_role.test.id
platform_id = netbox_dcim_platform.test.id
tenant_id = netbox_tenancy_tenant.test.id
Expand Down

0 comments on commit 18ec0e8

Please sign in to comment.