From a5769a0e97121bc4c41e122ef5ba315620e16ceb Mon Sep 17 00:00:00 2001 From: Deepak Mettem Date: Fri, 6 Dec 2019 13:41:06 -0800 Subject: [PATCH] Add import feature to all vra resources (#116) Fixes #114. Signed-off-by: Deepak Mettem --- vra/resource_block_device.go | 3 +++ vra/resource_cloud_account_aws.go | 3 +++ vra/resource_cloud_account_azure.go | 3 +++ vra/resource_cloud_account_gcp.go | 3 +++ vra/resource_cloud_account_nsxt.go | 3 +++ vra/resource_cloud_account_nsxv.go | 3 +++ vra/resource_cloud_account_vmc.go | 3 +++ vra/resource_cloud_account_vsphere.go | 3 +++ vra/resource_deployment.go | 3 +++ vra/resource_flavor_profile.go | 3 +++ vra/resource_image_profile.go | 3 +++ vra/resource_load_balancer.go | 3 +++ vra/resource_machine.go | 3 +++ vra/resource_network.go | 4 ++++ vra/resource_network_profile.go | 3 +++ vra/resource_project.go | 3 +++ vra/resource_storage_profile.go | 3 +++ vra/resource_storage_profile_aws.go | 3 +++ vra/resource_storage_profile_azure.go | 3 +++ vra/resource_zone.go | 3 +++ 20 files changed, 61 insertions(+) diff --git a/vra/resource_block_device.go b/vra/resource_block_device.go index bbbd1546..aea5c353 100644 --- a/vra/resource_block_device.go +++ b/vra/resource_block_device.go @@ -21,6 +21,9 @@ func resourceBlockDevice() *schema.Resource { Read: resourceBlockDeviceRead, Update: resourceBlockDeviceUpdate, Delete: resourceBlockDeviceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "capacity_in_gb": &schema.Schema{ diff --git a/vra/resource_cloud_account_aws.go b/vra/resource_cloud_account_aws.go index fb116379..02c949cd 100644 --- a/vra/resource_cloud_account_aws.go +++ b/vra/resource_cloud_account_aws.go @@ -15,6 +15,9 @@ func resourceCloudAccountAWS() *schema.Resource { Read: resourceCloudAccountAWSRead, Update: resourceCloudAccountAWSUpdate, Delete: resourceCloudAccountAWSDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "access_key": &schema.Schema{ diff --git a/vra/resource_cloud_account_azure.go b/vra/resource_cloud_account_azure.go index a1f5acda..1c49ea10 100644 --- a/vra/resource_cloud_account_azure.go +++ b/vra/resource_cloud_account_azure.go @@ -15,6 +15,9 @@ func resourceCloudAccountAzure() *schema.Resource { Read: resourceCloudAccountAzureRead, Update: resourceCloudAccountAzureUpdate, Delete: resourceCloudAccountAzureDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ diff --git a/vra/resource_cloud_account_gcp.go b/vra/resource_cloud_account_gcp.go index 7ed7f4b3..cc75fcdb 100644 --- a/vra/resource_cloud_account_gcp.go +++ b/vra/resource_cloud_account_gcp.go @@ -15,6 +15,9 @@ func resourceCloudAccountGCP() *schema.Resource { Read: resourceCloudAccountGCPRead, Update: resourceCloudAccountGCPUpdate, Delete: resourceCloudAccountGCPDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ diff --git a/vra/resource_cloud_account_nsxt.go b/vra/resource_cloud_account_nsxt.go index 6ee90542..dc0b8c66 100644 --- a/vra/resource_cloud_account_nsxt.go +++ b/vra/resource_cloud_account_nsxt.go @@ -15,6 +15,9 @@ func resourceCloudAccountNSXT() *schema.Resource { Read: resourceCloudAccountNSXTRead, Update: resourceCloudAccountNSXTUpdate, Delete: resourceCloudAccountNSXTDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "accept_self_signed_cert": &schema.Schema{ diff --git a/vra/resource_cloud_account_nsxv.go b/vra/resource_cloud_account_nsxv.go index e24ed74c..01979db8 100644 --- a/vra/resource_cloud_account_nsxv.go +++ b/vra/resource_cloud_account_nsxv.go @@ -15,6 +15,9 @@ func resourceCloudAccountNSXV() *schema.Resource { Read: resourceCloudAccountNSXVRead, Update: resourceCloudAccountNSXVUpdate, Delete: resourceCloudAccountNSXVDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "accept_self_signed_cert": &schema.Schema{ diff --git a/vra/resource_cloud_account_vmc.go b/vra/resource_cloud_account_vmc.go index aeff15a9..4265acf9 100644 --- a/vra/resource_cloud_account_vmc.go +++ b/vra/resource_cloud_account_vmc.go @@ -16,6 +16,9 @@ func resourceCloudAccountVMC() *schema.Resource { Read: resourceCloudAccountVMCRead, Update: resourceCloudAccountVMCUpdate, Delete: resourceCloudAccountVMCDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "accept_self_signed_cert": &schema.Schema{ diff --git a/vra/resource_cloud_account_vsphere.go b/vra/resource_cloud_account_vsphere.go index d9142b9e..45dbcf47 100644 --- a/vra/resource_cloud_account_vsphere.go +++ b/vra/resource_cloud_account_vsphere.go @@ -15,6 +15,9 @@ func resourceCloudAccountVsphere() *schema.Resource { Read: resourceCloudAccountVsphereRead, Update: resourceCloudAccountVsphereUpdate, Delete: resourceCloudAccountVsphereDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "accept_self_signed_cert": &schema.Schema{ diff --git a/vra/resource_deployment.go b/vra/resource_deployment.go index 50bae7a5..f2600ae6 100644 --- a/vra/resource_deployment.go +++ b/vra/resource_deployment.go @@ -23,6 +23,9 @@ func resourceDeployment() *schema.Resource { Read: resourceDeploymentRead, Update: resourceDeploymentUpdate, Delete: resourceDeploymentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "blueprint_id": { diff --git a/vra/resource_flavor_profile.go b/vra/resource_flavor_profile.go index e344d7f1..4b8e63a0 100644 --- a/vra/resource_flavor_profile.go +++ b/vra/resource_flavor_profile.go @@ -12,6 +12,9 @@ func resourceFlavorProfile() *schema.Resource { Read: resourceFlavorProfileRead, Update: resourceFlavorProfileUpdate, Delete: resourceFlavorProfileDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "description": &schema.Schema{ diff --git a/vra/resource_image_profile.go b/vra/resource_image_profile.go index bf8e54fe..3d4aca39 100644 --- a/vra/resource_image_profile.go +++ b/vra/resource_image_profile.go @@ -12,6 +12,9 @@ func resourceImageProfile() *schema.Resource { Read: resourceImageProfileRead, Update: resourceImageProfileUpdate, Delete: resourceImageProfileDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "description": &schema.Schema{ diff --git a/vra/resource_load_balancer.go b/vra/resource_load_balancer.go index 1a96d456..c4e006da 100644 --- a/vra/resource_load_balancer.go +++ b/vra/resource_load_balancer.go @@ -21,6 +21,9 @@ func resourceLoadBalancer() *schema.Resource { Read: resourceLoadBalancerRead, Update: resourceLoadBalancerUpdate, Delete: resourceLoadBalancerDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ diff --git a/vra/resource_machine.go b/vra/resource_machine.go index ccfc5eef..e8fd9046 100644 --- a/vra/resource_machine.go +++ b/vra/resource_machine.go @@ -23,6 +23,9 @@ func resourceMachine() *schema.Resource { Read: resourceMachineRead, Update: resourceMachineUpdate, Delete: resourceMachineDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "address": &schema.Schema{ diff --git a/vra/resource_network.go b/vra/resource_network.go index 9c929d78..d82da968 100644 --- a/vra/resource_network.go +++ b/vra/resource_network.go @@ -21,6 +21,10 @@ func resourceNetwork() *schema.Resource { Read: resourceNetworkRead, Update: resourceNetworkUpdate, Delete: resourceNetworkDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, diff --git a/vra/resource_network_profile.go b/vra/resource_network_profile.go index 73778bf7..a24ffd5b 100644 --- a/vra/resource_network_profile.go +++ b/vra/resource_network_profile.go @@ -16,6 +16,9 @@ func resourceNetworkProfile() *schema.Resource { Read: resourceNetworkProfileRead, Update: resourceNetworkProfileUpdate, Delete: resourceNetworkProfileDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ diff --git a/vra/resource_project.go b/vra/resource_project.go index 51405569..4edf44c8 100644 --- a/vra/resource_project.go +++ b/vra/resource_project.go @@ -12,6 +12,9 @@ func resourceProject() *schema.Resource { Read: resourceProjectRead, Update: resourceProjectUpdate, Delete: resourceProjectDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "administrators": &schema.Schema{ diff --git a/vra/resource_storage_profile.go b/vra/resource_storage_profile.go index d198d495..50636546 100644 --- a/vra/resource_storage_profile.go +++ b/vra/resource_storage_profile.go @@ -16,6 +16,9 @@ func resourceStorageProfile() *schema.Resource { Read: resourceStorageProfileRead, Update: resourceStorageProfileUpdate, Delete: resourceStorageProfileDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ diff --git a/vra/resource_storage_profile_aws.go b/vra/resource_storage_profile_aws.go index 5e78ae8b..fe2d1d8a 100644 --- a/vra/resource_storage_profile_aws.go +++ b/vra/resource_storage_profile_aws.go @@ -16,6 +16,9 @@ func resourceStorageProfileAws() *schema.Resource { Read: resourceStorageProfileAwsRead, Update: resourceStorageProfileAwsUpdate, Delete: resourceStorageProfileAwsDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ diff --git a/vra/resource_storage_profile_azure.go b/vra/resource_storage_profile_azure.go index 502eb405..e8178dd9 100644 --- a/vra/resource_storage_profile_azure.go +++ b/vra/resource_storage_profile_azure.go @@ -16,6 +16,9 @@ func resourceStorageProfileAzure() *schema.Resource { Read: resourceStorageProfileAzureRead, Update: resourceStorageProfileAzureUpdate, Delete: resourceStorageProfileAzureDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ diff --git a/vra/resource_zone.go b/vra/resource_zone.go index 38921a6c..d5db4fe5 100644 --- a/vra/resource_zone.go +++ b/vra/resource_zone.go @@ -14,6 +14,9 @@ func resourceZone() *schema.Resource { Read: resourceZoneRead, Update: resourceZoneUpdate, Delete: resourceZoneDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "description": &schema.Schema{