diff --git a/cmd/migration-tool/transforms.go b/cmd/migration-tool/transforms.go index 849c92360..e3937e31f 100644 --- a/cmd/migration-tool/transforms.go +++ b/cmd/migration-tool/transforms.go @@ -8,39 +8,47 @@ import ( ) // matches block headers, ex: -// resource "metal_project" "fooproject" { -// data "packet_vlan" "foovlan" { +// +// resource "metal_project" "fooproject" { +// data "packet_vlan" "foovlan" { var matchBlockHeader = regexp.MustCompile(`(resource|data)(\s+")(metal|packet)(.*?)`) // matches resource interpolation strings (Terraform v0.11 and earlier), ex: -// device_id = "${metal_device.foodevice.id}" +// +// device_id = "${metal_device.foodevice.id}" var matchResourceInterpolation = regexp.MustCompile(`(.*?)(\${\s*)(metal|packet)(_.*?)`) // matches resource reference (Terraform v0.12+), ex: -// device_id = metal_device.foodevice.id +// +// device_id = metal_device.foodevice.id var matchResourceReference = regexp.MustCompile(`(.*?)(=\s*)(metal|packet)(_.*?)`) // matches resource reference in function, ex: -// cidr_notation = join("/", [cidrhost(metal_reserved_ip_block.fooblock.cidr_notation, 0), "32"]) +// +// cidr_notation = join("/", [cidrhost(metal_reserved_ip_block.fooblock.cidr_notation, 0), "32"]) var matchResourceFunction = regexp.MustCompile(`(.*?)(\(\s*)(metal|packet)(_.*?)`) // matches resource reference in conditional, ex: -// ip_address = "${var.network_type == "public" ? metal_device.foodevice.access_public_ipv4 : metal_device.foodevice.access_private_ipv4}" -// ip_address = var.network_type == "public" ? metal_device.foodevice.access_public_ipv4 : metal_device.foodevice.access_private_ipv4 +// +// ip_address = "${var.network_type == "public" ? metal_device.foodevice.access_public_ipv4 : metal_device.foodevice.access_private_ipv4}" +// ip_address = var.network_type == "public" ? metal_device.foodevice.access_public_ipv4 : metal_device.foodevice.access_private_ipv4 var matchResourceConditional = regexp.MustCompile(`(.*?[:|\?])(\s*)(metal|packet)(_.*?)`) // matches resource reference in for loop,ex: -// toset([for network in metal_device.foodevice.network : network.family]) +// +// toset([for network in metal_device.foodevice.network : network.family]) var matchResourceForLoop = regexp.MustCompile(`(.*?)(in\s*)(metal|packet)(_.*?)`) // matches resource in expression,ex: -// tolist([metal_device.foodevice[*].access_public_ipv4]) -// !metal_ip_attachment.fooattach.public -// totalSpeed = metal_connection.fooconnA.speed + metal_connection.fooconnB.speed +// +// tolist([metal_device.foodevice[*].access_public_ipv4]) +// !metal_ip_attachment.fooattach.public +// totalSpeed = metal_connection.fooconnA.speed + metal_connection.fooconnB.speed var matchResourceExpression = regexp.MustCompile(`(.*?[\+|-|\*|\/|>|<|&|\|\||%|!|\[]\s*)(metal|packet)(_.*?)`) // matches datasource references, ex: -// address_family = "${lookup(data.packet_device_bgp_neighbors.test.bgp_neighbors[0], "address_family")}" +// +// address_family = "${lookup(data.packet_device_bgp_neighbors.test.bgp_neighbors[0], "address_family")}" var matchDatasourceReference = regexp.MustCompile(`(.*?data)(\.)(metal|packet)(_.*?)`) // replace specific string patterns in template files diff --git a/equinix/resource_metal_connection_acc_test.go b/equinix/resource_metal_connection_acc_test.go index af00b3be5..45cb754b4 100644 --- a/equinix/resource_metal_connection_acc_test.go +++ b/equinix/resource_metal_connection_acc_test.go @@ -113,7 +113,6 @@ func TestAccMetalConnection_shared_zside(t *testing.T) { }, }) - } func TestAccMetalConnection_shared(t *testing.T) { diff --git a/equinix/resource_network_bgp.go b/equinix/resource_network_bgp.go index cbd6fbae8..f8a068bdd 100644 --- a/equinix/resource_network_bgp.go +++ b/equinix/resource_network_bgp.go @@ -47,7 +47,7 @@ func resourceNetworkBGP() *schema.Resource { UpdateContext: resourceNetworkBGPUpdate, DeleteContext: resourceNetworkBGPDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: createNetworkBGPResourceSchema(), Timeouts: &schema.ResourceTimeout{ diff --git a/equinix/resource_network_device.go b/equinix/resource_network_device.go index bdefb4b56..cf9549fee 100644 --- a/equinix/resource_network_device.go +++ b/equinix/resource_network_device.go @@ -198,7 +198,7 @@ func resourceNetworkDevice() *schema.Resource { UpdateContext: resourceNetworkDeviceUpdate, DeleteContext: resourceNetworkDeviceDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: createNetworkDeviceSchema(), Timeouts: &schema.ResourceTimeout{ diff --git a/equinix/resource_network_device_link.go b/equinix/resource_network_device_link.go index ac77036c9..4b3097032 100644 --- a/equinix/resource_network_device_link.go +++ b/equinix/resource_network_device_link.go @@ -79,7 +79,7 @@ func resourceNetworkDeviceLink() *schema.Resource { UpdateContext: resourceNetworkDeviceLinkUpdate, DeleteContext: resourceNetworkDeviceLinkDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: createNetworkDeviceLinkResourceSchema(), Timeouts: &schema.ResourceTimeout{ diff --git a/equinix/resource_network_ssh_key.go b/equinix/resource_network_ssh_key.go index 788e0efe8..22d883070 100644 --- a/equinix/resource_network_ssh_key.go +++ b/equinix/resource_network_ssh_key.go @@ -33,7 +33,7 @@ func resourceNetworkSSHKey() *schema.Resource { ReadContext: resourceNetworkSSHKeyRead, DeleteContext: resourceNetworkSSHKeyDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: createNetworkSSHKeyResourceSchema(), Timeouts: &schema.ResourceTimeout{