diff --git a/internal/api_client/cloud_builder_client.go b/internal/api_client/cloud_builder_client.go index 07e6977..1dcf1d0 100644 --- a/internal/api_client/cloud_builder_client.go +++ b/internal/api_client/cloud_builder_client.go @@ -5,10 +5,11 @@ package api_client import ( "crypto/tls" + "net/http" + openapiclient "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" vcfclient "github.com/vmware/vcf-sdk-go/client" - "net/http" ) // CloudBuilderClient is an API client that can execute the APIs of the CloudBuilder appliance. diff --git a/internal/api_client/sddc_manager_client.go b/internal/api_client/sddc_manager_client.go index 50ad25b..724c31c 100644 --- a/internal/api_client/sddc_manager_client.go +++ b/internal/api_client/sddc_manager_client.go @@ -8,12 +8,6 @@ import ( "crypto/tls" "errors" "fmt" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/vmware/terraform-provider-vcf/internal/constants" - "github.com/vmware/vcf-sdk-go/client/tasks" - "github.com/vmware/vcf-sdk-go/client/tokens" - "github.com/vmware/vcf-sdk-go/models" - "golang.org/x/exp/slices" "log" "net/http" "strings" @@ -21,7 +15,14 @@ import ( openapiclient "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + "github.com/hashicorp/terraform-plugin-log/tflog" vcfclient "github.com/vmware/vcf-sdk-go/client" + "github.com/vmware/vcf-sdk-go/client/tasks" + "github.com/vmware/vcf-sdk-go/client/tokens" + "github.com/vmware/vcf-sdk-go/models" + "golang.org/x/exp/slices" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) // SddcManagerClient model that represents properties to authenticate against VCF instance. diff --git a/internal/certificates/certificate_operations.go b/internal/certificates/certificate_operations.go index 043acef..74b181a 100644 --- a/internal/certificates/certificate_operations.go +++ b/internal/certificates/certificate_operations.go @@ -5,14 +5,16 @@ package certificates import ( "context" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/vmware/terraform-provider-vcf/internal/api_client" - "github.com/vmware/terraform-provider-vcf/internal/constants" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" vcfclient "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/certificates" "github.com/vmware/vcf-sdk-go/models" - "time" + + "github.com/vmware/terraform-provider-vcf/internal/api_client" + "github.com/vmware/terraform-provider-vcf/internal/constants" + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) func ValidateResourceCertificates(ctx context.Context, client *vcfclient.VcfClient, diff --git a/internal/cluster/cluster_operations.go b/internal/cluster/cluster_operations.go index c2f4c95..e29af1e 100644 --- a/internal/cluster/cluster_operations.go +++ b/internal/cluster/cluster_operations.go @@ -6,19 +6,21 @@ package cluster import ( "context" "fmt" + "sort" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/terraform-provider-vcf/internal/constants" - "github.com/vmware/terraform-provider-vcf/internal/datastores" - "github.com/vmware/terraform-provider-vcf/internal/network" - "github.com/vmware/terraform-provider-vcf/internal/resource_utils" - validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/clusters" "github.com/vmware/vcf-sdk-go/client/domains" "github.com/vmware/vcf-sdk-go/client/hosts" "github.com/vmware/vcf-sdk-go/models" - "sort" + + "github.com/vmware/terraform-provider-vcf/internal/constants" + "github.com/vmware/terraform-provider-vcf/internal/datastores" + "github.com/vmware/terraform-provider-vcf/internal/network" + "github.com/vmware/terraform-provider-vcf/internal/resource_utils" + validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" ) func CreateClusterUpdateSpec(data *schema.ResourceData, markForDeletion bool) (*models.ClusterUpdateSpec, error) { diff --git a/internal/cluster/host_spec_subresource.go b/internal/cluster/host_spec_subresource.go index 0701519..8dd5fc2 100644 --- a/internal/cluster/host_spec_subresource.go +++ b/internal/cluster/host_spec_subresource.go @@ -5,11 +5,13 @@ package cluster import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/network" validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) // HostSpecSchema this helper function extracts the Host diff --git a/internal/credentials/credential_operations.go b/internal/credentials/credential_operations.go index 855750d..3e9de7e 100644 --- a/internal/credentials/credential_operations.go +++ b/internal/credentials/credential_operations.go @@ -13,10 +13,11 @@ import ( "github.com/go-openapi/strfmt" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/credentials" "github.com/vmware/vcf-sdk-go/models" + + "github.com/vmware/terraform-provider-vcf/internal/api_client" ) func ReadCredentials(ctx context.Context, data *schema.ResourceData, apiClient *client.VcfClient) ([]*models.Credential, error) { diff --git a/internal/datastores/nfs_datastore_subresource.go b/internal/datastores/nfs_datastore_subresource.go index 35058a8..2088a5b 100644 --- a/internal/datastores/nfs_datastore_subresource.go +++ b/internal/datastores/nfs_datastore_subresource.go @@ -5,10 +5,12 @@ package datastores import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // NfsDatastoreSchema this helper function extracts the NFS Datastore schema, so that diff --git a/internal/datastores/vmfs_datastore_subresource.go b/internal/datastores/vmfs_datastore_subresource.go index 32541eb..bb9c1cd 100644 --- a/internal/datastores/vmfs_datastore_subresource.go +++ b/internal/datastores/vmfs_datastore_subresource.go @@ -5,6 +5,7 @@ package datastores import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vcf-sdk-go/models" ) diff --git a/internal/datastores/vsan_datastore_subresource.go b/internal/datastores/vsan_datastore_subresource.go index 51b7334..2f5befc 100644 --- a/internal/datastores/vsan_datastore_subresource.go +++ b/internal/datastores/vsan_datastore_subresource.go @@ -5,10 +5,12 @@ package datastores import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // VsanDatastoreSchema this helper function extracts the vSAN Datastore schema, so that diff --git a/internal/datastores/vsan_remote_datastore_cluster_subresource.go b/internal/datastores/vsan_remote_datastore_cluster_subresource.go index aab57b7..8cb3a83 100644 --- a/internal/datastores/vsan_remote_datastore_cluster_subresource.go +++ b/internal/datastores/vsan_remote_datastore_cluster_subresource.go @@ -5,6 +5,7 @@ package datastores import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vcf-sdk-go/models" ) diff --git a/internal/datastores/vvol_datastore_subresource.go b/internal/datastores/vvol_datastore_subresource.go index b522e30..9afb148 100644 --- a/internal/datastores/vvol_datastore_subresource.go +++ b/internal/datastores/vvol_datastore_subresource.go @@ -5,10 +5,11 @@ package datastores import ( "fmt" + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vcf-sdk-go/models" - "strings" ) // VvolDatastoreSchema this helper function extracts the VVOL Datastore schema, so that diff --git a/internal/domain/domain_operations.go b/internal/domain/domain_operations.go index e1a9b9c..f5aeb47 100644 --- a/internal/domain/domain_operations.go +++ b/internal/domain/domain_operations.go @@ -6,17 +6,19 @@ package domain import ( "context" "fmt" + "sort" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/vcf-sdk-go/client" + "github.com/vmware/vcf-sdk-go/client/clusters" + "github.com/vmware/vcf-sdk-go/client/domains" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/cluster" "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/terraform-provider-vcf/internal/network" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/terraform-provider-vcf/internal/vcenter" - "github.com/vmware/vcf-sdk-go/client" - "github.com/vmware/vcf-sdk-go/client/clusters" - "github.com/vmware/vcf-sdk-go/client/domains" - "github.com/vmware/vcf-sdk-go/models" - "sort" ) func CreateDomainCreationSpec(data *schema.ResourceData) (*models.DomainCreationSpec, error) { diff --git a/internal/network/ip_address_pool_subresource.go b/internal/network/ip_address_pool_subresource.go index e5a70b5..7bc2ddb 100644 --- a/internal/network/ip_address_pool_subresource.go +++ b/internal/network/ip_address_pool_subresource.go @@ -5,10 +5,12 @@ package network import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // IpAddressPoolSchema this helper function extracts the IpAddressPoolSpec schema, which diff --git a/internal/network/nioc_bandwidth_allocation_subresource.go b/internal/network/nioc_bandwidth_allocation_subresource.go index b8d6a20..b8afb12 100644 --- a/internal/network/nioc_bandwidth_allocation_subresource.go +++ b/internal/network/nioc_bandwidth_allocation_subresource.go @@ -5,11 +5,13 @@ package network import ( "fmt" + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" - "strings" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // NiocBandwidthAllocationSchema this helper function extracts the NiocBandwidthAllocation diff --git a/internal/network/nsx_manager_subresource.go b/internal/network/nsx_manager_subresource.go index 234c902..8fec74a 100644 --- a/internal/network/nsx_manager_subresource.go +++ b/internal/network/nsx_manager_subresource.go @@ -5,10 +5,12 @@ package network import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // NsxManagerNodeSchema this helper function extracts the NSX Manager Node schema, which contains diff --git a/internal/network/nsx_subresource.go b/internal/network/nsx_subresource.go index a389d24..a632492 100644 --- a/internal/network/nsx_subresource.go +++ b/internal/network/nsx_subresource.go @@ -6,15 +6,17 @@ package network import ( "context" "fmt" + "sort" + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/terraform-provider-vcf/internal/constants" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/nsxt_clusters" "github.com/vmware/vcf-sdk-go/models" - "sort" - "strings" + + "github.com/vmware/terraform-provider-vcf/internal/constants" + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // NsxSchema this helper function extracts the NSX schema, which diff --git a/internal/network/portgroup_subresource.go b/internal/network/portgroup_subresource.go index 8a49692..d9e3418 100644 --- a/internal/network/portgroup_subresource.go +++ b/internal/network/portgroup_subresource.go @@ -5,11 +5,13 @@ package network import ( "fmt" + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" - "strings" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // PortgroupSchema this helper function extracts the Portgroup Schema, so that diff --git a/internal/network/vds_subresource.go b/internal/network/vds_subresource.go index 00ec2d6..532730a 100644 --- a/internal/network/vds_subresource.go +++ b/internal/network/vds_subresource.go @@ -5,10 +5,12 @@ package network import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // VdsSchema this helper function extracts the VDS Schema, so that diff --git a/internal/network/vmnic_subresource.go b/internal/network/vmnic_subresource.go index 8c75b8e..89c4d84 100644 --- a/internal/network/vmnic_subresource.go +++ b/internal/network/vmnic_subresource.go @@ -5,10 +5,12 @@ package network import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + validationutils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // VMNicSchema this helper function extracts the VMNic Schema, so that diff --git a/internal/nsx_edge_cluster/edge_cluster_operations.go b/internal/nsx_edge_cluster/edge_cluster_operations.go index 0f0494c..eeb7e3a 100644 --- a/internal/nsx_edge_cluster/edge_cluster_operations.go +++ b/internal/nsx_edge_cluster/edge_cluster_operations.go @@ -6,12 +6,14 @@ package nsx_edge_cluster import ( "errors" "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/terraform-provider-vcf/internal/constants" - "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/clusters" "github.com/vmware/vcf-sdk-go/models" + + "github.com/vmware/terraform-provider-vcf/internal/constants" + "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) const ( diff --git a/internal/nsx_edge_cluster/edge_node_subresource.go b/internal/nsx_edge_cluster/edge_node_subresource.go index 41d9c71..b896a17 100644 --- a/internal/nsx_edge_cluster/edge_node_subresource.go +++ b/internal/nsx_edge_cluster/edge_node_subresource.go @@ -4,10 +4,12 @@ package nsx_edge_cluster import ( + "math" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "math" ) func EdgeNodeSchema() *schema.Resource { diff --git a/internal/provider/data_credentials.go b/internal/provider/data_credentials.go index 188b345..bb7ab4f 100644 --- a/internal/provider/data_credentials.go +++ b/internal/provider/data_credentials.go @@ -5,12 +5,14 @@ package provider import ( "context" + "strconv" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/credentials" - "strconv" ) func DataSourceCredentials() *schema.Resource { diff --git a/internal/provider/data_credentials_test.go b/internal/provider/data_credentials_test.go index 74114fa..dcbfba3 100644 --- a/internal/provider/data_credentials_test.go +++ b/internal/provider/data_credentials_test.go @@ -4,8 +4,9 @@ package provider import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceCredentialsAll(t *testing.T) { @@ -36,7 +37,7 @@ func TestAccDataSourceCredentials_VC(t *testing.T) { func testAccDataSourceCredentialsAll() string { return ` data "vcf_credentials" "creds" { - + } ` } diff --git a/internal/provider/data_source_cluster.go b/internal/provider/data_source_cluster.go index fed9c08..24a00ee 100644 --- a/internal/provider/data_source_cluster.go +++ b/internal/provider/data_source_cluster.go @@ -5,13 +5,15 @@ package provider import ( "context" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/cluster" "github.com/vmware/terraform-provider-vcf/internal/network" - "time" ) func DataSourceCluster() *schema.Resource { diff --git a/internal/provider/data_source_cluster_test.go b/internal/provider/data_source_cluster_test.go index 6d50dfd..a260eb2 100644 --- a/internal/provider/data_source_cluster_test.go +++ b/internal/provider/data_source_cluster_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func TestAccDataSourceVcfCluster(t *testing.T) { diff --git a/internal/provider/data_source_domain.go b/internal/provider/data_source_domain.go index c6e9698..826e4ed 100644 --- a/internal/provider/data_source_domain.go +++ b/internal/provider/data_source_domain.go @@ -5,14 +5,16 @@ package provider import ( "context" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/domain" "github.com/vmware/terraform-provider-vcf/internal/network" "github.com/vmware/terraform-provider-vcf/internal/vcenter" - "time" ) func DataSourceDomain() *schema.Resource { diff --git a/internal/provider/data_source_domain_test.go b/internal/provider/data_source_domain_test.go index bf9881c..9a03a0e 100644 --- a/internal/provider/data_source_domain_test.go +++ b/internal/provider/data_source_domain_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func TestAccDataSourceVcfDomain(t *testing.T) { diff --git a/internal/provider/framework_provider.go b/internal/provider/framework_provider.go index f57f956..1cbb7e7 100644 --- a/internal/provider/framework_provider.go +++ b/internal/provider/framework_provider.go @@ -5,6 +5,9 @@ package provider import ( "context" + "os" + "strconv" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -14,10 +17,9 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" - "os" - "strconv" ) type FrameworkProviderModel struct { diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 5eb8538..60feabf 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -5,8 +5,10 @@ package provider import ( "context" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" ) diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index ad89990..6bee363 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -4,14 +4,16 @@ package provider import ( + "os" + "testing" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/terraform-provider-vcf/internal/constants" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "os" - "testing" ) var testAccProvider *schema.Provider diff --git a/internal/provider/resource_ceip.go b/internal/provider/resource_ceip.go index 47c8eb2..2d9035d 100644 --- a/internal/provider/resource_ceip.go +++ b/internal/provider/resource_ceip.go @@ -5,18 +5,18 @@ package provider import ( "context" + "strings" + "time" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/terraform-provider-vcf/internal/api_client" - "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/vcf-sdk-go/client/ceip" "github.com/vmware/vcf-sdk-go/models" - "strings" - - "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/terraform-provider-vcf/internal/api_client" + "github.com/vmware/terraform-provider-vcf/internal/constants" ) const ( diff --git a/internal/provider/resource_ceip_test.go b/internal/provider/resource_ceip_test.go index d03778c..fb9a7d8 100644 --- a/internal/provider/resource_ceip_test.go +++ b/internal/provider/resource_ceip_test.go @@ -5,11 +5,13 @@ package provider import ( "fmt" + "log" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/terraform-provider-vcf/internal/api_client" - "log" - "testing" ) func TestAccResourceVcfCeip(t *testing.T) { diff --git a/internal/provider/resource_certificate.go b/internal/provider/resource_certificate.go index 5831cd5..277fa7b 100644 --- a/internal/provider/resource_certificate.go +++ b/internal/provider/resource_certificate.go @@ -6,17 +6,19 @@ package provider import ( "context" "fmt" + "strings" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/certificates" "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/terraform-provider-vcf/internal/resource_utils" - certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" - "github.com/vmware/vcf-sdk-go/models" - "strings" - "time" ) func ResourceCertificate() *schema.Resource { diff --git a/internal/provider/resource_certificate_authority.go b/internal/provider/resource_certificate_authority.go index c65cb85..1fa958c 100644 --- a/internal/provider/resource_certificate_authority.go +++ b/internal/provider/resource_certificate_authority.go @@ -6,15 +6,17 @@ package provider import ( "context" "fmt" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/client/certificates" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/client/certificates" - "github.com/vmware/vcf-sdk-go/models" - "time" ) func ResourceCertificateAuthority() *schema.Resource { diff --git a/internal/provider/resource_certificate_authority_test.go b/internal/provider/resource_certificate_authority_test.go index 93b0673..7c70689 100644 --- a/internal/provider/resource_certificate_authority_test.go +++ b/internal/provider/resource_certificate_authority_test.go @@ -6,15 +6,17 @@ package provider import ( "context" "fmt" + "os" + "strings" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/vcf-sdk-go/client/certificates" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/client/certificates" - "os" - "strings" - "testing" ) func TestAccResourceVcfCertificateAuthority(t *testing.T) { diff --git a/internal/provider/resource_certificate_test.go b/internal/provider/resource_certificate_test.go index 6b22804..9f21d54 100644 --- a/internal/provider/resource_certificate_test.go +++ b/internal/provider/resource_certificate_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func TestAccResourceVcfResourceCertificate_vCenter(t *testing.T) { diff --git a/internal/provider/resource_cluster.go b/internal/provider/resource_cluster.go index c616b00..d0f0d31 100644 --- a/internal/provider/resource_cluster.go +++ b/internal/provider/resource_cluster.go @@ -7,9 +7,18 @@ import ( "context" "errors" "fmt" + "log" + "strings" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/client" + "github.com/vmware/vcf-sdk-go/client/clusters" + "github.com/vmware/vcf-sdk-go/client/domains" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/cluster" "github.com/vmware/terraform-provider-vcf/internal/constants" @@ -18,13 +27,6 @@ import ( "github.com/vmware/terraform-provider-vcf/internal/resource_utils" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/terraform-provider-vcf/internal/vsan" - "github.com/vmware/vcf-sdk-go/client" - "github.com/vmware/vcf-sdk-go/client/clusters" - "github.com/vmware/vcf-sdk-go/client/domains" - "github.com/vmware/vcf-sdk-go/models" - "log" - "strings" - "time" ) func ResourceCluster() *schema.Resource { diff --git a/internal/provider/resource_cluster_personality.go b/internal/provider/resource_cluster_personality.go index 8c4bb72..563a7ed 100644 --- a/internal/provider/resource_cluster_personality.go +++ b/internal/provider/resource_cluster_personality.go @@ -6,14 +6,16 @@ package provider import ( "context" "fmt" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/vcf-sdk-go/client/personalities" "github.com/vmware/vcf-sdk-go/client/vcenters" "github.com/vmware/vcf-sdk-go/models" - "time" + + "github.com/vmware/terraform-provider-vcf/internal/api_client" ) const ( diff --git a/internal/provider/resource_cluster_personality_test.go b/internal/provider/resource_cluster_personality_test.go index 857cad9..aa2c3a4 100644 --- a/internal/provider/resource_cluster_personality_test.go +++ b/internal/provider/resource_cluster_personality_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func TestAccClusterPersonality_basic(t *testing.T) { diff --git a/internal/provider/resource_cluster_test.go b/internal/provider/resource_cluster_test.go index 57402e9..38c0f19 100644 --- a/internal/provider/resource_cluster_test.go +++ b/internal/provider/resource_cluster_test.go @@ -6,16 +6,18 @@ package provider import ( "context" "fmt" + "log" + "os" + "strings" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/vcf-sdk-go/client/clusters" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/client/clusters" - "log" - "os" - "strings" - "testing" ) func TestAccResourceVcfClusterCreate(t *testing.T) { @@ -200,7 +202,7 @@ func testAccVcfHostInClusterConfig(hostResourceId, esxLicenseKey, clusterName st id = "vmnic1" vds_name = "%s-vds01" } - } + } `, hostResourceId, esxLicenseKey, clusterName, clusterName) } diff --git a/internal/provider/resource_credentials_auto_rotate_policy.go b/internal/provider/resource_credentials_auto_rotate_policy.go index 3a1cfc4..16956a7 100644 --- a/internal/provider/resource_credentials_auto_rotate_policy.go +++ b/internal/provider/resource_credentials_auto_rotate_policy.go @@ -3,13 +3,15 @@ package provider import ( "context" "fmt" + "regexp" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/credentials" - "github.com/vmware/vcf-sdk-go/models" - "regexp" ) func ResourceCredentialsAutoRotatePolicy() *schema.Resource { diff --git a/internal/provider/resource_credentials_auto_rotate_policy_test.go b/internal/provider/resource_credentials_auto_rotate_policy_test.go index a237458..2fa541f 100644 --- a/internal/provider/resource_credentials_auto_rotate_policy_test.go +++ b/internal/provider/resource_credentials_auto_rotate_policy_test.go @@ -2,11 +2,13 @@ package provider import ( "fmt" + "testing" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/vmware/terraform-provider-vcf/internal/credentials" - "testing" - "time" ) func TestAccResourceAutorotatePolicy_resourceId(t *testing.T) { diff --git a/internal/provider/resource_credentials_password_rotate.go b/internal/provider/resource_credentials_password_rotate.go index 9923ea5..3e18926 100644 --- a/internal/provider/resource_credentials_password_rotate.go +++ b/internal/provider/resource_credentials_password_rotate.go @@ -2,13 +2,15 @@ package provider import ( "context" + "log" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/credentials" - "log" - "time" ) func ResourceCredentialsRotate() *schema.Resource { diff --git a/internal/provider/resource_credentials_password_rotate_test.go b/internal/provider/resource_credentials_password_rotate_test.go index 6de2b54..c6ff4e4 100644 --- a/internal/provider/resource_credentials_password_rotate_test.go +++ b/internal/provider/resource_credentials_password_rotate_test.go @@ -2,9 +2,10 @@ package provider import ( "errors" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "testing" ) func TestAccCredentialsResourcePasswordRotate(t *testing.T) { diff --git a/internal/provider/resource_credentials_password_update.go b/internal/provider/resource_credentials_password_update.go index b8d0f40..cc36e88 100644 --- a/internal/provider/resource_credentials_password_update.go +++ b/internal/provider/resource_credentials_password_update.go @@ -2,13 +2,15 @@ package provider import ( "context" + "log" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/credentials" - "log" - "time" ) func ResourceCredentialsUpdate() *schema.Resource { diff --git a/internal/provider/resource_credentials_password_update_test.go b/internal/provider/resource_credentials_password_update_test.go index 41a3abe..5216922 100644 --- a/internal/provider/resource_credentials_password_update_test.go +++ b/internal/provider/resource_credentials_password_update_test.go @@ -2,10 +2,11 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccCredentialsResourcePasswordUpdate(t *testing.T) { diff --git a/internal/provider/resource_csr.go b/internal/provider/resource_csr.go index 4bccb64..ac2a4c2 100644 --- a/internal/provider/resource_csr.go +++ b/internal/provider/resource_csr.go @@ -6,17 +6,19 @@ package provider import ( "context" "fmt" + "strconv" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/certificates" "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/terraform-provider-vcf/internal/resource_utils" - certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" - "github.com/vmware/vcf-sdk-go/models" - "strconv" - "time" ) func ResourceCsr() *schema.Resource { diff --git a/internal/provider/resource_csr_test.go b/internal/provider/resource_csr_test.go index 7f8ce14..1675d87 100644 --- a/internal/provider/resource_csr_test.go +++ b/internal/provider/resource_csr_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func TestAccResourceVcfCsr_vCenter(t *testing.T) { diff --git a/internal/provider/resource_domain.go b/internal/provider/resource_domain.go index 4ac031d..bbb7e9b 100644 --- a/internal/provider/resource_domain.go +++ b/internal/provider/resource_domain.go @@ -6,10 +6,16 @@ package provider import ( "context" "fmt" + "reflect" + "time" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/client/domains" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/cluster" "github.com/vmware/terraform-provider-vcf/internal/constants" @@ -18,10 +24,6 @@ import ( "github.com/vmware/terraform-provider-vcf/internal/resource_utils" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/terraform-provider-vcf/internal/vcenter" - "github.com/vmware/vcf-sdk-go/client/domains" - "github.com/vmware/vcf-sdk-go/models" - "reflect" - "time" ) func ResourceDomain() *schema.Resource { diff --git a/internal/provider/resource_domain_test.go b/internal/provider/resource_domain_test.go index a3c6134..8c21bc3 100644 --- a/internal/provider/resource_domain_test.go +++ b/internal/provider/resource_domain_test.go @@ -6,15 +6,17 @@ package provider import ( "context" "fmt" + "log" + "os" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/vcf-sdk-go/client/domains" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/client/domains" - "log" - "os" - "testing" ) func TestAccResourceVcfDomainCreate(t *testing.T) { diff --git a/internal/provider/resource_edge_cluster.go b/internal/provider/resource_edge_cluster.go index c04a069..83661fa 100644 --- a/internal/provider/resource_edge_cluster.go +++ b/internal/provider/resource_edge_cluster.go @@ -5,19 +5,21 @@ package provider import ( "context" + "math" + "time" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + vcfClient "github.com/vmware/vcf-sdk-go/client" + "github.com/vmware/vcf-sdk-go/client/nsxt_edge_clusters" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/terraform-provider-vcf/internal/nsx_edge_cluster" validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" - vcfClient "github.com/vmware/vcf-sdk-go/client" - "github.com/vmware/vcf-sdk-go/client/nsxt_edge_clusters" - "github.com/vmware/vcf-sdk-go/models" - "math" - "time" ) const ( diff --git a/internal/provider/resource_edge_cluster_test.go b/internal/provider/resource_edge_cluster_test.go index 6e3f124..a455de1 100644 --- a/internal/provider/resource_edge_cluster_test.go +++ b/internal/provider/resource_edge_cluster_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) const ( diff --git a/internal/provider/resource_external_certificate.go b/internal/provider/resource_external_certificate.go index a448797..0f6f24f 100644 --- a/internal/provider/resource_external_certificate.go +++ b/internal/provider/resource_external_certificate.go @@ -6,17 +6,19 @@ package provider import ( "context" "fmt" + "strings" + "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/certificates" "github.com/vmware/terraform-provider-vcf/internal/constants" validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" - certificatesSdk "github.com/vmware/vcf-sdk-go/client/certificates" - "github.com/vmware/vcf-sdk-go/models" - "strings" - "time" ) func ResourceExternalCertificate() *schema.Resource { diff --git a/internal/provider/resource_external_certificate_test.go b/internal/provider/resource_external_certificate_test.go index 75f4e3e..1d89356 100644 --- a/internal/provider/resource_external_certificate_test.go +++ b/internal/provider/resource_external_certificate_test.go @@ -5,10 +5,12 @@ package provider import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/vmware/terraform-provider-vcf/internal/constants" "os" "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/vmware/terraform-provider-vcf/internal/constants" ) /* diff --git a/internal/provider/resource_host.go b/internal/provider/resource_host.go index bdae57f..23a6730 100644 --- a/internal/provider/resource_host.go +++ b/internal/provider/resource_host.go @@ -7,22 +7,22 @@ import ( "context" "errors" "fmt" + "log" + "time" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/terraform-provider-vcf/internal/api_client" - "github.com/vmware/terraform-provider-vcf/internal/constants" - "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/credentials" "github.com/vmware/vcf-sdk-go/client/hosts" "github.com/vmware/vcf-sdk-go/client/network_pools" "github.com/vmware/vcf-sdk-go/models" - "log" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/terraform-provider-vcf/internal/api_client" + "github.com/vmware/terraform-provider-vcf/internal/constants" + "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) func ResourceHost() *schema.Resource { diff --git a/internal/provider/resource_host_test.go b/internal/provider/resource_host_test.go index 21dc12f..1e9807c 100644 --- a/internal/provider/resource_host_test.go +++ b/internal/provider/resource_host_test.go @@ -5,13 +5,15 @@ package provider import ( "fmt" + "log" + "os" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" - "log" - "os" - "testing" ) func TestAccResourceVcfHost(t *testing.T) { diff --git a/internal/provider/resource_network_pool.go b/internal/provider/resource_network_pool.go index 8a91eac..b2c9caf 100644 --- a/internal/provider/resource_network_pool.go +++ b/internal/provider/resource_network_pool.go @@ -5,6 +5,9 @@ package provider import ( "context" + "log" + "time" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -16,13 +19,12 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/vmware/terraform-provider-vcf/internal/api_client" - "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/vcf-sdk-go/client" "github.com/vmware/vcf-sdk-go/client/network_pools" "github.com/vmware/vcf-sdk-go/models" - "log" - "time" + + "github.com/vmware/terraform-provider-vcf/internal/api_client" + "github.com/vmware/terraform-provider-vcf/internal/constants" ) type IpPoolModel struct { diff --git a/internal/provider/resource_network_pool_test.go b/internal/provider/resource_network_pool_test.go index ea92384..2252a48 100644 --- a/internal/provider/resource_network_pool_test.go +++ b/internal/provider/resource_network_pool_test.go @@ -5,11 +5,13 @@ package provider import ( "fmt" + "log" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/terraform-provider-vcf/internal/constants" - "log" - "testing" ) func TestAccResourceVcfNetworkPool(t *testing.T) { diff --git a/internal/provider/resource_user.go b/internal/provider/resource_user.go index ba6761f..1b24d79 100644 --- a/internal/provider/resource_user.go +++ b/internal/provider/resource_user.go @@ -10,13 +10,13 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/terraform-provider-vcf/internal/api_client" - "github.com/vmware/terraform-provider-vcf/internal/constants" "github.com/vmware/vcf-sdk-go/client/users" "github.com/vmware/vcf-sdk-go/models" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/terraform-provider-vcf/internal/api_client" + "github.com/vmware/terraform-provider-vcf/internal/constants" ) func ResourceUser() *schema.Resource { diff --git a/internal/provider/resource_user_test.go b/internal/provider/resource_user_test.go index 70d19f0..302c517 100644 --- a/internal/provider/resource_user_test.go +++ b/internal/provider/resource_user_test.go @@ -5,11 +5,13 @@ package provider import ( "fmt" + "log" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/terraform-provider-vcf/internal/api_client" - "log" - "testing" ) const ( diff --git a/internal/provider/resource_vcf_instance.go b/internal/provider/resource_vcf_instance.go index e05adec..4563d80 100644 --- a/internal/provider/resource_vcf_instance.go +++ b/internal/provider/resource_vcf_instance.go @@ -12,13 +12,14 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + sddc_api "github.com/vmware/vcf-sdk-go/client/sddc" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/terraform-provider-vcf/internal/sddc" validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" - sddc_api "github.com/vmware/vcf-sdk-go/client/sddc" - "github.com/vmware/vcf-sdk-go/models" ) var dvSwitchVersions = []string{"7.0.0", "7.0.2", "7.0.3", "8.0.0"} diff --git a/internal/provider/resource_vcf_instance_test.go b/internal/provider/resource_vcf_instance_test.go index 31b93a2..e0a4459 100644 --- a/internal/provider/resource_vcf_instance_test.go +++ b/internal/provider/resource_vcf_instance_test.go @@ -6,15 +6,17 @@ package provider import ( "context" "fmt" + "os" + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/stretchr/testify/assert" + "github.com/vmware/terraform-provider-vcf/internal/api_client" "github.com/vmware/terraform-provider-vcf/internal/constants" utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" - "os" - "testing" ) func TestAccResourceVcfSddcBasic(t *testing.T) { diff --git a/internal/sddc/dns_subresource.go b/internal/sddc/dns_subresource.go index 29c8278..c611856 100644 --- a/internal/sddc/dns_subresource.go +++ b/internal/sddc/dns_subresource.go @@ -6,8 +6,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) func GetDnsSchema() *schema.Schema { diff --git a/internal/sddc/dvs_subresource.go b/internal/sddc/dvs_subresource.go index d7d16e6..e243e0b 100644 --- a/internal/sddc/dvs_subresource.go +++ b/internal/sddc/dvs_subresource.go @@ -6,8 +6,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) var trafficTypeValues = []string{"VSAN", "VMOTION", "VIRTUALMACHINE", "MANAGEMENT", "NFS", "VDP", "HBR", "FAULTTOLERANCE", "ISCSI"} diff --git a/internal/sddc/psc_subresource.go b/internal/sddc/psc_subresource.go index 4fe0159..459f751 100644 --- a/internal/sddc/psc_subresource.go +++ b/internal/sddc/psc_subresource.go @@ -5,9 +5,10 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/vcf-sdk-go/models" + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) func GetPscSchema() *schema.Schema { diff --git a/internal/sddc/sddc_cluster_subresource.go b/internal/sddc/sddc_cluster_subresource.go index 1dc1bb1..4b7c9b5 100644 --- a/internal/sddc/sddc_cluster_subresource.go +++ b/internal/sddc/sddc_cluster_subresource.go @@ -6,9 +6,10 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" - validation2 "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" + validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" ) var sharesLevelValues = []string{"custom", "high", "low", "normal"} @@ -79,7 +80,7 @@ func getResourcePoolSchema() *schema.Schema { Description: "CPU limit, default -1 (unlimited)", Optional: true, Default: -1, - ValidateFunc: validation2.ValidateParsingFloatToInt, + ValidateFunc: validation_utils.ValidateParsingFloatToInt, }, "cpu_reservation_expandable": { Type: schema.TypeBool, @@ -91,7 +92,7 @@ func getResourcePoolSchema() *schema.Schema { Type: schema.TypeFloat, Description: "CPU reservation in Mhz", Optional: true, - ValidateFunc: validation2.ValidateParsingFloatToInt, + ValidateFunc: validation_utils.ValidateParsingFloatToInt, }, "cpu_reservation_percentage": { Type: schema.TypeInt, @@ -118,7 +119,7 @@ func getResourcePoolSchema() *schema.Schema { Description: "Memory limit, default -1 (unlimited)", Optional: true, Default: -1, - ValidateFunc: validation2.ValidateParsingFloatToInt, + ValidateFunc: validation_utils.ValidateParsingFloatToInt, }, "memory_reservation_expandable": { Type: schema.TypeBool, @@ -130,7 +131,7 @@ func getResourcePoolSchema() *schema.Schema { Type: schema.TypeFloat, Description: "Memory reservation in MB", Optional: true, - ValidateFunc: validation2.ValidateParsingFloatToInt, + ValidateFunc: validation_utils.ValidateParsingFloatToInt, }, "memory_reservation_percentage": { Type: schema.TypeInt, @@ -167,7 +168,7 @@ func GetSddcClusterSpecFromSchema(rawData []interface{}) *models.SDDCClusterSpec hostFailuresToTolerate := utils.ToInt32Pointer(data["host_failures_to_tolerate"]) clusterImageEnabled := data["cluster_image_enabled"].(bool) var vmFolder map[string]string - if !validation2.IsEmpty(data["vm_folder"]) { + if !validation_utils.IsEmpty(data["vm_folder"]) { vmFolder = data["vm_folder"].(map[string]string) } diff --git a/internal/sddc/sddc_credentials_subresource.go b/internal/sddc/sddc_credentials_subresource.go index 2f17c4b..42badf2 100644 --- a/internal/sddc/sddc_credentials_subresource.go +++ b/internal/sddc/sddc_credentials_subresource.go @@ -5,9 +5,10 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/vcf-sdk-go/models" + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) func getCredentialsSchema() *schema.Schema { diff --git a/internal/sddc/sddc_host_subresource.go b/internal/sddc/sddc_host_subresource.go index 2eabf3d..9016a51 100644 --- a/internal/sddc/sddc_host_subresource.go +++ b/internal/sddc/sddc_host_subresource.go @@ -6,8 +6,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) func GetSddcHostSchema() *schema.Schema { diff --git a/internal/sddc/sddc_manager_subresource.go b/internal/sddc/sddc_manager_subresource.go index c3c63ab..32d8a97 100644 --- a/internal/sddc/sddc_manager_subresource.go +++ b/internal/sddc/sddc_manager_subresource.go @@ -6,9 +6,10 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/models" + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) func GetSddcManagerSchema() *schema.Schema { diff --git a/internal/sddc/sddc_network_subresource.go b/internal/sddc/sddc_network_subresource.go index d1211d6..b19bc1a 100644 --- a/internal/sddc/sddc_network_subresource.go +++ b/internal/sddc/sddc_network_subresource.go @@ -6,8 +6,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) var teamingPolicies = []string{"loadbalance_loadbased", "loadbalance_ip", "loadbalance_srcmac", "loadbalance_srcid", "failover_explicit"} diff --git a/internal/sddc/sddc_nsx_subresource.go b/internal/sddc/sddc_nsx_subresource.go index 32f961f..bb25085 100644 --- a/internal/sddc/sddc_nsx_subresource.go +++ b/internal/sddc/sddc_nsx_subresource.go @@ -6,10 +6,11 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/models" + "github.com/vmware/terraform-provider-vcf/internal/network" utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) func GetNsxSpecSchema() *schema.Schema { diff --git a/internal/sddc/sddc_security_subresource.go b/internal/sddc/sddc_security_subresource.go index 31bff62..8be7aa9 100644 --- a/internal/sddc/sddc_security_subresource.go +++ b/internal/sddc/sddc_security_subresource.go @@ -6,8 +6,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) var esxiCertsModes = []string{"Custom", "VMCA"} diff --git a/internal/sddc/sddc_vcenter_subresource.go b/internal/sddc/sddc_vcenter_subresource.go index 8b42e9d..031afe0 100644 --- a/internal/sddc/sddc_vcenter_subresource.go +++ b/internal/sddc/sddc_vcenter_subresource.go @@ -6,9 +6,10 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vcf-sdk-go/models" + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" - "github.com/vmware/vcf-sdk-go/models" ) var vmSizeValues = []string{"tiny", "small", "medium", "large", "xlarge"} diff --git a/internal/sddc/sddc_vsan_subresource.go b/internal/sddc/sddc_vsan_subresource.go index 347f87e..2c67812 100644 --- a/internal/sddc/sddc_vsan_subresource.go +++ b/internal/sddc/sddc_vsan_subresource.go @@ -5,8 +5,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) func GetVsanSchema() *schema.Schema { diff --git a/internal/sddc/sddc_vx_manager_subresource.go b/internal/sddc/sddc_vx_manager_subresource.go index a663dad..cb28735 100644 --- a/internal/sddc/sddc_vx_manager_subresource.go +++ b/internal/sddc/sddc_vx_manager_subresource.go @@ -5,8 +5,9 @@ package sddc import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" "github.com/vmware/vcf-sdk-go/models" + + utils "github.com/vmware/terraform-provider-vcf/internal/resource_utils" ) func GetVxManagerSchema() *schema.Schema { diff --git a/internal/validation/validation_utils.go b/internal/validation/validation_utils.go index 3587c4e..ed3f768 100644 --- a/internal/validation/validation_utils.go +++ b/internal/validation/validation_utils.go @@ -6,13 +6,14 @@ package validation import ( "errors" "fmt" + "net/netip" + "strings" + "unicode" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/vmware/vcf-sdk-go/client/clusters" "github.com/vmware/vcf-sdk-go/client/domains" "github.com/vmware/vcf-sdk-go/models" - "net/netip" - "strings" - "unicode" ) func ValidatePassword(v interface{}, k string) (warnings []string, errors []error) { diff --git a/internal/vcenter/vcenter_subresource.go b/internal/vcenter/vcenter_subresource.go index 12e1bd1..bb51968 100644 --- a/internal/vcenter/vcenter_subresource.go +++ b/internal/vcenter/vcenter_subresource.go @@ -5,11 +5,13 @@ package vcenter import ( "fmt" + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" "github.com/vmware/vcf-sdk-go/models" - "strings" + + validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" ) // VCSubresourceSchema this helper function extracts the vcenter schema, which diff --git a/internal/vsan/witness_host_subresource.go b/internal/vsan/witness_host_subresource.go index ffdee06..7523726 100644 --- a/internal/vsan/witness_host_subresource.go +++ b/internal/vsan/witness_host_subresource.go @@ -6,7 +6,8 @@ package vsan import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - validationUtils "github.com/vmware/terraform-provider-vcf/internal/validation" + + validation_utils "github.com/vmware/terraform-provider-vcf/internal/validation" ) func WitnessHostSubresource() *schema.Resource { @@ -22,7 +23,7 @@ func WitnessHostSubresource() *schema.Resource { Type: schema.TypeString, Required: true, Description: "CIDR address for the witness host on the vSAN network", - ValidateFunc: validationUtils.ValidateCidrIPv4AddressSchema, + ValidateFunc: validation_utils.ValidateCidrIPv4AddressSchema, }, "fqdn": { Type: schema.TypeString,