From 1142bd2bfc08e71f751fbf8c82048c8c51a994eb Mon Sep 17 00:00:00 2001 From: Matthias Gatto Date: Tue, 2 Apr 2024 17:15:23 +0200 Subject: [PATCH] rename most functions. So it follow the pulumi standart which require upper camel case. otherwise polumi provider doesn't work. Signed-off-by: Matthias Gatto --- outscale/data_source_outscale_access_key.go | 6 +- outscale/data_source_outscale_access_keys.go | 6 +- outscale/data_source_outscale_account.go | 6 +- outscale/data_source_outscale_accounts.go | 6 +- .../data_source_outscale_api_access_policy.go | 6 +- ..._source_outscale_api_access_policy_test.go | 6 +- .../data_source_outscale_api_access_rule.go | 6 +- ...ta_source_outscale_api_access_rule_test.go | 6 +- .../data_source_outscale_api_access_rules.go | 6 +- ...a_source_outscale_api_access_rules_test.go | 6 +- outscale/data_source_outscale_ca.go | 10 +- outscale/data_source_outscale_ca_test.go | 4 +- outscale/data_source_outscale_cas.go | 8 +- outscale/data_source_outscale_cas_test.go | 4 +- .../data_source_outscale_client_gateway.go | 6 +- .../data_source_outscale_client_gateways.go | 6 +- outscale/data_source_outscale_dhcp_option.go | 6 +- outscale/data_source_outscale_dhcp_options.go | 6 +- outscale/data_source_outscale_flexible_gpu.go | 10 +- ...ta_source_outscale_flexible_gpu_catalog.go | 6 +- ...urce_outscale_flexible_gpu_catalog_test.go | 4 +- .../data_source_outscale_flexible_gpu_test.go | 4 +- .../data_source_outscale_flexible_gpus.go | 8 +- ...data_source_outscale_flexible_gpus_test.go | 4 +- outscale/data_source_outscale_image.go | 8 +- .../data_source_outscale_image_export_task.go | 2 +- ..._source_outscale_image_export_task_test.go | 4 +- ...data_source_outscale_image_export_tasks.go | 2 +- ...source_outscale_image_export_tasks_test.go | 4 +- outscale/data_source_outscale_image_test.go | 8 +- outscale/data_source_outscale_images.go | 10 +- outscale/data_source_outscale_images_test.go | 8 +- .../data_source_outscale_internet_service.go | 6 +- ...a_source_outscale_internet_service_test.go | 4 +- .../data_source_outscale_internet_services.go | 6 +- ..._source_outscale_internet_services_test.go | 4 +- outscale/data_source_outscale_keypair.go | 10 +- outscale/data_source_outscale_keypair_test.go | 8 +- outscale/data_source_outscale_keypairs.go | 8 +- .../data_source_outscale_keypairs_test.go | 8 +- .../data_source_outscale_load_balancer.go | 6 +- ...ce_outscale_load_balancer_listener_rule.go | 6 +- ...e_outscale_load_balancer_listener_rules.go | 6 +- ...data_source_outscale_load_balancer_tags.go | 6 +- ...source_outscale_load_balancer_tags_test.go | 2 +- ...data_source_outscale_load_balancer_test.go | 8 +- ...source_outscale_load_balancer_vm_health.go | 6 +- .../data_source_outscale_load_balancer_vms.go | 6 +- .../data_source_outscale_load_balancers.go | 6 +- ...ata_source_outscale_load_balancers_test.go | 6 +- outscale/data_source_outscale_nat_service.go | 10 +- .../data_source_outscale_nat_service_test.go | 4 +- outscale/data_source_outscale_nat_services.go | 8 +- .../data_source_outscale_nat_services_test.go | 4 +- outscale/data_source_outscale_net.go | 10 +- .../data_source_outscale_net_access_point.go | 6 +- ...urce_outscale_net_access_point_services.go | 6 +- ...outscale_net_access_point_services_test.go | 4 +- ...a_source_outscale_net_access_point_test.go | 4 +- .../data_source_outscale_net_access_points.go | 6 +- ..._source_outscale_net_access_points_test.go | 4 +- .../data_source_outscale_net_attributes.go | 6 +- ...ata_source_outscale_net_attributes_test.go | 8 +- outscale/data_source_outscale_net_peering.go | 10 +- .../data_source_outscale_net_peering_test.go | 8 +- outscale/data_source_outscale_net_peerings.go | 8 +- .../data_source_outscale_net_peerings_test.go | 4 +- outscale/data_source_outscale_net_test.go | 8 +- outscale/data_source_outscale_nets.go | 8 +- outscale/data_source_outscale_nets_test.go | 4 +- outscale/data_source_outscale_nic.go | 10 +- outscale/data_source_outscale_nic_test.go | 24 +- outscale/data_source_outscale_nics.go | 8 +- outscale/data_source_outscale_nics_test.go | 4 +- outscale/data_source_outscale_product_type.go | 10 +- .../data_source_outscale_product_type_test.go | 4 +- .../data_source_outscale_product_types.go | 8 +- ...data_source_outscale_product_types_test.go | 4 +- .../data_source_outscale_public_catalog.go | 6 +- ...ata_source_outscale_public_catalog_test.go | 4 +- outscale/data_source_outscale_public_ip.go | 10 +- .../data_source_outscale_public_ip_test.go | 18 +- outscale/data_source_outscale_public_ips.go | 8 +- .../data_source_outscale_public_ips_test.go | 8 +- outscale/data_source_outscale_quota.go | 8 +- outscale/data_source_outscale_quotas.go | 10 +- outscale/data_source_outscale_quotas_test.go | 4 +- outscale/data_source_outscale_regions.go | 6 +- outscale/data_source_outscale_regions_test.go | 8 +- outscale/data_source_outscale_route_table.go | 10 +- .../data_source_outscale_route_table_test.go | 10 +- outscale/data_source_outscale_route_tables.go | 8 +- .../data_source_outscale_route_tables_test.go | 4 +- .../data_source_outscale_security_group.go | 10 +- ...ata_source_outscale_security_group_test.go | 16 +- .../data_source_outscale_security_groups.go | 8 +- ...ta_source_outscale_security_groups_test.go | 4 +- ...data_source_outscale_server_certificate.go | 6 +- ...source_outscale_server_certificate_test.go | 4 +- ...ata_source_outscale_server_certificates.go | 6 +- ...ource_outscale_server_certificates_test.go | 4 +- outscale/data_source_outscale_snapshot.go | 6 +- ...ta_source_outscale_snapshot_export_task.go | 2 +- ...urce_outscale_snapshot_export_task_test.go | 4 +- ...a_source_outscale_snapshot_export_tasks.go | 2 +- ...rce_outscale_snapshot_export_tasks_test.go | 4 +- .../data_source_outscale_snapshot_test.go | 14 +- outscale/data_source_outscale_snapshots.go | 6 +- .../data_source_outscale_snapshots_test.go | 4 +- outscale/data_source_outscale_subnet.go | 10 +- outscale/data_source_outscale_subnet_test.go | 16 +- outscale/data_source_outscale_subnets.go | 8 +- outscale/data_source_outscale_subnets_test.go | 8 +- outscale/data_source_outscale_subregions.go | 10 +- .../data_source_outscale_subregions_test.go | 14 +- outscale/data_source_outscale_tag.go | 6 +- outscale/data_source_outscale_tags.go | 6 +- outscale/data_source_outscale_tags_test.go | 2 +- .../data_source_outscale_virtual_gateway.go | 6 +- ...ta_source_outscale_virtual_gateway_test.go | 4 +- .../data_source_outscale_virtual_gateways.go | 6 +- ...a_source_outscale_virtual_gateways_test.go | 4 +- outscale/data_source_outscale_vm.go | 10 +- outscale/data_source_outscale_vm_state.go | 10 +- .../data_source_outscale_vm_state_test.go | 8 +- outscale/data_source_outscale_vm_states.go | 8 +- .../data_source_outscale_vm_states_test.go | 4 +- outscale/data_source_outscale_vm_types.go | 10 +- .../data_source_outscale_vm_types_test.go | 4 +- outscale/data_source_outscale_vms.go | 12 +- outscale/data_source_outscale_volume.go | 2 +- outscale/data_source_outscale_volume_test.go | 14 +- outscale/data_source_outscale_volumes.go | 2 +- outscale/data_source_outscale_volumes_test.go | 18 +- .../data_source_outscale_vpn_connection.go | 6 +- .../data_source_outscale_vpn_connections.go | 6 +- outscale/data_source_quota.go | 4 +- outscale/data_source_quota_test.go | 4 +- outscale/framework_provider_test.go | 8 +- .../import_outscale_net_attributes_test.go | 2 +- outscale/provider.go | 250 +++++++++--------- outscale/resource_outscale_access_key.go | 22 +- .../resource_outscale_api_access_policy.go | 22 +- outscale/resource_outscale_api_access_rule.go | 22 +- .../resource_outscale_api_access_rule_test.go | 4 +- outscale/resource_outscale_ca.go | 22 +- outscale/resource_outscale_ca_test.go | 8 +- outscale/resource_outscale_client_gateway.go | 22 +- outscale/resource_outscale_dhcp_option.go | 22 +- outscale/resource_outscale_flexible_gpu.go | 22 +- .../resource_outscale_flexible_gpu_link.go | 18 +- ...esource_outscale_flexible_gpu_link_test.go | 4 +- .../resource_outscale_flexible_gpu_test.go | 4 +- outscale/resource_outscale_image.go | 6 +- .../resource_outscale_image_export_task.go | 6 +- ...esource_outscale_image_export_task_test.go | 6 +- ...source_outscale_image_launch_permission.go | 20 +- ...e_outscale_image_launch_permission_test.go | 32 +-- .../resource_outscale_internet_service.go | 22 +- ...resource_outscale_internet_service_link.go | 16 +- ...resource_outscale_internet_service_test.go | 6 +- outscale/resource_outscale_keypair.go | 2 +- outscale/resource_outscale_keypair_test.go | 34 +-- outscale/resource_outscale_load_balancer.go | 26 +- ...ource_outscale_load_balancer_attributes.go | 26 +- ..._outscale_load_balancer_attributes_test.go | 8 +- ...ce_outscale_load_balancer_listener_rule.go | 22 +- .../resource_outscale_load_balancer_policy.go | 14 +- .../resource_outscale_load_balancer_test.go | 20 +- .../resource_outscale_load_balancer_vms.go | 22 +- ...esource_outscale_load_balancer_vms_test.go | 8 +- ...resource_outscale_main_route_table_link.go | 2 +- outscale/resource_outscale_nat_service.go | 6 +- outscale/resource_outscale_net.go | 22 +- .../resource_outscale_net_access_point.go | 22 +- ...resource_outscale_net_access_point_test.go | 4 +- outscale/resource_outscale_net_attributes.go | 22 +- .../resource_outscale_net_attributes_test.go | 10 +- outscale/resource_outscale_net_peering.go | 28 +- ...source_outscale_net_peering_acceptation.go | 14 +- ...e_outscale_net_peering_acceptation_test.go | 12 +- .../resource_outscale_net_peering_test.go | 20 +- outscale/resource_outscale_net_test.go | 18 +- outscale/resource_outscale_nic.go | 28 +- outscale/resource_outscale_nic_link.go | 20 +- outscale/resource_outscale_nic_link_test.go | 2 +- outscale/resource_outscale_nic_private_ip.go | 16 +- .../resource_outscale_nic_private_ip_test.go | 12 +- outscale/resource_outscale_nic_test.go | 22 +- outscale/resource_outscale_public_ip.go | 28 +- outscale/resource_outscale_public_ip_link.go | 36 +-- .../resource_outscale_public_ip_link_test.go | 20 +- outscale/resource_outscale_public_ip_test.go | 44 +-- outscale/resource_outscale_route.go | 34 +-- outscale/resource_outscale_route_table.go | 28 +- .../resource_outscale_route_table_link.go | 20 +- outscale/resource_outscale_route_test.go | 34 +-- outscale/resource_outscale_security_group.go | 22 +- .../resource_outscale_security_group_rule.go | 20 +- ...ource_outscale_security_group_rule_test.go | 26 +- .../resource_outscale_security_group_test.go | 12 +- .../resource_outscale_server_certificate.go | 22 +- ...source_outscale_server_certificate_test.go | 6 +- outscale/resource_outscale_snapshot.go | 22 +- .../resource_outscale_snapshot_attributes.go | 16 +- ...ource_outscale_snapshot_attributes_test.go | 8 +- .../resource_outscale_snapshot_export_task.go | 6 +- ...urce_outscale_snapshot_export_task_test.go | 12 +- outscale/resource_outscale_snapshot_test.go | 20 +- outscale/resource_outscale_subnet.go | 26 +- outscale/resource_outscale_subnet_test.go | 16 +- outscale/resource_outscale_tags.go | 16 +- outscale/resource_outscale_tags_test.go | 2 +- outscale/resource_outscale_virtual_gateway.go | 20 +- .../resource_outscale_virtual_gateway_link.go | 16 +- ...urce_outscale_virtual_gateway_link_test.go | 4 +- ...scale_virtual_gateway_route_propagation.go | 14 +- ..._virtual_gateway_route_propagation_test.go | 8 +- .../resource_outscale_virtual_gateway_test.go | 2 +- outscale/resource_outscale_vm.go | 2 +- outscale/resource_outscale_vm_test.go | 114 ++++---- outscale/resource_outscale_volume.go | 2 +- outscale/resource_outscale_volume_test.go | 10 +- outscale/resource_outscale_volumes_link.go | 2 +- .../resource_outscale_volumes_link_test.go | 2 +- outscale/resource_outscale_vpn_connection.go | 22 +- .../resource_outscale_vpn_connection_route.go | 26 +- ...urce_outscale_vpn_connection_route_test.go | 6 +- 228 files changed, 1362 insertions(+), 1362 deletions(-) diff --git a/outscale/data_source_outscale_access_key.go b/outscale/data_source_outscale_access_key.go index bdbc16271..80d55c929 100644 --- a/outscale/data_source_outscale_access_key.go +++ b/outscale/data_source_outscale_access_key.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -func dataSourceOutscaleAccessKey() *schema.Resource { +func DataSourceOutscaleAccessKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleAccessKeyRead, + Read: DataSourceOutscaleAccessKeyRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "access_key_id": { @@ -48,7 +48,7 @@ func dataSourceOutscaleAccessKey() *schema.Resource { } } -func dataSourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_access_keys.go b/outscale/data_source_outscale_access_keys.go index 4edfcbf80..0f5cbbd6b 100644 --- a/outscale/data_source_outscale_access_keys.go +++ b/outscale/data_source_outscale_access_keys.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -func dataSourceOutscaleAccessKeys() *schema.Resource { +func DataSourceOutscaleAccessKeys() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleAccessKeysRead, + Read: DataSourceOutscaleAccessKeysRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "access_key_ids": { @@ -67,7 +67,7 @@ func dataSourceOutscaleAccessKeys() *schema.Resource { } } -func dataSourceOutscaleAccessKeysRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleAccessKeysRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_account.go b/outscale/data_source_outscale_account.go index 77a8b57d9..ce8db45a9 100644 --- a/outscale/data_source_outscale_account.go +++ b/outscale/data_source_outscale_account.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceAccount() *schema.Resource { +func DataSourceAccount() *schema.Resource { return &schema.Resource{ - Read: dataSourceAccountRead, + Read: DataSourceAccountRead, Schema: map[string]*schema.Schema{ "account_id": { Type: schema.TypeString, @@ -85,7 +85,7 @@ func dataSourceAccount() *schema.Resource { } } -func dataSourceAccountRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceAccountRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI diff --git a/outscale/data_source_outscale_accounts.go b/outscale/data_source_outscale_accounts.go index 4c75d09dd..d3fab34c5 100644 --- a/outscale/data_source_outscale_accounts.go +++ b/outscale/data_source_outscale_accounts.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceAccounts() *schema.Resource { +func DataSourceAccounts() *schema.Resource { return &schema.Resource{ - Read: dataSourceAccountsRead, + Read: DataSourceAccountsRead, Schema: map[string]*schema.Schema{ "accounts": { Type: schema.TypeList, @@ -93,7 +93,7 @@ func dataSourceAccounts() *schema.Resource { } } -func dataSourceAccountsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceAccountsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI diff --git a/outscale/data_source_outscale_api_access_policy.go b/outscale/data_source_outscale_api_access_policy.go index 0144661b0..c2da9516b 100644 --- a/outscale/data_source_outscale_api_access_policy.go +++ b/outscale/data_source_outscale_api_access_policy.go @@ -11,9 +11,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIApiAccessPolicy() *schema.Resource { +func DataSourceOutscaleApiAccessPolicy() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIApiAccessPolicyRead, + Read: DataSourceOutscaleApiAccessPolicyRead, Schema: map[string]*schema.Schema{ "max_access_key_expiration_seconds": { Type: schema.TypeInt, @@ -31,7 +31,7 @@ func dataSourceOutscaleOAPIApiAccessPolicy() *schema.Resource { } } -func dataSourceOutscaleOAPIApiAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleApiAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadApiAccessPolicyRequest{} diff --git a/outscale/data_source_outscale_api_access_policy_test.go b/outscale/data_source_outscale_api_access_policy_test.go index 2df13984d..6033fe31f 100644 --- a/outscale/data_source_outscale_api_access_policy_test.go +++ b/outscale/data_source_outscale_api_access_policy_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIApiAccessPolicy_basic(t *testing.T) { +func TestAccDataSourceOutscaleApiAccessPolicy_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -16,13 +16,13 @@ func TestAccDataSourceOutscaleOAPIApiAccessPolicy_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIApiAccessPolicyConfig(), + Config: testAccDataSourceOutscaleApiAccessPolicyConfig(), }, }, }) } -func testAccDataSourceOutscaleOAPIApiAccessPolicyConfig() string { +func testAccDataSourceOutscaleApiAccessPolicyConfig() string { return fmt.Sprintf(` data "outscale_api_access_policy" "api_access_policy" {} `) diff --git a/outscale/data_source_outscale_api_access_rule.go b/outscale/data_source_outscale_api_access_rule.go index 91bd8c84c..5bcbd5137 100644 --- a/outscale/data_source_outscale_api_access_rule.go +++ b/outscale/data_source_outscale_api_access_rule.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIApiAccessRule() *schema.Resource { +func DataSourceOutscaleApiAccessRule() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIApiAccessRuleRead, + Read: DataSourceOutscaleApiAccessRuleRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "api_access_rule_id": { @@ -48,7 +48,7 @@ func dataSourceOutscaleOAPIApiAccessRule() *schema.Resource { } } -func dataSourceOutscaleOAPIApiAccessRuleRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleApiAccessRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_api_access_rule_test.go b/outscale/data_source_outscale_api_access_rule_test.go index cf747ac79..dadfb3c66 100644 --- a/outscale/data_source_outscale_api_access_rule_test.go +++ b/outscale/data_source_outscale_api_access_rule_test.go @@ -13,7 +13,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func TestAccOthers_DataOutscaleOAPIApiAccessRule_basic(t *testing.T) { +func TestAccOthers_DataOutscaleApiAccessRule_basic(t *testing.T) { t.Parallel() resourceName := "outscale_api_access_rule.rule_data" ca_path := os.Getenv("CA_PATH") @@ -24,7 +24,7 @@ func TestAccOthers_DataOutscaleOAPIApiAccessRule_basic(t *testing.T) { CheckDestroy: testAccDataCheckOutscaleApiAccessRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPIApiAccessRuleConfig(ca_path), + Config: testAccDataOutscaleApiAccessRuleConfig(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleApiAccessRuleExists(resourceName), ), @@ -71,7 +71,7 @@ func testAccDataCheckOutscaleApiAccessRuleDestroy(s *terraform.State) error { return nil } -func testAccDataOutscaleOAPIApiAccessRuleConfig(path string) string { +func testAccDataOutscaleApiAccessRuleConfig(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_rule" { ca_pem = file(%q) diff --git a/outscale/data_source_outscale_api_access_rules.go b/outscale/data_source_outscale_api_access_rules.go index 7e834a66e..3fc9dd6bd 100644 --- a/outscale/data_source_outscale_api_access_rules.go +++ b/outscale/data_source_outscale_api_access_rules.go @@ -11,9 +11,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIApiAccessRules() *schema.Resource { +func DataSourceOutscaleApiAccessRules() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIApiAccessRulesRead, + Read: DataSourceOutscaleApiAccessRulesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "api_access_rules": { @@ -55,7 +55,7 @@ func dataSourceOutscaleOAPIApiAccessRules() *schema.Resource { } } -func dataSourceOutscaleOAPIApiAccessRulesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleApiAccessRulesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_api_access_rules_test.go b/outscale/data_source_outscale_api_access_rules_test.go index b29670e5f..d81c56f95 100644 --- a/outscale/data_source_outscale_api_access_rules_test.go +++ b/outscale/data_source_outscale_api_access_rules_test.go @@ -12,7 +12,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func TestAccDataOutscaleOAPIApiAccessRules_basic(t *testing.T) { +func TestAccDataOutscaleApiAccessRules_basic(t *testing.T) { t.Parallel() resourceName := "outscale_api_access_rule.rule_data" resource.Test(t, resource.TestCase{ @@ -21,7 +21,7 @@ func TestAccDataOutscaleOAPIApiAccessRules_basic(t *testing.T) { CheckDestroy: testAccDataCheckOutscaleApiAccessRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPIApiAccessRulesConfig(), + Config: testAccDataOutscaleApiAccessRulesConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleApiAccessRuleExists(resourceName), ), @@ -68,7 +68,7 @@ func testAccDataCheckOutscaleApiAccessRulesDestroy(s *terraform.State) error { return nil } -func testAccDataOutscaleOAPIApiAccessRulesConfig() string { +func testAccDataOutscaleApiAccessRulesConfig() string { return fmt.Sprintf(` resource "outscale_ca" "ca_rule" { ca_pem = file("./test-cert.pem") diff --git a/outscale/data_source_outscale_ca.go b/outscale/data_source_outscale_ca.go index 219eb24ff..79a5ef531 100644 --- a/outscale/data_source_outscale_ca.go +++ b/outscale/data_source_outscale_ca.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPICa() *schema.Resource { +func DataSourceOutscaleCa() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPICaRead, + Read: DataSourceOutscaleCaRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "ca_pem": { @@ -41,7 +41,7 @@ func dataSourceOutscaleOAPICa() *schema.Resource { } } -func dataSourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleCaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -51,7 +51,7 @@ func dataSourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) erro params := oscgo.ReadCasRequest{} if filtersOk { - params.Filters = buildOutscaleOAPIDataSourceCaFilters(filters.(*schema.Set)) + params.Filters = buildOutscaleDataSourceCaFilters(filters.(*schema.Set)) } var resp oscgo.ReadCasResponse var err error @@ -93,7 +93,7 @@ func dataSourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) erro return nil } -func buildOutscaleOAPIDataSourceCaFilters(set *schema.Set) *oscgo.FiltersCa { +func buildOutscaleDataSourceCaFilters(set *schema.Set) *oscgo.FiltersCa { var filters oscgo.FiltersCa for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_ca_test.go b/outscale/data_source_outscale_ca_test.go index 65c53d625..8a2fadb72 100644 --- a/outscale/data_source_outscale_ca_test.go +++ b/outscale/data_source_outscale_ca_test.go @@ -23,7 +23,7 @@ func TestAccOthers_DataOutscaleCa_basic(t *testing.T) { CheckDestroy: testAccDataCheckOutscaleCaDestroy, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPICaConfig(ca_path), + Config: testAccDataOutscaleCaConfig(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resourceName), ), @@ -72,7 +72,7 @@ func testAccDataCheckOutscaleCaDestroy(s *terraform.State) error { return nil } -func testAccDataOutscaleOAPICaConfig(path string) string { +func testAccDataOutscaleCaConfig(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_test" { ca_pem = file(%q) diff --git a/outscale/data_source_outscale_cas.go b/outscale/data_source_outscale_cas.go index e68714630..f14ef4020 100644 --- a/outscale/data_source_outscale_cas.go +++ b/outscale/data_source_outscale_cas.go @@ -11,9 +11,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPICas() *schema.Resource { +func DataSourceOutscaleCas() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPICasRead, + Read: DataSourceOutscaleCasRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "cas": { @@ -44,14 +44,14 @@ func dataSourceOutscaleOAPICas() *schema.Resource { } } -func dataSourceOutscaleOAPICasRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleCasRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") params := oscgo.ReadCasRequest{} if filtersOk { - params.Filters = buildOutscaleOAPIDataSourceCaFilters(filters.(*schema.Set)) + params.Filters = buildOutscaleDataSourceCaFilters(filters.(*schema.Set)) } var resp oscgo.ReadCasResponse var err error diff --git a/outscale/data_source_outscale_cas_test.go b/outscale/data_source_outscale_cas_test.go index 2c3a89dd4..b8d74598a 100644 --- a/outscale/data_source_outscale_cas_test.go +++ b/outscale/data_source_outscale_cas_test.go @@ -23,7 +23,7 @@ func TestAccOthers_DataOutscaleCas_basic(t *testing.T) { CheckDestroy: testAccDataCheckOutscaleCasDestroy, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPICasConfig(ca_path), + Config: testAccDataOutscaleCasConfig(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resName), ), @@ -72,7 +72,7 @@ func testAccDataCheckOutscaleCasDestroy(s *terraform.State) error { return nil } -func testAccDataOutscaleOAPICasConfig(path string) string { +func testAccDataOutscaleCasConfig(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_test" { ca_pem = file(%[1]q) diff --git a/outscale/data_source_outscale_client_gateway.go b/outscale/data_source_outscale_client_gateway.go index 05daa68f9..501c8c705 100644 --- a/outscale/data_source_outscale_client_gateway.go +++ b/outscale/data_source_outscale_client_gateway.go @@ -13,9 +13,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleClientGateway() *schema.Resource { +func DataSourceOutscaleClientGateway() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleClientGatewayRead, + Read: DataSourceOutscaleClientGatewayRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "bgp_asn": { @@ -47,7 +47,7 @@ func dataSourceOutscaleClientGateway() *schema.Resource { } } -func dataSourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_client_gateways.go b/outscale/data_source_outscale_client_gateways.go index 78f04a311..a7769f539 100644 --- a/outscale/data_source_outscale_client_gateways.go +++ b/outscale/data_source_outscale_client_gateways.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleClientGateways() *schema.Resource { +func DataSourceOutscaleClientGateways() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleClientGatewaysRead, + Read: DataSourceOutscaleClientGatewaysRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "client_gateway_ids": { @@ -61,7 +61,7 @@ func dataSourceOutscaleClientGateways() *schema.Resource { } } -func dataSourceOutscaleClientGatewaysRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleClientGatewaysRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_dhcp_option.go b/outscale/data_source_outscale_dhcp_option.go index db86012d0..67e885ec4 100644 --- a/outscale/data_source_outscale_dhcp_option.go +++ b/outscale/data_source_outscale_dhcp_option.go @@ -13,9 +13,9 @@ import ( "github.com/spf13/cast" ) -func dataSourceOutscaleDHCPOption() *schema.Resource { +func DataSourceOutscaleDHCPOption() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleDHCPOptionRead, + Read: DataSourceOutscaleDHCPOptionRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -61,7 +61,7 @@ func dataSourceOutscaleDHCPOption() *schema.Resource { } } -func dataSourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_dhcp_options.go b/outscale/data_source_outscale_dhcp_options.go index 0ac75eea3..9ad27c2ed 100644 --- a/outscale/data_source_outscale_dhcp_options.go +++ b/outscale/data_source_outscale_dhcp_options.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleDHCPOptions() *schema.Resource { +func DataSourceOutscaleDHCPOptions() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleDHCPOptionsRead, + Read: DataSourceOutscaleDHCPOptionsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -75,7 +75,7 @@ func dataSourceOutscaleDHCPOptions() *schema.Resource { } } -func dataSourceOutscaleDHCPOptionsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleDHCPOptionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_flexible_gpu.go b/outscale/data_source_outscale_flexible_gpu.go index 5a6b41307..448391e82 100644 --- a/outscale/data_source_outscale_flexible_gpu.go +++ b/outscale/data_source_outscale_flexible_gpu.go @@ -14,9 +14,9 @@ import ( "github.com/spf13/cast" ) -func dataSourceOutscaleOAPIFlexibleGpu() *schema.Resource { +func DataSourceOutscaleFlexibleGpu() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIFlexibleGpuRead, + Read: DataSourceOutscaleFlexibleGpuRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "request_id": { @@ -55,7 +55,7 @@ func dataSourceOutscaleOAPIFlexibleGpu() *schema.Resource { } } -func dataSourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleFlexibleGpuRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI @@ -72,7 +72,7 @@ func dataSourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interfac FlexibleGpuIds: &[]string{flexID.(string)}, } - req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceFlexibleGpuFilters(filters.(*schema.Set))) var resp oscgo.ReadFlexibleGpusResponse var err error @@ -122,7 +122,7 @@ func dataSourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interfac return nil } -func buildOutscaleOAPIDataSourceFlexibleGpuFilters(set *schema.Set) oscgo.FiltersFlexibleGpu { +func buildOutscaleDataSourceFlexibleGpuFilters(set *schema.Set) oscgo.FiltersFlexibleGpu { var filters oscgo.FiltersFlexibleGpu for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_flexible_gpu_catalog.go b/outscale/data_source_outscale_flexible_gpu_catalog.go index 984277574..a86913f56 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog.go @@ -11,9 +11,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIFlexibleGpuCatalog() *schema.Resource { +func DataSourceOutscaleFlexibleGpuCatalog() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIFlexibleGpuCatalogRead, + Read: DataSourceOutscaleFlexibleGpuCatalogRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "flexible_gpu_catalog": { @@ -53,7 +53,7 @@ func dataSourceOutscaleOAPIFlexibleGpuCatalog() *schema.Resource { } } -func dataSourceOutscaleOAPIFlexibleGpuCatalogRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleFlexibleGpuCatalogRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadFlexibleGpuCatalogRequest{} diff --git a/outscale/data_source_outscale_flexible_gpu_catalog_test.go b/outscale/data_source_outscale_flexible_gpu_catalog_test.go index a6940e901..61ddfe8f4 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog_test.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog_test.go @@ -16,13 +16,13 @@ func TestAccOthers_DataSourceFlexibleGpuCatalog_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIFlexibleGpuCatalogConfig(), + Config: testAccDataSourceOutscaleFlexibleGpuCatalogConfig(), }, }, }) } -func testAccDataSourceOutscaleOAPIFlexibleGpuCatalogConfig() string { +func testAccDataSourceOutscaleFlexibleGpuCatalogConfig() string { return fmt.Sprintf(` data "outscale_flexible_gpu_catalog" "catalog-fGPU" { } `) diff --git a/outscale/data_source_outscale_flexible_gpu_test.go b/outscale/data_source_outscale_flexible_gpu_test.go index 5227373ba..bcf1b4151 100644 --- a/outscale/data_source_outscale_flexible_gpu_test.go +++ b/outscale/data_source_outscale_flexible_gpu_test.go @@ -17,13 +17,13 @@ func TestAccOthers_DataSourceFlexibleGpu_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIFlexibleGpuConfig(utils.GetRegion()), + Config: testAccDataSourceOutscaleFlexibleGpuConfig(utils.GetRegion()), }, }, }) } -func testAccDataSourceOutscaleOAPIFlexibleGpuConfig(region string) string { +func testAccDataSourceOutscaleFlexibleGpuConfig(region string) string { return fmt.Sprintf(` resource "outscale_flexible_gpu" "dataGPU" { model_name = "nvidia-p6" diff --git a/outscale/data_source_outscale_flexible_gpus.go b/outscale/data_source_outscale_flexible_gpus.go index 16a957647..659bb12b1 100644 --- a/outscale/data_source_outscale_flexible_gpus.go +++ b/outscale/data_source_outscale_flexible_gpus.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIFlexibleGpus() *schema.Resource { +func DataSourceOutscaleFlexibleGpus() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIFlexibleGpusRead, + Read: DataSourceOutscaleFlexibleGpusRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -62,7 +62,7 @@ func dataSourceOutscaleOAPIFlexibleGpus() *schema.Resource { } } -func dataSourceOutscaleOAPIFlexibleGpusRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleFlexibleGpusRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -73,7 +73,7 @@ func dataSourceOutscaleOAPIFlexibleGpusRead(d *schema.ResourceData, meta interfa } req := oscgo.ReadFlexibleGpusRequest{} - req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceFlexibleGpuFilters(filters.(*schema.Set))) var resp oscgo.ReadFlexibleGpusResponse var err error diff --git a/outscale/data_source_outscale_flexible_gpus_test.go b/outscale/data_source_outscale_flexible_gpus_test.go index 543b3f0f9..fddbb3a5a 100644 --- a/outscale/data_source_outscale_flexible_gpus_test.go +++ b/outscale/data_source_outscale_flexible_gpus_test.go @@ -17,13 +17,13 @@ func TestAccOthers_DataSourceFlexibleGpus_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIFlexibleGpusConfig(utils.GetRegion()), + Config: testAccDataSourceOutscaleFlexibleGpusConfig(utils.GetRegion()), }, }, }) } -func testAccDataSourceOutscaleOAPIFlexibleGpusConfig(region string) string { +func testAccDataSourceOutscaleFlexibleGpusConfig(region string) string { return fmt.Sprintf(` resource "outscale_flexible_gpu" "fGPUS-1" { model_name = "nvidia-p6" diff --git a/outscale/data_source_outscale_image.go b/outscale/data_source_outscale_image.go index 72b69d8c4..096eee809 100644 --- a/outscale/data_source_outscale_image.go +++ b/outscale/data_source_outscale_image.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIImage() *schema.Resource { +func DataSourceOutscaleImage() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIImageRead, + Read: DataSourceOutscaleImageRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -194,7 +194,7 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { } } -func dataSourceOutscaleOAPIImageRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleImageRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -207,7 +207,7 @@ func dataSourceOutscaleOAPIImageRead(d *schema.ResourceData, meta interface{}) e filtersReq := &oscgo.FiltersImage{} if filtersOk { - filtersReq = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) + filtersReq = buildOutscaleDataSourceImagesFilters(filters.(*schema.Set)) } if imageIDOk { filtersReq.SetImageIds([]string{imageID.(string)}) diff --git a/outscale/data_source_outscale_image_export_task.go b/outscale/data_source_outscale_image_export_task.go index d3d95c274..456159101 100644 --- a/outscale/data_source_outscale_image_export_task.go +++ b/outscale/data_source_outscale_image_export_task.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIImageExportTask() *schema.Resource { +func DataSourceOutscaleImageExportTask() *schema.Resource { return &schema.Resource{ Read: dataSourceOAPISnapshotImageTaskRead, Importer: &schema.ResourceImporter{ diff --git a/outscale/data_source_outscale_image_export_task_test.go b/outscale/data_source_outscale_image_export_task_test.go index e4cb18514..862cd7cdc 100644 --- a/outscale/data_source_outscale_image_export_task_test.go +++ b/outscale/data_source_outscale_image_export_task_test.go @@ -25,7 +25,7 @@ func TestAccVM_withImageExportTaskDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), + Config: testAccOutscaleImageExportTaskDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleImageExportTaskDataSourceID("data.outscale_image_export_task.test"), ), @@ -52,7 +52,7 @@ func testAccCheckOutscaleImageExportTaskDataSourceID(n string) resource.TestChec } } -func testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, vmType, region, imageName string) string { +func testAccOutscaleImageExportTaskDataSourceConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` resource "outscale_vm" "basicExport" { image_id = "%s" diff --git a/outscale/data_source_outscale_image_export_tasks.go b/outscale/data_source_outscale_image_export_tasks.go index 47b85de9d..e87d25794 100644 --- a/outscale/data_source_outscale_image_export_tasks.go +++ b/outscale/data_source_outscale_image_export_tasks.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIImageExportTasks() *schema.Resource { +func DataSourceOutscaleImageExportTasks() *schema.Resource { return &schema.Resource{ Read: dataSourceOAPIImageExportTasksRead, Importer: &schema.ResourceImporter{ diff --git a/outscale/data_source_outscale_image_export_tasks_test.go b/outscale/data_source_outscale_image_export_tasks_test.go index 2bb984e50..e1da2f085 100644 --- a/outscale/data_source_outscale_image_export_tasks_test.go +++ b/outscale/data_source_outscale_image_export_tasks_test.go @@ -24,7 +24,7 @@ func TestAccVM_withImageExportTasksDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIImageExportTasksDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), + Config: testAccOutscaleImageExportTasksDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleImageExportTaskDataSourceID("outscale_image_export_task.outscale_image_export_task"), ), @@ -36,7 +36,7 @@ func TestAccVM_withImageExportTasksDataSource_basic(t *testing.T) { } } -func testAccOutscaleOAPIImageExportTasksDataSourceConfig(omi, vmType, region, imageName string) string { +func testAccOutscaleImageExportTasksDataSourceConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` resource "outscale_vm" "basic" { image_id = "%s" diff --git a/outscale/data_source_outscale_image_test.go b/outscale/data_source_outscale_image_test.go index dafded625..902180699 100644 --- a/outscale/data_source_outscale_image_test.go +++ b/outscale/data_source_outscale_image_test.go @@ -23,16 +23,16 @@ func TestAccVM_WithImageDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIImageDataSourceBasicConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), + Config: testAccCheckOutscaleImageDataSourceBasicConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIImageDataSourceID("data.outscale_image.omi"), + testAccCheckOutscaleImageDataSourceID("data.outscale_image.omi"), ), }, }, }) } -func testAccCheckOutscaleOAPIImageDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleImageDataSourceID(n string) resource.TestCheckFunc { // Wait for IAM role return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -47,7 +47,7 @@ func testAccCheckOutscaleOAPIImageDataSourceID(n string) resource.TestCheckFunc } } -func testAccCheckOutscaleOAPIImageDataSourceBasicConfig(omi, vmType, region, imageName string) string { +func testAccCheckOutscaleImageDataSourceBasicConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_img_data" { security_group_name = "sg_imgData" diff --git a/outscale/data_source_outscale_images.go b/outscale/data_source_outscale_images.go index a4855e22d..7fb8c71b7 100644 --- a/outscale/data_source_outscale_images.go +++ b/outscale/data_source_outscale_images.go @@ -14,9 +14,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIImages() *schema.Resource { +func DataSourceOutscaleImages() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIImagesRead, + Read: DataSourceOutscaleImagesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -211,7 +211,7 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { } } -func dataSourceOutscaleOAPIImagesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleImagesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI executableUsers, executableUsersOk := d.GetOk("permissions") @@ -223,7 +223,7 @@ func dataSourceOutscaleOAPIImagesRead(d *schema.ResourceData, meta interface{}) filtersReq := &oscgo.FiltersImage{} if filtersOk { - filtersReq = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) + filtersReq = buildOutscaleDataSourceImagesFilters(filters.(*schema.Set)) } if ownersOk { filtersReq.SetAccountIds([]string{aids.(string)}) @@ -281,7 +281,7 @@ func dataSourceOutscaleOAPIImagesRead(d *schema.ResourceData, meta interface{}) }) } -func buildOutscaleOAPIDataSourceImagesFilters(set *schema.Set) *oscgo.FiltersImage { +func buildOutscaleDataSourceImagesFilters(set *schema.Set) *oscgo.FiltersImage { filters := &oscgo.FiltersImage{} for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_images_test.go b/outscale/data_source_outscale_images_test.go index ed54ff69b..aa11ad6a5 100644 --- a/outscale/data_source_outscale_images_test.go +++ b/outscale/data_source_outscale_images_test.go @@ -23,16 +23,16 @@ func TestAccVM_WithImagesDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), + Config: testAccCheckOutscaleImagesDataSourceConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), imageName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIImagesDataSourceID("data.outscale_images.nat_ami"), + testAccCheckOutscaleImagesDataSourceID("data.outscale_images.nat_ami"), ), }, }, }) } -func testAccCheckOutscaleOAPIImagesDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleImagesDataSourceID(n string) resource.TestCheckFunc { // Wait for IAM role return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -47,7 +47,7 @@ func testAccCheckOutscaleOAPIImagesDataSourceID(n string) resource.TestCheckFunc } } -func testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, vmType, region, imageName string) string { +func testAccCheckOutscaleImagesDataSourceConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_imgs_data" { security_group_name = "sg_imgsData" diff --git a/outscale/data_source_outscale_internet_service.go b/outscale/data_source_outscale_internet_service.go index 6563f026e..0b73d1999 100644 --- a/outscale/data_source_outscale_internet_service.go +++ b/outscale/data_source_outscale_internet_service.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOAPIInternetService() *schema.Resource { +func DataSourceOutscaleInternetService() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOAPIInternetServiceRead, + Read: DataSourceOutscaleInternetServiceRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "state": { @@ -39,7 +39,7 @@ func datasourceOutscaleOAPIInternetService() *schema.Resource { } } -func datasourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleInternetServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_internet_service_test.go b/outscale/data_source_outscale_internet_service_test.go index 6df55ee70..e579edc76 100644 --- a/outscale/data_source_outscale_internet_service_test.go +++ b/outscale/data_source_outscale_internet_service_test.go @@ -13,7 +13,7 @@ func TestAccOthers_InternetServiceDatasource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIInternetServiceDatasourceConfig, + Config: testAccOutscaleInternetServiceDatasourceConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.outscale_internet_service.outscale_internet_serviced", "internet_service_id"), ), @@ -22,7 +22,7 @@ func TestAccOthers_InternetServiceDatasource_basic(t *testing.T) { }) } -const testAccOutscaleOAPIInternetServiceDatasourceConfig = ` +const testAccOutscaleInternetServiceDatasourceConfig = ` resource "outscale_internet_service" "outscale_internet_service" {} data "outscale_internet_service" "outscale_internet_serviced" { diff --git a/outscale/data_source_outscale_internet_services.go b/outscale/data_source_outscale_internet_services.go index a69f4c231..7cca476e2 100644 --- a/outscale/data_source_outscale_internet_services.go +++ b/outscale/data_source_outscale_internet_services.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOAPIInternetServices() *schema.Resource { +func DataSourceOutscaleInternetServices() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOAPIInternetServicesRead, + Read: DataSourceOutscaleInternetServicesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "internet_service_ids": { @@ -54,7 +54,7 @@ func datasourceOutscaleOAPIInternetServices() *schema.Resource { } } -func datasourceOutscaleOAPIInternetServicesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleInternetServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_internet_services_test.go b/outscale/data_source_outscale_internet_services_test.go index 7a267aa02..65846fa52 100644 --- a/outscale/data_source_outscale_internet_services_test.go +++ b/outscale/data_source_outscale_internet_services_test.go @@ -13,13 +13,13 @@ func TestAccOthers_InternetServicesDatasource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIInternetServicesDatasourceConfig, + Config: testAccOutscaleInternetServicesDatasourceConfig, }, }, }) } -const testAccOutscaleOAPIInternetServicesDatasourceConfig = ` +const testAccOutscaleInternetServicesDatasourceConfig = ` resource "outscale_internet_service" "gateway" {} data "outscale_internet_services" "outscale_internet_services" { diff --git a/outscale/data_source_outscale_keypair.go b/outscale/data_source_outscale_keypair.go index 3a883ba5f..028ee8a1b 100644 --- a/outscale/data_source_outscale_keypair.go +++ b/outscale/data_source_outscale_keypair.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleKeyPairRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadKeypairsRequest{ Filters: &oscgo.FiltersKeypair{KeypairNames: &[]string{d.Id()}}, @@ -30,7 +30,7 @@ func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) filters, filtersOk := d.GetOk("filter") if filtersOk { - req.SetFilters(buildOutscaleOAPIKeyPairsDataSourceFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleKeyPairsDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadKeypairsResponse @@ -79,9 +79,9 @@ func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) return nil } -func datasourceOutscaleOAPIKeyPair() *schema.Resource { +func DataSourceOutscaleKeyPair() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOApiKeyPairRead, + Read: DataSourceOutscaleKeyPairRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -103,7 +103,7 @@ func datasourceOutscaleOAPIKeyPair() *schema.Resource { } } -func buildOutscaleOAPIKeyPairsDataSourceFilters(set *schema.Set) oscgo.FiltersKeypair { +func buildOutscaleKeyPairsDataSourceFilters(set *schema.Set) oscgo.FiltersKeypair { var filters oscgo.FiltersKeypair for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_keypair_test.go b/outscale/data_source_outscale_keypair_test.go index 89ab1fce4..30d753a9f 100644 --- a/outscale/data_source_outscale_keypair_test.go +++ b/outscale/data_source_outscale_keypair_test.go @@ -18,9 +18,9 @@ func TestAccOthers_KeypairDataSource_Instance(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIKeypairDataSourceConfig(keyPairName), + Config: testAccCheckOutscaleKeypairDataSourceConfig(keyPairName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeypairDataSourceID("data.outscale_keypair.nat_ami"), + testAccCheckOutscaleKeypairDataSourceID("data.outscale_keypair.nat_ami"), resource.TestCheckResourceAttr("data.outscale_keypair.nat_ami", "keypair_name", keyPairName), ), }, @@ -28,7 +28,7 @@ func TestAccOthers_KeypairDataSource_Instance(t *testing.T) { }) } -func testAccCheckOutscaleOAPIKeypairDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleKeypairDataSourceID(n string) resource.TestCheckFunc { // Wait for IAM role return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -43,7 +43,7 @@ func testAccCheckOutscaleOAPIKeypairDataSourceID(n string) resource.TestCheckFun } } -func testAccCheckOutscaleOAPIKeypairDataSourceConfig(keypairName string) string { +func testAccCheckOutscaleKeypairDataSourceConfig(keypairName string) string { return fmt.Sprintf(` resource "outscale_keypair" "a_key_pair" { keypair_name = "%s" diff --git a/outscale/data_source_outscale_keypairs.go b/outscale/data_source_outscale_keypairs.go index ca3d37b4c..0f0731ff2 100644 --- a/outscale/data_source_outscale_keypairs.go +++ b/outscale/data_source_outscale_keypairs.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadKeypairsRequest{ Filters: &oscgo.FiltersKeypair{}, @@ -35,7 +35,7 @@ func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{} filters, filtersOk := d.GetOk("filter") if filtersOk { - req.SetFilters(buildOutscaleOAPIKeyPairsDataSourceFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleKeyPairsDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadKeypairsResponse @@ -85,9 +85,9 @@ func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{} return d.Set("keypairs", keypairs) } -func datasourceOutscaleOAPIKeyPairs() *schema.Resource { +func DataSourceOutscaleKeyPairs() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOAPiKeyPairsRead, + Read: DataSourceOutscaleOAPiKeyPairsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), diff --git a/outscale/data_source_outscale_keypairs_test.go b/outscale/data_source_outscale_keypairs_test.go index e68672822..113264e0a 100644 --- a/outscale/data_source_outscale_keypairs_test.go +++ b/outscale/data_source_outscale_keypairs_test.go @@ -17,9 +17,9 @@ func TestAccOthers_KeypairsDataSource_Instance(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIKeypairsDataSourceConfig(keyPairName), + Config: testAccCheckOutscaleKeypairsDataSourceConfig(keyPairName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeypairsDataSourceID("data.outscale_keypairs.nat_ami"), + testAccCheckOutscaleKeypairsDataSourceID("data.outscale_keypairs.nat_ami"), resource.TestCheckResourceAttr("data.outscale_keypairs.nat_ami", "keypairs.0.keypair_name", keyPairName), ), }, @@ -27,7 +27,7 @@ func TestAccOthers_KeypairsDataSource_Instance(t *testing.T) { }) } -func testAccCheckOutscaleOAPIKeypairsDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleKeypairsDataSourceID(n string) resource.TestCheckFunc { // Wait for IAM role return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -42,7 +42,7 @@ func testAccCheckOutscaleOAPIKeypairsDataSourceID(n string) resource.TestCheckFu } } -func testAccCheckOutscaleOAPIKeypairsDataSourceConfig(keyPairName string) string { +func testAccCheckOutscaleKeypairsDataSourceConfig(keyPairName string) string { return fmt.Sprintf(` resource "outscale_keypair" "a_key_pair" { keypair_name = "%s" diff --git a/outscale/data_source_outscale_load_balancer.go b/outscale/data_source_outscale_load_balancer.go index 92155d0b5..adae4ae3d 100644 --- a/outscale/data_source_outscale_load_balancer.go +++ b/outscale/data_source_outscale_load_balancer.go @@ -188,9 +188,9 @@ func getDataSourceSchemas(attrsSchema map[string]*schema.Schema) map[string]*sch } -func dataSourceOutscaleOAPILoadBalancer() *schema.Resource { +func DataSourceOutscaleLoadBalancer() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILoadBalancerRead, + Read: DataSourceOutscaleLoadBalancerRead, Schema: getDataSourceSchemas(attrLBchema()), } } @@ -281,7 +281,7 @@ func readLbs0(conn *oscgo.APIClient, d *schema.ResourceData) (*oscgo.LoadBalance return &lbs[0], resp, nil } -func dataSourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLoadBalancerRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lb, _, err := readLbs0(conn, d) diff --git a/outscale/data_source_outscale_load_balancer_listener_rule.go b/outscale/data_source_outscale_load_balancer_listener_rule.go index 4e7fbcb48..390a7a10c 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rule.go +++ b/outscale/data_source_outscale_load_balancer_listener_rule.go @@ -56,14 +56,14 @@ func attrLBListenerRule() map[string]*schema.Schema { } } -func dataSourceOutscaleOAPILoadBalancerLDRule() *schema.Resource { +func DataSourceOutscaleLoadBalancerLDRule() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILoadBalancerLDRuleRead, + Read: DataSourceOutscaleLoadBalancerLDRuleRead, Schema: getDataSourceSchemas(attrLBListenerRule()), } } -func dataSourceOutscaleOAPILoadBalancerLDRuleRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLoadBalancerLDRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lrNamei, nameOk := d.GetOk("listener_rule_name") diff --git a/outscale/data_source_outscale_load_balancer_listener_rules.go b/outscale/data_source_outscale_load_balancer_listener_rules.go index 98e2adbdf..144c26f3f 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rules.go +++ b/outscale/data_source_outscale_load_balancer_listener_rules.go @@ -64,14 +64,14 @@ func attrLBListenerRules() map[string]*schema.Schema { } } -func dataSourceOutscaleOAPILoadBalancerLDRules() *schema.Resource { +func DataSourceOutscaleLoadBalancerLDRules() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILoadBalancerLDRulesRead, + Read: DataSourceOutscaleLoadBalancerLDRulesRead, Schema: getDataSourceSchemas(attrLBListenerRules()), } } -func dataSourceOutscaleOAPILoadBalancerLDRulesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLoadBalancerLDRulesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lrNamei, nameOk := d.GetOk("listener_rule_name") diff --git a/outscale/data_source_outscale_load_balancer_tags.go b/outscale/data_source_outscale_load_balancer_tags.go index 3e9fcd869..2f9d20b92 100644 --- a/outscale/data_source_outscale_load_balancer_tags.go +++ b/outscale/data_source_outscale_load_balancer_tags.go @@ -12,15 +12,15 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPILBUTags() *schema.Resource { +func DataSourceOutscaleLBUTags() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILBUTagsRead, + Read: DataSourceOutscaleLBUTagsRead, Schema: getDataSourceSchemas(getDSOAPILBUTagsSchema()), } } -func dataSourceOutscaleOAPILBUTagsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLBUTagsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI ename, nameOk := d.GetOk("load_balancer_names") diff --git a/outscale/data_source_outscale_load_balancer_tags_test.go b/outscale/data_source_outscale_load_balancer_tags_test.go index eb4352209..1f32ad070 100644 --- a/outscale/data_source_outscale_load_balancer_tags_test.go +++ b/outscale/data_source_outscale_load_balancer_tags_test.go @@ -10,7 +10,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func TestAccOutscaleOAPIDSLoadBalancerTags_basic(t *testing.T) { +func TestAccOutscaleDSLoadBalancerTags_basic(t *testing.T) { t.Parallel() r := acctest.RandString(4) diff --git a/outscale/data_source_outscale_load_balancer_test.go b/outscale/data_source_outscale_load_balancer_test.go index fe7c9e718..47ccd16f6 100644 --- a/outscale/data_source_outscale_load_balancer_test.go +++ b/outscale/data_source_outscale_load_balancer_test.go @@ -27,12 +27,12 @@ func TestAccOthers_LBU_basic(t *testing.T) { }, IDRefreshName: "outscale_load_balancer.bar", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, + CheckDestroy: testAccCheckOutscaleLBUDestroy, Steps: []resource.TestStep{ { - Config: testAccDSOutscaleOAPILBUConfig(zone, number), + Config: testAccDSOutscaleLBUConfig(zone, number), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.dataLb", &conf), + testAccCheckOutscaleLBUExists("outscale_load_balancer.dataLb", &conf), resource.TestCheckResourceAttr( "data.outscale_load_balancer.dataTest", "subregion_names.#", "1"), resource.TestCheckResourceAttr( @@ -42,7 +42,7 @@ func TestAccOthers_LBU_basic(t *testing.T) { }) } -func testAccDSOutscaleOAPILBUConfig(zone string, number int) string { +func testAccDSOutscaleLBUConfig(zone string, number int) string { return fmt.Sprintf(` resource "outscale_load_balancer" "dataLb" { subregion_names = ["%s"] diff --git a/outscale/data_source_outscale_load_balancer_vm_health.go b/outscale/data_source_outscale_load_balancer_vm_health.go index 2abc983c1..2be2f13a1 100644 --- a/outscale/data_source_outscale_load_balancer_vm_health.go +++ b/outscale/data_source_outscale_load_balancer_vm_health.go @@ -15,9 +15,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleLoadBalancerVmsHeals() *schema.Resource { +func DataSourceOutscaleLoadBalancerVmsHeals() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleLoadBalancerVmsHealRead, + Read: DataSourceOutscaleLoadBalancerVmsHealRead, Schema: getDataSourceSchemas(map[string]*schema.Schema{ "load_balancer_name": { Type: schema.TypeString, @@ -63,7 +63,7 @@ func dataSourceOutscaleLoadBalancerVmsHeals() *schema.Resource { } } -func dataSourceOutscaleLoadBalancerVmsHealRead(d *schema.ResourceData, +func DataSourceOutscaleLoadBalancerVmsHealRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI diff --git a/outscale/data_source_outscale_load_balancer_vms.go b/outscale/data_source_outscale_load_balancer_vms.go index d7b6602d9..ba03d1333 100644 --- a/outscale/data_source_outscale_load_balancer_vms.go +++ b/outscale/data_source_outscale_load_balancer_vms.go @@ -5,9 +5,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleLoadBalancerVms() *schema.Resource { +func DataSourceOutscaleLoadBalancerVms() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleLoadBalancerVmsRead, + Read: DataSourceOutscaleLoadBalancerVmsRead, Schema: getDataSourceSchemas(map[string]*schema.Schema{ "load_balancer_name": { Type: schema.TypeString, @@ -29,7 +29,7 @@ func dataSourceOutscaleLoadBalancerVms() *schema.Resource { } } -func dataSourceOutscaleLoadBalancerVmsRead(d *schema.ResourceData, +func DataSourceOutscaleLoadBalancerVmsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI diff --git a/outscale/data_source_outscale_load_balancers.go b/outscale/data_source_outscale_load_balancers.go index f91d222b4..c1be2dbe3 100644 --- a/outscale/data_source_outscale_load_balancers.go +++ b/outscale/data_source_outscale_load_balancers.go @@ -191,15 +191,15 @@ func attrLBSchema() map[string]*schema.Schema { } } -func dataSourceOutscaleOAPILoadBalancers() *schema.Resource { +func DataSourceOutscaleLoadBalancers() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILoadBalancersRead, + Read: DataSourceOutscaleLoadBalancersRead, Schema: getDataSourceSchemas(attrLBSchema()), } } -func dataSourceOutscaleOAPILoadBalancersRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLoadBalancersRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI resp, _, err := readLbs_(conn, d, schema.TypeList) diff --git a/outscale/data_source_outscale_load_balancers_test.go b/outscale/data_source_outscale_load_balancers_test.go index 23d3a6f7a..5eae4f7f7 100644 --- a/outscale/data_source_outscale_load_balancers_test.go +++ b/outscale/data_source_outscale_load_balancers_test.go @@ -18,10 +18,10 @@ func TestAccOthers_LBUs_basic(t *testing.T) { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, + CheckDestroy: testAccCheckOutscaleLBUDestroy, Steps: []resource.TestStep{ { - Config: testAccDSOutscaleOAPILBsUConfig(region, numLbu), + Config: testAccDSOutscaleLBsUConfig(region, numLbu), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_load_balancers.test", "load_balancer.#", "1"), )}, @@ -29,7 +29,7 @@ func TestAccOthers_LBUs_basic(t *testing.T) { }) } -func testAccDSOutscaleOAPILBsUConfig(region string, numLbu int) string { +func testAccDSOutscaleLBsUConfig(region string, numLbu int) string { return fmt.Sprintf(` resource "outscale_load_balancer" "bars" { subregion_names = ["%s"] diff --git a/outscale/data_source_outscale_nat_service.go b/outscale/data_source_outscale_nat_service.go index 30c19a6aa..dc28a4217 100644 --- a/outscale/data_source_outscale_nat_service.go +++ b/outscale/data_source_outscale_nat_service.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPINatService() *schema.Resource { +func DataSourceOutscaleNatService() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPINatServiceRead, + Read: DataSourceOutscaleNatServiceRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -61,7 +61,7 @@ func dataSourceOutscaleOAPINatService() *schema.Resource { } } -func dataSourceOutscaleOAPINatServiceRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNatServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -74,7 +74,7 @@ func dataSourceOutscaleOAPINatServiceRead(d *schema.ResourceData, meta interface params := oscgo.ReadNatServicesRequest{} if filtersOk { - params.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) + params.SetFilters(buildOutscaleNatServiceDataSourceFilters(filters.(*schema.Set))) } if natGatewayIDOK && natGatewayID.(string) != "" { filter := oscgo.FiltersNatService{} @@ -163,7 +163,7 @@ func ngOAPIDescriptionAttributes(d *schema.ResourceData, ng oscgo.NatService) er return nil } -func buildOutscaleOAPINatServiceDataSourceFilters(set *schema.Set) oscgo.FiltersNatService { +func buildOutscaleNatServiceDataSourceFilters(set *schema.Set) oscgo.FiltersNatService { var filters oscgo.FiltersNatService for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_nat_service_test.go b/outscale/data_source_outscale_nat_service_test.go index 508224dd6..84a483a11 100644 --- a/outscale/data_source_outscale_nat_service_test.go +++ b/outscale/data_source_outscale_nat_service_test.go @@ -15,7 +15,7 @@ func TestAccNet_WithNatServiceDataSource_Instance(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPINatServiceDataSourceConfig, + Config: testAccCheckOutscaleNatServiceDataSourceConfig, Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleNatServiceDataSourceID("data.outscale_nat_service.nat"), resource.TestCheckResourceAttrSet("data.outscale_nat_service.nat", "subnet_id"), @@ -40,7 +40,7 @@ func testAccCheckOutscaleNatServiceDataSourceID(n string) resource.TestCheckFunc } } -const testAccCheckOutscaleOAPINatServiceDataSourceConfig = ` +const testAccCheckOutscaleNatServiceDataSourceConfig = ` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" tags { diff --git a/outscale/data_source_outscale_nat_services.go b/outscale/data_source_outscale_nat_services.go index 547f481af..a682837d1 100644 --- a/outscale/data_source_outscale_nat_services.go +++ b/outscale/data_source_outscale_nat_services.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPINatServices() *schema.Resource { +func DataSourceOutscaleNatServices() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPINatServicesRead, + Read: DataSourceOutscaleNatServicesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -74,7 +74,7 @@ func dataSourceOutscaleOAPINatServices() *schema.Resource { } } -func dataSourceOutscaleOAPINatServicesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNatServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -86,7 +86,7 @@ func dataSourceOutscaleOAPINatServicesRead(d *schema.ResourceData, meta interfac params := oscgo.ReadNatServicesRequest{} if filtersOk { - params.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) + params.SetFilters(buildOutscaleNatServiceDataSourceFilters(filters.(*schema.Set))) } if natGatewayIDOK { ids := make([]string, len(natGatewayID.([]interface{}))) diff --git a/outscale/data_source_outscale_nat_services_test.go b/outscale/data_source_outscale_nat_services_test.go index f81f6609e..935548fdf 100644 --- a/outscale/data_source_outscale_nat_services_test.go +++ b/outscale/data_source_outscale_nat_services_test.go @@ -13,7 +13,7 @@ func TestAccNet_WithNatServicesDataSource_Instance(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPINatServicesDataSourceConfig, + Config: testAccCheckOutscaleNatServicesDataSourceConfig, Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleNatServiceDataSourceID("data.outscale_nat_services.nat"), resource.TestCheckResourceAttr("data.outscale_nat_services.nat", "nat_services.#", "1"), @@ -24,7 +24,7 @@ func TestAccNet_WithNatServicesDataSource_Instance(t *testing.T) { }) } -const testAccCheckOutscaleOAPINatServicesDataSourceConfig = ` +const testAccCheckOutscaleNatServicesDataSourceConfig = ` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_net.go b/outscale/data_source_outscale_net.go index 2106bd439..ab8c2b9d5 100644 --- a/outscale/data_source_outscale_net.go +++ b/outscale/data_source_outscale_net.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVpc() *schema.Resource { +func DataSourceOutscaleVpc() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVpcRead, + Read: DataSourceOutscaleVpcRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -54,13 +54,13 @@ func dataSourceOutscaleOAPIVpc() *schema.Resource { } } -func dataSourceOutscaleOAPIVpcRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVpcRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadNetsRequest{} if v, ok := d.GetOk("filter"); ok { - req.SetFilters(buildOutscaleOAPIDataSourceNetFilters(v.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceNetFilters(v.(*schema.Set))) } if id := d.Get("net_id"); id != "" { @@ -112,7 +112,7 @@ func dataSourceOutscaleOAPIVpcRead(d *schema.ResourceData, meta interface{}) err return d.Set("tags", tagsOSCAPIToMap(net.GetTags())) } -func buildOutscaleOAPIDataSourceNetFilters(set *schema.Set) oscgo.FiltersNet { +func buildOutscaleDataSourceNetFilters(set *schema.Set) oscgo.FiltersNet { var filters oscgo.FiltersNet for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_net_access_point.go b/outscale/data_source_outscale_net_access_point.go index a11199012..778cfc9b8 100644 --- a/outscale/data_source_outscale_net_access_point.go +++ b/outscale/data_source_outscale_net_access_point.go @@ -44,15 +44,15 @@ func napdSchema() map[string]*schema.Schema { } } -func dataSourceOutscaleNetAccessPoint() *schema.Resource { +func DataSourceOutscaleNetAccessPoint() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleNetAccessPointRead, + Read: DataSourceOutscaleNetAccessPointRead, Schema: getDataSourceSchemas(napdSchema()), } } -func dataSourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_net_access_point_services.go b/outscale/data_source_outscale_net_access_point_services.go index 47e1faf0f..b1925bb1b 100644 --- a/outscale/data_source_outscale_net_access_point_services.go +++ b/outscale/data_source_outscale_net_access_point_services.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPINetAccessPointServices() *schema.Resource { +func DataSourceOutscaleNetAccessPointServices() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPINetAccessPointServicesRead, + Read: DataSourceOutscaleNetAccessPointServicesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "services": { @@ -46,7 +46,7 @@ func dataSourceOutscaleOAPINetAccessPointServices() *schema.Resource { } } -func dataSourceOutscaleOAPINetAccessPointServicesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNetAccessPointServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_net_access_point_services_test.go b/outscale/data_source_outscale_net_access_point_services_test.go index 161304544..616f26067 100644 --- a/outscale/data_source_outscale_net_access_point_services_test.go +++ b/outscale/data_source_outscale_net_access_point_services_test.go @@ -19,13 +19,13 @@ func TestAccNet_AccessPointServicesDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(serviceName), + Config: testAccDataSourceOutscaleNetAccessPointServicesConfig(serviceName), }, }, }) } -func testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(sName string) string { +func testAccDataSourceOutscaleNetAccessPointServicesConfig(sName string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_net_access_point_test.go b/outscale/data_source_outscale_net_access_point_test.go index 390f81a53..039b26693 100644 --- a/outscale/data_source_outscale_net_access_point_test.go +++ b/outscale/data_source_outscale_net_access_point_test.go @@ -19,13 +19,13 @@ func TestAccNet_AccessPointDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPINetAccessPointConfig(serviceName), + Config: testAccDataSourceOutscaleNetAccessPointConfig(serviceName), }, }, }) } -func testAccDataSourceOutscaleOAPINetAccessPointConfig(sName string) string { +func testAccDataSourceOutscaleNetAccessPointConfig(sName string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_net_access_points.go b/outscale/data_source_outscale_net_access_points.go index befe276f4..e5530ecbe 100644 --- a/outscale/data_source_outscale_net_access_points.go +++ b/outscale/data_source_outscale_net_access_points.go @@ -53,9 +53,9 @@ func napSchema() map[string]*schema.Schema { } } -func dataSourceOutscaleNetAccessPoints() *schema.Resource { +func DataSourceOutscaleNetAccessPoints() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleNetAccessPointsRead, + Read: DataSourceOutscaleNetAccessPointsRead, Schema: getDataSourceSchemas(napSchema()), } @@ -94,7 +94,7 @@ func buildOutscaleDataSourcesNAPFilters(set *schema.Set) oscgo.FiltersNetAccessP return filters } -func dataSourceOutscaleNetAccessPointsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNetAccessPointsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_net_access_points_test.go b/outscale/data_source_outscale_net_access_points_test.go index bbb98ff69..2c8e75e7c 100644 --- a/outscale/data_source_outscale_net_access_points_test.go +++ b/outscale/data_source_outscale_net_access_points_test.go @@ -19,13 +19,13 @@ func TestAccNet_AccessPointsDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPINetAccessPointsConfig(serviceName), + Config: testAccDataSourceOutscaleNetAccessPointsConfig(serviceName), }, }, }) } -func testAccDataSourceOutscaleOAPINetAccessPointsConfig(sName string) string { +func testAccDataSourceOutscaleNetAccessPointsConfig(sName string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_net_attributes.go b/outscale/data_source_outscale_net_attributes.go index 0853056f0..1f33d4c5f 100644 --- a/outscale/data_source_outscale_net_attributes.go +++ b/outscale/data_source_outscale_net_attributes.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVpcAttr() *schema.Resource { +func DataSourceOutscaleVpcAttr() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVpcAttrRead, + Read: DataSourceOutscaleVpcAttrRead, Schema: map[string]*schema.Schema{ //"filter": dataSourceFiltersSchema(), @@ -48,7 +48,7 @@ func dataSourceOutscaleOAPIVpcAttr() *schema.Resource { } } -func dataSourceOutscaleOAPIVpcAttrRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVpcAttrRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters := oscgo.FiltersNet{ diff --git a/outscale/data_source_outscale_net_attributes_test.go b/outscale/data_source_outscale_net_attributes_test.go index fb1761cd3..e42b39b4e 100644 --- a/outscale/data_source_outscale_net_attributes_test.go +++ b/outscale/data_source_outscale_net_attributes_test.go @@ -15,16 +15,16 @@ func TestAccNet_AttributesDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIDSLinAttrConfig, + Config: testAccOutscaleDSLinAttrConfig, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIVpcAttrCheck("data.outscale_net_attributes.test"), + testAccDataSourceOutscaleVpcAttrCheck("data.outscale_net_attributes.test"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIVpcAttrCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleVpcAttrCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -41,7 +41,7 @@ func testAccDataSourceOutscaleOAPIVpcAttrCheck(name string) resource.TestCheckFu } } -const testAccOutscaleOAPIDSLinAttrConfig = ` +const testAccOutscaleDSLinAttrConfig = ` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" tags { diff --git a/outscale/data_source_outscale_net_peering.go b/outscale/data_source_outscale_net_peering.go index d0428dea2..c0346687c 100644 --- a/outscale/data_source_outscale_net_peering.go +++ b/outscale/data_source_outscale_net_peering.go @@ -15,9 +15,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { +func DataSourceOutscaleLinPeeringConnection() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILinPeeringConnectionRead, + Read: DataSourceOutscaleLinPeeringConnectionRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -52,7 +52,7 @@ func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { } } -func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLinPeeringConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[DEBUG] Reading Net Peering Connections.") @@ -63,7 +63,7 @@ func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta if !filtersOk { return fmt.Errorf("filters must be assigned") } - filtersValues, err := buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set)) + filtersValues, err := buildOutscaleLinPeeringConnectionFilters(filters.(*schema.Set)) if err != nil { return err } @@ -143,7 +143,7 @@ func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta return nil } -func buildOutscaleOAPILinPeeringConnectionFilters(set *schema.Set) (oscgo.FiltersNetPeering, error) { +func buildOutscaleLinPeeringConnectionFilters(set *schema.Set) (oscgo.FiltersNetPeering, error) { var filters oscgo.FiltersNetPeering for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_net_peering_test.go b/outscale/data_source_outscale_net_peering_test.go index 54d16dd30..0d454a7da 100644 --- a/outscale/data_source_outscale_net_peering_test.go +++ b/outscale/data_source_outscale_net_peering_test.go @@ -15,16 +15,16 @@ func TestAccNet_PeeringConnectionDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPILinPeeringConnectionConfig, + Config: testAccDataSourceOutscaleLinPeeringConnectionConfig, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPILinPeeringConnectionCheck("outscale_net_peering.net_peering"), + testAccDataSourceOutscaleLinPeeringConnectionCheck("outscale_net_peering.net_peering"), ), }, }, }) } -func testAccDataSourceOutscaleOAPILinPeeringConnectionCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleLinPeeringConnectionCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -50,7 +50,7 @@ func testAccDataSourceOutscaleOAPILinPeeringConnectionCheck(name string) resourc } } -const testAccDataSourceOutscaleOAPILinPeeringConnectionConfig = ` +const testAccDataSourceOutscaleLinPeeringConnectionConfig = ` resource "outscale_net" "net" { ip_range = "10.10.0.0/24" tags { diff --git a/outscale/data_source_outscale_net_peerings.go b/outscale/data_source_outscale_net_peerings.go index 595c2bc97..2de65f62f 100644 --- a/outscale/data_source_outscale_net_peerings.go +++ b/outscale/data_source_outscale_net_peerings.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { +func DataSourceOutscaleLinPeeringsConnection() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILinPeeringsConnectionRead, + Read: DataSourceOutscaleLinPeeringsConnectionRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -59,7 +59,7 @@ func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { } } -func dataSourceOutscaleOAPILinPeeringsConnectionRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleLinPeeringsConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[DEBUG] Reading VPC Peering Connections.") @@ -70,7 +70,7 @@ func dataSourceOutscaleOAPILinPeeringsConnectionRead(d *schema.ResourceData, met } params := oscgo.ReadNetPeeringsRequest{} - filtersValues, err := buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set)) + filtersValues, err := buildOutscaleLinPeeringConnectionFilters(filters.(*schema.Set)) if err != nil { return err } diff --git a/outscale/data_source_outscale_net_peerings_test.go b/outscale/data_source_outscale_net_peerings_test.go index 36fdf8200..bb287f460 100644 --- a/outscale/data_source_outscale_net_peerings_test.go +++ b/outscale/data_source_outscale_net_peerings_test.go @@ -13,7 +13,7 @@ func TestAccNet_PeeringsConnectionDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPILinPeeringsConnectionConfig, + Config: testAccDataSourceOutscaleLinPeeringsConnectionConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_net_peerings.outscale_net_peerings", "net_peerings.#", "1"), ), @@ -22,7 +22,7 @@ func TestAccNet_PeeringsConnectionDataSource_basic(t *testing.T) { }) } -const testAccDataSourceOutscaleOAPILinPeeringsConnectionConfig = ` +const testAccDataSourceOutscaleLinPeeringsConnectionConfig = ` resource "outscale_net" "outscale_net" { ip_range = "10.10.0.0/24" tags { diff --git a/outscale/data_source_outscale_net_test.go b/outscale/data_source_outscale_net_test.go index 808a03dbd..711810e93 100644 --- a/outscale/data_source_outscale_net_test.go +++ b/outscale/data_source_outscale_net_test.go @@ -21,16 +21,16 @@ func TestAccNet_DataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag), + Config: testAccDataSourceOutscaleVpcConfig(ipRange, tag), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIVpcCheck("data.outscale_net.by_id", ipRange, tag), + testAccDataSourceOutscaleVpcCheck("data.outscale_net.by_id", ipRange, tag), ), }, }, }) } -func testAccDataSourceOutscaleOAPIVpcCheck(name, ipRange, tag string) resource.TestCheckFunc { +func testAccDataSourceOutscaleVpcCheck(name, ipRange, tag string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -60,7 +60,7 @@ func testAccDataSourceOutscaleOAPIVpcCheck(name, ipRange, tag string) resource.T } } -func testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag string) string { +func testAccDataSourceOutscaleVpcConfig(ipRange, tag string) string { return fmt.Sprintf(` resource "outscale_net" "test" { ip_range = "%s" diff --git a/outscale/data_source_outscale_nets.go b/outscale/data_source_outscale_nets.go index 41a0f5e32..da50e8899 100644 --- a/outscale/data_source_outscale_nets.go +++ b/outscale/data_source_outscale_nets.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVpcs() *schema.Resource { +func DataSourceOutscaleVpcs() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVpcsRead, + Read: DataSourceOutscaleVpcsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -64,7 +64,7 @@ func dataSourceOutscaleOAPIVpcs() *schema.Resource { } } -func dataSourceOutscaleOAPIVpcsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVpcsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadNetsRequest{} @@ -77,7 +77,7 @@ func dataSourceOutscaleOAPIVpcsRead(d *schema.ResourceData, meta interface{}) er } if filtersOk { - req.SetFilters(buildOutscaleOAPIDataSourceNetFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceNetFilters(filters.(*schema.Set))) } if netIdsOk { diff --git a/outscale/data_source_outscale_nets_test.go b/outscale/data_source_outscale_nets_test.go index 3a82af91b..303f75542 100644 --- a/outscale/data_source_outscale_nets_test.go +++ b/outscale/data_source_outscale_nets_test.go @@ -20,7 +20,7 @@ func TestAccNets_DataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVpcsConfig(ipRange, tag), + Config: testAccDataSourceOutscaleVpcsConfig(ipRange, tag), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_nets.by_id", "nets.#", "1"), ), @@ -29,7 +29,7 @@ func TestAccNets_DataSource_basic(t *testing.T) { }) } -func testAccDataSourceOutscaleOAPIVpcsConfig(ipRange, tag string) string { +func testAccDataSourceOutscaleVpcsConfig(ipRange, tag string) string { return fmt.Sprintf(` resource "outscale_net" "test" { ip_range = "%s" diff --git a/outscale/data_source_outscale_nic.go b/outscale/data_source_outscale_nic.go index 3a0853d94..edfaa55a5 100644 --- a/outscale/data_source_outscale_nic.go +++ b/outscale/data_source_outscale_nic.go @@ -17,9 +17,9 @@ import ( ) // Creates a network interface in the specified subnet -func dataSourceOutscaleOAPINic() *schema.Resource { +func DataSourceOutscaleNic() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPINicRead, + Read: DataSourceOutscaleNicRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -213,7 +213,7 @@ func dataSourceOutscaleOAPINic() *schema.Resource { } // Read Nic -func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNicRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, okFilters := d.GetOk("filter") @@ -224,7 +224,7 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err dnri := oscgo.ReadNicsRequest{} if okFilters { - dnri.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) + dnri.SetFilters(buildOutscaleDataSourceNicFilters(filters.(*schema.Set))) } var resp oscgo.ReadNicsResponse @@ -351,7 +351,7 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err return nil } -func buildOutscaleOAPIDataSourceNicFilters(set *schema.Set) oscgo.FiltersNic { +func buildOutscaleDataSourceNicFilters(set *schema.Set) oscgo.FiltersNic { var filters oscgo.FiltersNic for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_nic_test.go b/outscale/data_source_outscale_nic_test.go index f7e511f41..85763a760 100644 --- a/outscale/data_source_outscale_nic_test.go +++ b/outscale/data_source_outscale_nic_test.go @@ -23,13 +23,13 @@ func TestAccNet_WithNicDataSource_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, + CheckDestroy: testAccCheckOutscaleENIDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIENIDataSourceConfig(utils.GetRegion()), + Config: testAccOutscaleENIDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, utils.GetRegion()), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIAttributes(&conf, utils.GetRegion()), ), }, }, @@ -44,20 +44,20 @@ func TestAccNet_WithNicDataSource_basicFilter(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, + CheckDestroy: testAccCheckOutscaleENIDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIENIDataSourceConfigFilter(utils.GetRegion()), + Config: testAccOutscaleENIDataSourceConfigFilter(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, utils.GetRegion()), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIAttributes(&conf, utils.GetRegion()), ), }, }, }) } -func testAccCheckOutscaleOAPIENIDestroy(s *terraform.State) error { +func testAccCheckOutscaleENIDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "outscale_nic" { continue @@ -90,7 +90,7 @@ func testAccCheckOutscaleOAPIENIDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPINICDestroy(s *terraform.State) error { +func testAccCheckOutscaleNICDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "outscale_nic" { continue @@ -129,7 +129,7 @@ func testAccCheckOutscaleOAPINICDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { +func testAccOutscaleENIDataSourceConfig(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -172,7 +172,7 @@ func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { `, subregion) } -func testAccOutscaleOAPIENIDataSourceConfigFilter(subregion string) string { +func testAccOutscaleENIDataSourceConfigFilter(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_nics.go b/outscale/data_source_outscale_nics.go index 6fa3e204b..69f794e77 100644 --- a/outscale/data_source_outscale_nics.go +++ b/outscale/data_source_outscale_nics.go @@ -13,9 +13,9 @@ import ( ) // Creates a network interface in the specified subnet -func dataSourceOutscaleOAPINics() *schema.Resource { +func DataSourceOutscaleNics() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPINicsRead, + Read: DataSourceOutscaleNicsRead, Schema: getDSOAPINicsSchema(), } } @@ -219,14 +219,14 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { } // Read Nic -func dataSourceOutscaleOAPINicsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleNicsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") params := oscgo.ReadNicsRequest{} if filtersOk { - params.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) + params.SetFilters(buildOutscaleDataSourceNicFilters(filters.(*schema.Set))) } var resp oscgo.ReadNicsResponse diff --git a/outscale/data_source_outscale_nics_test.go b/outscale/data_source_outscale_nics_test.go index cce4a85a6..dbed8a409 100644 --- a/outscale/data_source_outscale_nics_test.go +++ b/outscale/data_source_outscale_nics_test.go @@ -15,7 +15,7 @@ func TestAccNet_WithNicsDataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPINicsDataSourceConfig(utils.GetRegion()), + Config: testAccCheckOutscaleNicsDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_nics.outscale_nics", "nics.#", "1"), ), @@ -24,7 +24,7 @@ func TestAccNet_WithNicsDataSource(t *testing.T) { }) } -func testAccCheckOutscaleOAPINicsDataSourceConfig(subregion string) string { +func testAccCheckOutscaleNicsDataSourceConfig(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_product_type.go b/outscale/data_source_outscale_product_type.go index 308144e56..0e8e4dd42 100644 --- a/outscale/data_source_outscale_product_type.go +++ b/outscale/data_source_outscale_product_type.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIProductType() *schema.Resource { +func DataSourceOutscaleProductType() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIProductTypeRead, + Read: DataSourceOutscaleProductTypeRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -39,7 +39,7 @@ func dataSourceOutscaleOAPIProductType() *schema.Resource { } } -func dataSourceOutscaleOAPIProductTypeRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleProductTypeRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadProductTypesRequest{} @@ -47,7 +47,7 @@ func dataSourceOutscaleOAPIProductTypeRead(d *schema.ResourceData, meta interfac filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIProductTypeDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleProductTypeDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadProductTypesResponse @@ -90,7 +90,7 @@ func dataSourceOutscaleOAPIProductTypeRead(d *schema.ResourceData, meta interfac return nil } -func buildOutscaleOAPIProductTypeDataSourceFilters(set *schema.Set) *oscgo.FiltersProductType { +func buildOutscaleProductTypeDataSourceFilters(set *schema.Set) *oscgo.FiltersProductType { var filters oscgo.FiltersProductType for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_product_type_test.go b/outscale/data_source_outscale_product_type_test.go index d89d59945..2ade51910 100644 --- a/outscale/data_source_outscale_product_type_test.go +++ b/outscale/data_source_outscale_product_type_test.go @@ -13,14 +13,14 @@ func TestAccOthers_DataSourceProductType(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIProductTypeConfig, + Config: testAccDataSourceOutscaleProductTypeConfig, Check: resource.ComposeTestCheckFunc(), }, }, }) } -const testAccDataSourceOutscaleOAPIProductTypeConfig = ` +const testAccDataSourceOutscaleProductTypeConfig = ` data "outscale_product_type" "test" { filter { name = "product_type_ids" diff --git a/outscale/data_source_outscale_product_types.go b/outscale/data_source_outscale_product_types.go index f0d8f7589..5703871ec 100644 --- a/outscale/data_source_outscale_product_types.go +++ b/outscale/data_source_outscale_product_types.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIProductTypes() *schema.Resource { +func DataSourceOutscaleProductTypes() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIProductTypesRead, + Read: DataSourceOutscaleProductTypesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -46,7 +46,7 @@ func dataSourceOutscaleOAPIProductTypes() *schema.Resource { } } -func dataSourceOutscaleOAPIProductTypesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleProductTypesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadProductTypesRequest{} @@ -54,7 +54,7 @@ func dataSourceOutscaleOAPIProductTypesRead(d *schema.ResourceData, meta interfa filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIProductTypeDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleProductTypeDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadProductTypesResponse diff --git a/outscale/data_source_outscale_product_types_test.go b/outscale/data_source_outscale_product_types_test.go index 1ef0203d7..29ac294c5 100644 --- a/outscale/data_source_outscale_product_types_test.go +++ b/outscale/data_source_outscale_product_types_test.go @@ -13,12 +13,12 @@ func TestAccOthers_DataSourceProductTypes(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIProductTypesConfig, + Config: testAccDataSourceOutscaleProductTypesConfig, Check: resource.ComposeTestCheckFunc(), }, }, }) } -const testAccDataSourceOutscaleOAPIProductTypesConfig = ` +const testAccDataSourceOutscaleProductTypesConfig = ` data "outscale_product_types" "all" {}` diff --git a/outscale/data_source_outscale_public_catalog.go b/outscale/data_source_outscale_public_catalog.go index 3145e8057..33dd355ad 100644 --- a/outscale/data_source_outscale_public_catalog.go +++ b/outscale/data_source_outscale_public_catalog.go @@ -11,9 +11,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIPublicCatalog() *schema.Resource { +func DataSourceOutscalePublicCatalog() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIPublicCatalogRead, + Read: DataSourceOutscalePublicCatalogRead, Schema: map[string]*schema.Schema{ "catalog": { Type: schema.TypeSet, @@ -71,7 +71,7 @@ func dataSourceOutscaleOAPIPublicCatalog() *schema.Resource { } } -func dataSourceOutscaleOAPIPublicCatalogRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscalePublicCatalogRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadPublicCatalogRequest{} diff --git a/outscale/data_source_outscale_public_catalog_test.go b/outscale/data_source_outscale_public_catalog_test.go index 1c18eeaf6..a844e9053 100644 --- a/outscale/data_source_outscale_public_catalog_test.go +++ b/outscale/data_source_outscale_public_catalog_test.go @@ -16,13 +16,13 @@ func TestAccOthers_DataSourcePublicCatalog_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicCatalogConfig(), + Config: testAccDataSourceOutscalePublicCatalogConfig(), }, }, }) } -func testAccDataSourceOutscaleOAPIPublicCatalogConfig() string { +func testAccDataSourceOutscalePublicCatalogConfig() string { return fmt.Sprintf(` data "outscale_public_catalog" "catalog" { } `) diff --git a/outscale/data_source_outscale_public_ip.go b/outscale/data_source_outscale_public_ip.go index 820380aba..3b5ffa4b3 100644 --- a/outscale/data_source_outscale_public_ip.go +++ b/outscale/data_source_outscale_public_ip.go @@ -14,9 +14,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIPublicIP() *schema.Resource { +func DataSourceOutscalePublicIP() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIPublicIPRead, + Read: DataSourceOutscalePublicIPRead, Schema: getOAPIPublicIPDataSourceSchema(), } } @@ -63,7 +63,7 @@ func getOAPIPublicIPDataSourceSchema() map[string]*schema.Schema { } } -func dataSourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscalePublicIPRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadPublicIpsRequest{ @@ -80,7 +80,7 @@ func dataSourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{} filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIDataSourcePublicIpsFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleDataSourcePublicIpsFilters(filters.(*schema.Set)) } var response oscgo.ReadPublicIpsResponse @@ -147,7 +147,7 @@ func dataSourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{} return nil } -func buildOutscaleOAPIDataSourcePublicIpsFilters(set *schema.Set) *oscgo.FiltersPublicIp { +func buildOutscaleDataSourcePublicIpsFilters(set *schema.Set) *oscgo.FiltersPublicIp { var filters oscgo.FiltersPublicIp for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_public_ip_test.go b/outscale/data_source_outscale_public_ip_test.go index ccf8dcb1f..3061e150d 100644 --- a/outscale/data_source_outscale_public_ip_test.go +++ b/outscale/data_source_outscale_public_ip_test.go @@ -17,10 +17,10 @@ func TestAccOthers_DataSourcePublicIP(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPConfig, + Config: testAccDataSourceOutscalePublicIPConfig, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIPublicIPCheck("data.outscale_public_ip.by_public_ip_id"), - testAccDataSourceOutscaleOAPIPublicIPCheck("data.outscale_public_ip.by_public_ip"), + testAccDataSourceOutscalePublicIPCheck("data.outscale_public_ip.by_public_ip_id"), + testAccDataSourceOutscalePublicIPCheck("data.outscale_public_ip.by_public_ip"), ), }, }, @@ -36,13 +36,13 @@ func TestAccVM_WithPublicIP(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPConfigwithVM(omi, utils.GetRegion()), + Config: testAccDataSourceOutscalePublicIPConfigwithVM(omi, utils.GetRegion()), }, }, }) } -func testAccDataSourceOutscaleOAPIPublicIPCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscalePublicIPCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -84,13 +84,13 @@ func TestAccOthers_DataSourcePublicIP_withTags(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPConfigWithTags, + Config: testAccDataSourceOutscalePublicIPConfigWithTags, }, }, }) } -const testAccDataSourceOutscaleOAPIPublicIPConfig = ` +const testAccDataSourceOutscalePublicIPConfig = ` resource "outscale_public_ip" "test" {} data "outscale_public_ip" "by_public_ip_id" { @@ -105,7 +105,7 @@ const testAccDataSourceOutscaleOAPIPublicIPConfig = ` } ` -const testAccDataSourceOutscaleOAPIPublicIPConfigWithTags = ` +const testAccDataSourceOutscalePublicIPConfigWithTags = ` resource "outscale_public_ip" "outscale_public_ip" { tags { key = "name" @@ -126,7 +126,7 @@ const testAccDataSourceOutscaleOAPIPublicIPConfigWithTags = ` } ` -func testAccDataSourceOutscaleOAPIPublicIPConfigwithVM(omi, region string) string { +func testAccDataSourceOutscalePublicIPConfigwithVM(omi, region string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_Pbip" { security_group_name = "sg_data_ip" diff --git a/outscale/data_source_outscale_public_ips.go b/outscale/data_source_outscale_public_ips.go index d4cb9ead9..e32bdf031 100644 --- a/outscale/data_source_outscale_public_ips.go +++ b/outscale/data_source_outscale_public_ips.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIPublicIPS() *schema.Resource { +func DataSourceOutscalePublicIPS() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscalePublicIPSRead, + Read: DataSourceOutscalePublicIPSRead, Schema: oapiGetPublicIPSDataSourceSchema(), } } @@ -68,7 +68,7 @@ func oapiGetPublicIPSDataSourceSchema() map[string]*schema.Schema { } } -func dataSourceOutscalePublicIPSRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscalePublicIPSRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadPublicIpsRequest{} @@ -76,7 +76,7 @@ func dataSourceOutscalePublicIPSRead(d *schema.ResourceData, meta interface{}) e filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIDataSourcePublicIpsFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleDataSourcePublicIpsFilters(filters.(*schema.Set)) } var resp oscgo.ReadPublicIpsResponse diff --git a/outscale/data_source_outscale_public_ips_test.go b/outscale/data_source_outscale_public_ips_test.go index ed34a98e0..ca56910a1 100644 --- a/outscale/data_source_outscale_public_ips_test.go +++ b/outscale/data_source_outscale_public_ips_test.go @@ -14,7 +14,7 @@ func TestAccOthers_DataSourcePublicIPS(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPSConfig, + Config: testAccDataSourceOutscalePublicIPSConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet( "data.outscale_public_ips.by_public_ips", "public_ips.0.public_ip"), @@ -36,7 +36,7 @@ func TestAccOthers_DataSourcePublicIPS_withTags(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPSConfigWithTags, + Config: testAccDataSourceOutscalePublicIPSConfigWithTags, }, }, }) @@ -45,7 +45,7 @@ func TestAccOthers_DataSourcePublicIPS_withTags(t *testing.T) { } } -const testAccDataSourceOutscaleOAPIPublicIPSConfig = ` +const testAccDataSourceOutscalePublicIPSConfig = ` resource "outscale_public_ip" "test" {} resource "outscale_public_ip" "test1" {} resource "outscale_public_ip" "test2" {} @@ -58,7 +58,7 @@ const testAccDataSourceOutscaleOAPIPublicIPSConfig = ` } ` -const testAccDataSourceOutscaleOAPIPublicIPSConfigWithTags = ` +const testAccDataSourceOutscalePublicIPSConfigWithTags = ` resource "outscale_public_ip" "outscale_public_ip" { tags { key = "name" diff --git a/outscale/data_source_outscale_quota.go b/outscale/data_source_outscale_quota.go index ee323e674..80909b06e 100644 --- a/outscale/data_source_outscale_quota.go +++ b/outscale/data_source_outscale_quota.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIQuota() *schema.Resource { +func DataSourceOutscaleQuota() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIQuotaRead, + Read: DataSourceOutscaleQuotaRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -58,14 +58,14 @@ func dataSourceOutscaleOAPIQuota() *schema.Resource { } } -func dataSourceOutscaleOAPIQuotaRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleQuotaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadQuotasRequest{} filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIQuotaDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleQuotaDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadQuotasResponse diff --git a/outscale/data_source_outscale_quotas.go b/outscale/data_source_outscale_quotas.go index 0c0613bb5..b9c29fa4e 100644 --- a/outscale/data_source_outscale_quotas.go +++ b/outscale/data_source_outscale_quotas.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIQuotas() *schema.Resource { +func DataSourceOutscaleQuotas() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIQuotasRead, + Read: DataSourceOutscaleQuotasRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -67,7 +67,7 @@ func dataSourceOutscaleOAPIQuotas() *schema.Resource { } } -func dataSourceOutscaleOAPIQuotasRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleQuotasRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadQuotasRequest{} @@ -75,7 +75,7 @@ func dataSourceOutscaleOAPIQuotasRead(d *schema.ResourceData, meta interface{}) filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPIQuotaDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleQuotaDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadQuotasResponse @@ -143,7 +143,7 @@ func dataSourceOutscaleOAPIQuotasRead(d *schema.ResourceData, meta interface{}) return nil } -func buildOutscaleOAPIQuotaDataSourceFilters(set *schema.Set) *oscgo.FiltersQuota { +func buildOutscaleQuotaDataSourceFilters(set *schema.Set) *oscgo.FiltersQuota { var filters oscgo.FiltersQuota for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_quotas_test.go b/outscale/data_source_outscale_quotas_test.go index eb2143fd5..5b247ad5b 100644 --- a/outscale/data_source_outscale_quotas_test.go +++ b/outscale/data_source_outscale_quotas_test.go @@ -13,13 +13,13 @@ func TestAccOthers_DataSourcesQuotas(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourcesOutscaleOAPIQuotasConfig, + Config: testAccDataSourcesOutscaleQuotasConfig, Check: resource.ComposeTestCheckFunc(), }, }, }) } -const testAccDataSourcesOutscaleOAPIQuotasConfig = ` +const testAccDataSourcesOutscaleQuotasConfig = ` data "outscale_quotas" "all-quotas" {} ` diff --git a/outscale/data_source_outscale_regions.go b/outscale/data_source_outscale_regions.go index e1ddfff87..2047e7903 100644 --- a/outscale/data_source_outscale_regions.go +++ b/outscale/data_source_outscale_regions.go @@ -10,9 +10,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIRegions() *schema.Resource { +func DataSourceOutscaleRegions() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIRegionsRead, + Read: DataSourceOutscaleRegionsRead, Schema: map[string]*schema.Schema{ "request_id": { Type: schema.TypeString, @@ -38,7 +38,7 @@ func dataSourceOutscaleOAPIRegions() *schema.Resource { } } -func dataSourceOutscaleOAPIRegionsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleRegionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.ReadRegionsResponse diff --git a/outscale/data_source_outscale_regions_test.go b/outscale/data_source_outscale_regions_test.go index 253f26eb6..787c356c7 100644 --- a/outscale/data_source_outscale_regions_test.go +++ b/outscale/data_source_outscale_regions_test.go @@ -17,16 +17,16 @@ func TestAccOthers_RegionsDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIRegionsDataSourceConfig, + Config: testAccCheckOutscaleRegionsDataSourceConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRegionsDataSourceID("data.outscale_regions.regions"), + testAccCheckOutscaleRegionsDataSourceID("data.outscale_regions.regions"), ), }, }, }) } -func testAccCheckOutscaleOAPIRegionsDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleRegionsDataSourceID(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -40,6 +40,6 @@ func testAccCheckOutscaleOAPIRegionsDataSourceID(n string) resource.TestCheckFun } } -var testAccCheckOutscaleOAPIRegionsDataSourceConfig = ` +var testAccCheckOutscaleRegionsDataSourceConfig = ` data "outscale_regions" "regions" {} ` diff --git a/outscale/data_source_outscale_route_table.go b/outscale/data_source_outscale_route_table.go index a297f343c..3b77ca2cd 100644 --- a/outscale/data_source_outscale_route_table.go +++ b/outscale/data_source_outscale_route_table.go @@ -15,9 +15,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIRouteTable() *schema.Resource { +func DataSourceOutscaleRouteTable() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIRouteTableRead, + Read: DataSourceOutscaleRouteTableRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -131,7 +131,7 @@ func dataSourceOutscaleOAPIRouteTable() *schema.Resource { } } -func dataSourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleRouteTableRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI routeTableID, routeTableIDOk := d.GetOk("route_table_id") filter, filterOk := d.GetOk("filter") @@ -148,7 +148,7 @@ func dataSourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface } if filterOk { - params.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) + params.Filters = buildOutscaleDataSourceRouteTableFilters(filter.(*schema.Set)) } var resp oscgo.ReadRouteTablesResponse @@ -196,7 +196,7 @@ func dataSourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface return d.Set("link_route_tables", setOSCAPILinkRouteTables(rt.GetLinkRouteTables())) } -func buildOutscaleOAPIDataSourceRouteTableFilters(set *schema.Set) *oscgo.FiltersRouteTable { +func buildOutscaleDataSourceRouteTableFilters(set *schema.Set) *oscgo.FiltersRouteTable { var filters oscgo.FiltersRouteTable for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_route_table_test.go b/outscale/data_source_outscale_route_table_test.go index 6af78f189..6783edb3a 100644 --- a/outscale/data_source_outscale_route_table_test.go +++ b/outscale/data_source_outscale_route_table_test.go @@ -14,17 +14,17 @@ func TestAccNet_WithRouteTableDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIRouteTableGroupConfig, + Config: testAccDataSourceOutscaleRouteTableGroupConfig, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_filter"), - testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_id"), + testAccDataSourceOutscaleRouteTableCheck("data.outscale_route_table.by_filter"), + testAccDataSourceOutscaleRouteTableCheck("data.outscale_route_table.by_id"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIRouteTableCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleRouteTableCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -83,7 +83,7 @@ func testAccDataSourceOutscaleOAPIRouteTableCheck(name string) resource.TestChec } } -const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` +const testAccDataSourceOutscaleRouteTableGroupConfig = ` resource "outscale_net" "test" { ip_range = "172.16.0.0/16" diff --git a/outscale/data_source_outscale_route_tables.go b/outscale/data_source_outscale_route_tables.go index 19dbbec0a..3889dae92 100644 --- a/outscale/data_source_outscale_route_tables.go +++ b/outscale/data_source_outscale_route_tables.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIRouteTables() *schema.Resource { +func DataSourceOutscaleRouteTables() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIRouteTablesRead, + Read: DataSourceOutscaleRouteTablesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -140,7 +140,7 @@ func dataSourceOutscaleOAPIRouteTables() *schema.Resource { } } -func dataSourceOutscaleOAPIRouteTablesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleRouteTablesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI rtbID, rtbOk := d.GetOk("route_table_id") filter, filterOk := d.GetOk("filter") @@ -164,7 +164,7 @@ func dataSourceOutscaleOAPIRouteTablesRead(d *schema.ResourceData, meta interfac } if filterOk { - params.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) + params.Filters = buildOutscaleDataSourceRouteTableFilters(filter.(*schema.Set)) } var resp oscgo.ReadRouteTablesResponse diff --git a/outscale/data_source_outscale_route_tables_test.go b/outscale/data_source_outscale_route_tables_test.go index 5a7ade712..569bd7eab 100644 --- a/outscale/data_source_outscale_route_tables_test.go +++ b/outscale/data_source_outscale_route_tables_test.go @@ -13,7 +13,7 @@ func TestAccNet_WithRouteTablesDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIRouteTablesGroupConfig, + Config: testAccDataSourceOutscaleRouteTablesGroupConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_route_tables.by_filter", "route_tables.#", "1"), resource.TestCheckResourceAttr("data.outscale_route_tables.by_id", "route_tables.#", "1"), @@ -23,7 +23,7 @@ func TestAccNet_WithRouteTablesDataSource_basic(t *testing.T) { }) } -const testAccDataSourceOutscaleOAPIRouteTablesGroupConfig = ` +const testAccDataSourceOutscaleRouteTablesGroupConfig = ` resource "outscale_net" "test" { ip_range = "172.16.0.0/16" diff --git a/outscale/data_source_outscale_security_group.go b/outscale/data_source_outscale_security_group.go index dd38393f5..0dea77526 100644 --- a/outscale/data_source_outscale_security_group.go +++ b/outscale/data_source_outscale_security_group.go @@ -14,9 +14,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { +func DataSourceOutscaleSecurityGroup() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISecurityGroupRead, + Read: DataSourceOutscaleSecurityGroupRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -157,7 +157,7 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { } } -func dataSourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSecurityGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSecurityGroupsRequest{} @@ -177,7 +177,7 @@ func dataSourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interf } if filtersOk { - req.SetFilters(buildOutscaleOAPIDataSourceSecurityGroupFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceSecurityGroupFilters(filters.(*schema.Set))) } var err error @@ -240,7 +240,7 @@ func dataSourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interf return d.Set("outbound_rules", flattenOAPISecurityGroupRule(sg.GetOutboundRules())) } -func buildOutscaleOAPIDataSourceSecurityGroupFilters(set *schema.Set) oscgo.FiltersSecurityGroup { +func buildOutscaleDataSourceSecurityGroupFilters(set *schema.Set) oscgo.FiltersSecurityGroup { var filters oscgo.FiltersSecurityGroup for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_security_group_test.go b/outscale/data_source_outscale_security_group_test.go index 276a58b90..efa1a168f 100644 --- a/outscale/data_source_outscale_security_group_test.go +++ b/outscale/data_source_outscale_security_group_test.go @@ -17,10 +17,10 @@ func TestAccNet_WithSecurityGroupDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt), + Config: testAccDataSourceOutscaleSecurityGroupConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_id"), - //testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_filter"), + testAccDataSourceOutscaleSecurityGroupCheck("data.outscale_security_group.by_id"), + //testAccDataSourceOutscaleSecurityGroupCheck("data.outscale_security_group.by_filter"), ), }, }, @@ -35,16 +35,16 @@ func TestAccNet_WithSecurityGroupPublic_(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISecurityGroupPublicConfig(rInt), + Config: testAccDataSourceOutscaleSecurityGroupPublicConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_filter_public"), + testAccDataSourceOutscaleSecurityGroupCheck("data.outscale_security_group.by_filter_public"), ), }, }, }) } -func testAccDataSourceOutscaleOAPISecurityGroupCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleSecurityGroupCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -75,7 +75,7 @@ func testAccDataSourceOutscaleOAPISecurityGroupCheck(name string) resource.TestC } } -func testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt int) string { +func testAccDataSourceOutscaleSecurityGroupConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" @@ -107,7 +107,7 @@ func testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt int) string { #}`, rInt, rInt) } -func testAccDataSourceOutscaleOAPISecurityGroupPublicConfig(rInt int) string { +func testAccDataSourceOutscaleSecurityGroupPublicConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_security_group" "test" { description = "Used in the terraform acceptance tests" diff --git a/outscale/data_source_outscale_security_groups.go b/outscale/data_source_outscale_security_groups.go index 068cb2ddf..8c48651ed 100644 --- a/outscale/data_source_outscale_security_groups.go +++ b/outscale/data_source_outscale_security_groups.go @@ -14,9 +14,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { +func DataSourceOutscaleSecurityGroups() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISecurityGroupsRead, + Read: DataSourceOutscaleSecurityGroupsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -177,7 +177,7 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { } } -func dataSourceOutscaleOAPISecurityGroupsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSecurityGroupsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSecurityGroupsRequest{} @@ -205,7 +205,7 @@ func dataSourceOutscaleOAPISecurityGroupsRead(d *schema.ResourceData, meta inter } if filtersOk { - req.SetFilters(buildOutscaleOAPIDataSourceSecurityGroupFilters(filters.(*schema.Set))) + req.SetFilters(buildOutscaleDataSourceSecurityGroupFilters(filters.(*schema.Set))) } var err error diff --git a/outscale/data_source_outscale_security_groups_test.go b/outscale/data_source_outscale_security_groups_test.go index 91426df73..f521efcef 100644 --- a/outscale/data_source_outscale_security_groups_test.go +++ b/outscale/data_source_outscale_security_groups_test.go @@ -15,7 +15,7 @@ func TestAccNet_WIthSecurityGroups_DataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISecurityGroupConfigVPC(rInt), + Config: testAccDataSourceOutscaleSecurityGroupConfigVPC(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "data.outscale_security_groups.by_id", "security_groups.#", "3"), @@ -27,7 +27,7 @@ func TestAccNet_WIthSecurityGroups_DataSource(t *testing.T) { }) } -func testAccDataSourceOutscaleOAPISecurityGroupConfigVPC(rInt int) string { +func testAccDataSourceOutscaleSecurityGroupConfigVPC(rInt int) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_server_certificate.go b/outscale/data_source_outscale_server_certificate.go index ac57880cc..e45191526 100644 --- a/outscale/data_source_outscale_server_certificate.go +++ b/outscale/data_source_outscale_server_certificate.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOAPIServerCertificate() *schema.Resource { +func DataSourceOutscaleServerCertificate() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOAPIServerCertificateRead, + Read: DataSourceOutscaleServerCertificateRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "expiration_date": { @@ -46,7 +46,7 @@ func datasourceOutscaleOAPIServerCertificate() *schema.Resource { } } -func datasourceOutscaleOAPIServerCertificateRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleServerCertificateRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_server_certificate_test.go b/outscale/data_source_outscale_server_certificate_test.go index 00e39559b..14b2e9a33 100644 --- a/outscale/data_source_outscale_server_certificate_test.go +++ b/outscale/data_source_outscale_server_certificate_test.go @@ -100,13 +100,13 @@ kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIServerCertificateDatasourceConfig(rName, body, private), + Config: testAccOutscaleServerCertificateDatasourceConfig(rName, body, private), }, }, }) } -func testAccOutscaleOAPIServerCertificateDatasourceConfig(name, body, privateKey string) string { +func testAccOutscaleServerCertificateDatasourceConfig(name, body, privateKey string) string { return fmt.Sprintf(` resource "outscale_server_certificate" "test" { name = %[1]q diff --git a/outscale/data_source_outscale_server_certificates.go b/outscale/data_source_outscale_server_certificates.go index 13791e1a4..772a0290c 100644 --- a/outscale/data_source_outscale_server_certificates.go +++ b/outscale/data_source_outscale_server_certificates.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func datasourceOutscaleOAPIServerCertificates() *schema.Resource { +func DataSourceOutscaleServerCertificates() *schema.Resource { return &schema.Resource{ - Read: datasourceOutscaleOAPIServerCertificatesRead, + Read: DataSourceOutscaleServerCertificatesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "server_certificates": { @@ -57,7 +57,7 @@ func datasourceOutscaleOAPIServerCertificates() *schema.Resource { } } -func datasourceOutscaleOAPIServerCertificatesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleServerCertificatesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_server_certificates_test.go b/outscale/data_source_outscale_server_certificates_test.go index 355f12771..afe42af95 100644 --- a/outscale/data_source_outscale_server_certificates_test.go +++ b/outscale/data_source_outscale_server_certificates_test.go @@ -100,13 +100,13 @@ kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIServerCertificatesDatasourceConfig(rName, body, private), + Config: testAccOutscaleServerCertificatesDatasourceConfig(rName, body, private), }, }, }) } -func testAccOutscaleOAPIServerCertificatesDatasourceConfig(name, body, privateKey string) string { +func testAccOutscaleServerCertificatesDatasourceConfig(name, body, privateKey string) string { return fmt.Sprintf(` resource "outscale_server_certificate" "test" { name = %[1]q diff --git a/outscale/data_source_outscale_snapshot.go b/outscale/data_source_outscale_snapshot.go index 8f263a230..481bb8d93 100644 --- a/outscale/data_source_outscale_snapshot.go +++ b/outscale/data_source_outscale_snapshot.go @@ -14,9 +14,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPISnapshot() *schema.Resource { +func DataSourceOutscaleSnapshot() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISnapshotRead, + Read: DataSourceOutscaleSnapshotRead, Schema: map[string]*schema.Schema{ //selection criteria @@ -87,7 +87,7 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { } } -func dataSourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSnapshotRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI restorableUsers, restorableUsersOk := d.GetOk("permission_to_create_volume") diff --git a/outscale/data_source_outscale_snapshot_export_task.go b/outscale/data_source_outscale_snapshot_export_task.go index 55433108e..ac5e40104 100644 --- a/outscale/data_source_outscale_snapshot_export_task.go +++ b/outscale/data_source_outscale_snapshot_export_task.go @@ -12,7 +12,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPISnapshotExportTask() *schema.Resource { +func DataSourceOutscaleSnapshotExportTask() *schema.Resource { return &schema.Resource{ Read: dataSourceOAPISnapshotExportTaskRead, Importer: &schema.ResourceImporter{ diff --git a/outscale/data_source_outscale_snapshot_export_task_test.go b/outscale/data_source_outscale_snapshot_export_task_test.go index d9af73e4a..da5fefadc 100644 --- a/outscale/data_source_outscale_snapshot_export_task_test.go +++ b/outscale/data_source_outscale_snapshot_export_task_test.go @@ -20,7 +20,7 @@ func TestAccOthers_SnapshotExportTaskDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(imageName, utils.GetRegion()), + Config: testAccOutscaleSnapshotExportTaskDataSourceConfig(imageName, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleSnapshotExportTaskDataSourceID("data.outscale_snapshot_export_task.export_task"), ), @@ -44,7 +44,7 @@ func testAccCheckOutscaleSnapshotExportTaskDataSourceID(n string) resource.TestC } } -func testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(testName, region string) string { +func testAccOutscaleSnapshotExportTaskDataSourceConfig(testName, region string) string { var stringTemplate = ` resource "outscale_volume" "outscale_volume_snap" { subregion_name = "%[2]sa" diff --git a/outscale/data_source_outscale_snapshot_export_tasks.go b/outscale/data_source_outscale_snapshot_export_tasks.go index c096d4341..295d61151 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks.go +++ b/outscale/data_source_outscale_snapshot_export_tasks.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPISnapshotExportTasks() *schema.Resource { +func DataSourceOutscaleSnapshotExportTasks() *schema.Resource { return &schema.Resource{ Read: dataSourceOAPISnapshotExportTasksRead, Importer: &schema.ResourceImporter{ diff --git a/outscale/data_source_outscale_snapshot_export_tasks_test.go b/outscale/data_source_outscale_snapshot_export_tasks_test.go index 86a6cc651..8d8ba9e46 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks_test.go +++ b/outscale/data_source_outscale_snapshot_export_tasks_test.go @@ -18,7 +18,7 @@ func TestAccOthers_SnapshotExportTasksDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotExportTasksDataSourceConfig(imageName, utils.GetRegion()), + Config: testAccOutscaleSnapshotExportTasksDataSourceConfig(imageName, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleSnapshotExportTaskDataSourceID("data.outscale_snapshot_export_tasks.export_tasks"), ), @@ -27,7 +27,7 @@ func TestAccOthers_SnapshotExportTasksDataSource_basic(t *testing.T) { }) } -func testAccOutscaleOAPISnapshotExportTasksDataSourceConfig(testName, region string) string { +func testAccOutscaleSnapshotExportTasksDataSourceConfig(testName, region string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume_snap" { subregion_name = "%[2]sa" diff --git a/outscale/data_source_outscale_snapshot_test.go b/outscale/data_source_outscale_snapshot_test.go index c03266cf6..d00144cc0 100644 --- a/outscale/data_source_outscale_snapshot_test.go +++ b/outscale/data_source_outscale_snapshot_test.go @@ -17,9 +17,9 @@ func TestAccOthers_SnapshotDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISnapshotDataSourceConfig(utils.GetRegion()), + Config: testAccCheckOutscaleSnapshotDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotDataSourceID("data.outscale_snapshot.snapshot"), + testAccCheckOutscaleSnapshotDataSourceID("data.outscale_snapshot.snapshot"), resource.TestCheckResourceAttr("data.outscale_snapshot.snapshot", "volume_size", "1"), ), }, @@ -35,9 +35,9 @@ func TestAccOthers_SnapshotDataSource_multipleFilters(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISnapshotDataSourceConfigWithMultipleFilters(utils.GetRegion()), + Config: testAccCheckOutscaleSnapshotDataSourceConfigWithMultipleFilters(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotDataSourceID("data.outscale_snapshot.snapshot"), + testAccCheckOutscaleSnapshotDataSourceID("data.outscale_snapshot.snapshot"), resource.TestCheckResourceAttr("data.outscale_snapshot.snapshot", "volume_size", "10"), ), }, @@ -45,7 +45,7 @@ func TestAccOthers_SnapshotDataSource_multipleFilters(t *testing.T) { }) } -func testAccCheckOutscaleOAPISnapshotDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleSnapshotDataSourceID(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -59,7 +59,7 @@ func testAccCheckOutscaleOAPISnapshotDataSourceID(n string) resource.TestCheckFu } } -func testAccCheckOutscaleOAPISnapshotDataSourceConfig(region string) string { +func testAccCheckOutscaleSnapshotDataSourceConfig(region string) string { return fmt.Sprintf(` resource "outscale_volume" "example" { subregion_name = "%sa" @@ -76,7 +76,7 @@ func testAccCheckOutscaleOAPISnapshotDataSourceConfig(region string) string { `, region) } -func testAccCheckOutscaleOAPISnapshotDataSourceConfigWithMultipleFilters(region string) string { +func testAccCheckOutscaleSnapshotDataSourceConfigWithMultipleFilters(region string) string { return fmt.Sprintf(` resource "outscale_volume" "external1" { subregion_name = "%sa" diff --git a/outscale/data_source_outscale_snapshots.go b/outscale/data_source_outscale_snapshots.go index 8887196d6..80487f4f0 100644 --- a/outscale/data_source_outscale_snapshots.go +++ b/outscale/data_source_outscale_snapshots.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPISnapshots() *schema.Resource { +func DataSourceOutscaleSnapshots() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISnapshotsRead, + Read: DataSourceOutscaleSnapshotsRead, Schema: map[string]*schema.Schema{ //selection criteria @@ -105,7 +105,7 @@ func dataSourceOutscaleOAPISnapshots() *schema.Resource { } } -func dataSourceOutscaleOAPISnapshotsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSnapshotsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI restorableUsers, restorableUsersOk := d.GetOk("permission_to_create_volume") diff --git a/outscale/data_source_outscale_snapshots_test.go b/outscale/data_source_outscale_snapshots_test.go index afe89ec54..b1ccabdab 100644 --- a/outscale/data_source_outscale_snapshots_test.go +++ b/outscale/data_source_outscale_snapshots_test.go @@ -16,7 +16,7 @@ func TestAccOthers_SnapshotsDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISnapshotsDataSourceConfig(utils.GetRegion()), + Config: testAccCheckOutscaleSnapshotsDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_snapshots.outscale_snapshots", "snapshots.#", "1"), ), @@ -25,7 +25,7 @@ func TestAccOthers_SnapshotsDataSource_basic(t *testing.T) { }) } -func testAccCheckOutscaleOAPISnapshotsDataSourceConfig(region string) string { +func testAccCheckOutscaleSnapshotsDataSourceConfig(region string) string { return fmt.Sprintf(` resource "outscale_volume" "example" { subregion_name = "%sa" diff --git a/outscale/data_source_outscale_subnet.go b/outscale/data_source_outscale_subnet.go index f522ed6f8..3e6aad2ee 100644 --- a/outscale/data_source_outscale_subnet.go +++ b/outscale/data_source_outscale_subnet.go @@ -15,9 +15,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPISubnet() *schema.Resource { +func DataSourceOutscaleSubnet() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISubnetRead, + Read: DataSourceOutscaleSubnetRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -59,7 +59,7 @@ func dataSourceOutscaleOAPISubnet() *schema.Resource { } } -func dataSourceOutscaleOAPISubnetRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSubnetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSubnetsRequest{} @@ -71,7 +71,7 @@ func dataSourceOutscaleOAPISubnetRead(d *schema.ResourceData, meta interface{}) filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPISubnetDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleSubnetDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadSubnetsResponse @@ -130,7 +130,7 @@ func dataSourceOutscaleOAPISubnetRead(d *schema.ResourceData, meta interface{}) return nil } -func buildOutscaleOAPISubnetDataSourceFilters(set *schema.Set) *oscgo.FiltersSubnet { +func buildOutscaleSubnetDataSourceFilters(set *schema.Set) *oscgo.FiltersSubnet { var filters oscgo.FiltersSubnet for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_subnet_test.go b/outscale/data_source_outscale_subnet_test.go index d72d1f9a0..892e478e4 100644 --- a/outscale/data_source_outscale_subnet_test.go +++ b/outscale/data_source_outscale_subnet_test.go @@ -15,10 +15,10 @@ func TestAccNet_WithSubnet_DataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISubnetConfig(utils.GetRegion()), + Config: testAccDataSourceOutscaleSubnetConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_id"), - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_filter"), + testAccDataSourceOutscaleSubnetCheck("data.outscale_subnet.by_id"), + testAccDataSourceOutscaleSubnetCheck("data.outscale_subnet.by_filter"), ), }, }, @@ -31,16 +31,16 @@ func TestAccNet_SubnetDataSource_withAvailableIpsCountsFilter(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter(utils.GetRegion()), + Config: testAccDataSourceOutscaleSubnetWithAvailableIpsCountsFilter(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_filter"), + testAccDataSourceOutscaleSubnetCheck("data.outscale_subnet.by_filter"), ), }, }, }) } -func testAccDataSourceOutscaleOAPISubnetCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleSubnetCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -74,7 +74,7 @@ func testAccDataSourceOutscaleOAPISubnetCheck(name string) resource.TestCheckFun } } -func testAccDataSourceOutscaleOAPISubnetConfig(region string) string { +func testAccDataSourceOutscaleSubnetConfig(region string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -104,7 +104,7 @@ func testAccDataSourceOutscaleOAPISubnetConfig(region string) string { `, region) } -func testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter(region string) string { +func testAccDataSourceOutscaleSubnetWithAvailableIpsCountsFilter(region string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_subnets.go b/outscale/data_source_outscale_subnets.go index 2d790dcb3..dcbd500c5 100644 --- a/outscale/data_source_outscale_subnets.go +++ b/outscale/data_source_outscale_subnets.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPISubnets() *schema.Resource { +func DataSourceOutscaleSubnets() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISubnetsRead, + Read: DataSourceOutscaleSubnetsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -72,7 +72,7 @@ func dataSourceOutscaleOAPISubnets() *schema.Resource { } } -func dataSourceOutscaleOAPISubnetsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSubnetsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSubnetsRequest{} @@ -88,7 +88,7 @@ func dataSourceOutscaleOAPISubnetsRead(d *schema.ResourceData, meta interface{}) filters, filtersOk := d.GetOk("filter") if filtersOk { - req.Filters = buildOutscaleOAPISubnetDataSourceFilters(filters.(*schema.Set)) + req.Filters = buildOutscaleSubnetDataSourceFilters(filters.(*schema.Set)) } var resp oscgo.ReadSubnetsResponse diff --git a/outscale/data_source_outscale_subnets_test.go b/outscale/data_source_outscale_subnets_test.go index bbb19b249..e0557eba7 100644 --- a/outscale/data_source_outscale_subnets_test.go +++ b/outscale/data_source_outscale_subnets_test.go @@ -17,7 +17,7 @@ func TestAccNet_WithSubnetsDataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISubnetsConfig(rInt, utils.GetRegion()), + Config: testAccDataSourceOutscaleSubnetsConfig(rInt, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.outscale_subnets.by_filter", "subnets.#", "1"), ), @@ -33,13 +33,13 @@ func TestAccNet_Subnets_withAvailableIpsCountsFilter(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISubnetsWithAvailableIpsCountsFilter(utils.GetRegion()), + Config: testAccDataSourceOutscaleSubnetsWithAvailableIpsCountsFilter(utils.GetRegion()), }, }, }) } -func testAccDataSourceOutscaleOAPISubnetsConfig(rInt int, region string) string { +func testAccDataSourceOutscaleSubnetsConfig(rInt int, region string) string { return fmt.Sprintf(` resource "outscale_net" "net" { ip_range = "10.%[1]d.123.0/24" @@ -70,7 +70,7 @@ func testAccDataSourceOutscaleOAPISubnetsConfig(rInt int, region string) string `, rInt, region) } -func testAccDataSourceOutscaleOAPISubnetsWithAvailableIpsCountsFilter(region string) string { +func testAccDataSourceOutscaleSubnetsWithAvailableIpsCountsFilter(region string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net1" { ip_range = "10.0.0.0/16" diff --git a/outscale/data_source_outscale_subregions.go b/outscale/data_source_outscale_subregions.go index 282f04066..58527f40b 100644 --- a/outscale/data_source_outscale_subregions.go +++ b/outscale/data_source_outscale_subregions.go @@ -12,9 +12,9 @@ import ( "github.com/spf13/cast" ) -func dataSourceOutscaleOAPISubregions() *schema.Resource { +func DataSourceOutscaleSubregions() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPISubregionsRead, + Read: DataSourceOutscaleSubregionsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -51,14 +51,14 @@ func dataSourceOutscaleOAPISubregions() *schema.Resource { } } -func dataSourceOutscaleOAPISubregionsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleSubregionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") filtersReq := &oscgo.FiltersSubregion{} if filtersOk { - filtersReq = buildOutscaleOAPIDataSourceSubregionsFilters(filters.(*schema.Set)) + filtersReq = buildOutscaleDataSourceSubregionsFilters(filters.(*schema.Set)) } req := oscgo.ReadSubregionsRequest{Filters: filtersReq} @@ -97,7 +97,7 @@ func dataSourceOutscaleOAPISubregionsRead(d *schema.ResourceData, meta interface }) } -func buildOutscaleOAPIDataSourceSubregionsFilters(set *schema.Set) *oscgo.FiltersSubregion { +func buildOutscaleDataSourceSubregionsFilters(set *schema.Set) *oscgo.FiltersSubregion { filters := &oscgo.FiltersSubregion{} for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_subregions_test.go b/outscale/data_source_outscale_subregions_test.go index 35230071b..9f99dd09b 100644 --- a/outscale/data_source_outscale_subregions_test.go +++ b/outscale/data_source_outscale_subregions_test.go @@ -19,9 +19,9 @@ func TestAccOthers_SubregionsDataSource_Basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISubregionsDataSourceConfig(utils.GetRegion()), + Config: testAccCheckOutscaleSubregionsDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubregionsDataSourceID("data.outscale_subregions.test"), + testAccCheckOutscaleSubregionsDataSourceID("data.outscale_subregions.test"), ), }, }, @@ -37,16 +37,16 @@ func TestAccOthers_SubregionsDataSource_All(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISubregionsDataSourceConfigAll, + Config: testAccCheckOutscaleSubregionsDataSourceConfigAll, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubregionsDataSourceID("data.outscale_subregions.test"), + testAccCheckOutscaleSubregionsDataSourceID("data.outscale_subregions.test"), ), }, }, }) } -func testAccCheckOutscaleOAPISubregionsDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleSubregionsDataSourceID(n string) resource.TestCheckFunc { // Wait for IAM role return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -61,7 +61,7 @@ func testAccCheckOutscaleOAPISubregionsDataSourceID(n string) resource.TestCheck } } -func testAccCheckOutscaleOAPISubregionsDataSourceConfig(subregionName string) string { +func testAccCheckOutscaleSubregionsDataSourceConfig(subregionName string) string { return fmt.Sprintf(` data "outscale_subregions" "test" { filter { @@ -76,7 +76,7 @@ func testAccCheckOutscaleOAPISubregionsDataSourceConfig(subregionName string) st `, subregionName) } -var testAccCheckOutscaleOAPISubregionsDataSourceConfigAll = ` +var testAccCheckOutscaleSubregionsDataSourceConfigAll = ` data "outscale_subregions" "test" { } ` diff --git a/outscale/data_source_outscale_tag.go b/outscale/data_source_outscale_tag.go index 11f5cf5a8..e6bbfd9c4 100644 --- a/outscale/data_source_outscale_tag.go +++ b/outscale/data_source_outscale_tag.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPITag() *schema.Resource { +func DataSourceOutscaleTag() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPITagRead, + Read: DataSourceOutscaleTagRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "key": { @@ -38,7 +38,7 @@ func dataSourceOutscaleOAPITag() *schema.Resource { } } -func dataSourceOutscaleOAPITagRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleTagRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI // Build up search parameters diff --git a/outscale/data_source_outscale_tags.go b/outscale/data_source_outscale_tags.go index ace59af95..f97df8dfd 100644 --- a/outscale/data_source_outscale_tags.go +++ b/outscale/data_source_outscale_tags.go @@ -11,9 +11,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPITags() *schema.Resource { +func DataSourceOutscaleTags() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPITagsRead, + Read: DataSourceOutscaleTagsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "tags": { @@ -44,7 +44,7 @@ func dataSourceOutscaleOAPITags() *schema.Resource { } } -func dataSourceOutscaleOAPITagsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleTagsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI // Build up search parameters diff --git a/outscale/data_source_outscale_tags_test.go b/outscale/data_source_outscale_tags_test.go index 2f378531e..a34cde759 100644 --- a/outscale/data_source_outscale_tags_test.go +++ b/outscale/data_source_outscale_tags_test.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPITagsDataSource_basic(t *testing.T) { +func TestAccOutscaleTagsDataSource_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/outscale/data_source_outscale_virtual_gateway.go b/outscale/data_source_outscale_virtual_gateway.go index 07e0f49b1..884dbec87 100644 --- a/outscale/data_source_outscale_virtual_gateway.go +++ b/outscale/data_source_outscale_virtual_gateway.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { +func DataSourceOutscaleVirtualGateway() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVirtualGatewayRead, + Read: DataSourceOutscaleVirtualGatewayRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -60,7 +60,7 @@ func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { } } -func dataSourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVirtualGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_virtual_gateway_test.go b/outscale/data_source_outscale_virtual_gateway_test.go index fca3d915f..681e9f6d5 100644 --- a/outscale/data_source_outscale_virtual_gateway_test.go +++ b/outscale/data_source_outscale_virtual_gateway_test.go @@ -20,7 +20,7 @@ func TestAccOthers_DataSourceVirtualGateway_unattached(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVirtualGatewayUnattachedConfig(rInt), + Config: testAccDataSourceOutscaleVirtualGatewayUnattachedConfig(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair( "data.outscale_virtual_gateway.test_by_id", "id", @@ -33,7 +33,7 @@ func TestAccOthers_DataSourceVirtualGateway_unattached(t *testing.T) { }) } -func testAccDataSourceOutscaleOAPIVirtualGatewayUnattachedConfig(rInt int) string { +func testAccDataSourceOutscaleVirtualGatewayUnattachedConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_virtual_gateway" "unattached" { connection_type = "ipsec.1" diff --git a/outscale/data_source_outscale_virtual_gateways.go b/outscale/data_source_outscale_virtual_gateways.go index a42dc6141..2ef11cbd3 100644 --- a/outscale/data_source_outscale_virtual_gateways.go +++ b/outscale/data_source_outscale_virtual_gateways.go @@ -11,9 +11,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { +func DataSourceOutscaleVirtualGateways() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVirtualGatewaysRead, + Read: DataSourceOutscaleVirtualGatewaysRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -68,7 +68,7 @@ func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { } } -func dataSourceOutscaleOAPIVirtualGatewaysRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVirtualGatewaysRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filter, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_virtual_gateways_test.go b/outscale/data_source_outscale_virtual_gateways_test.go index 5b5f386e1..bb78b7792 100644 --- a/outscale/data_source_outscale_virtual_gateways_test.go +++ b/outscale/data_source_outscale_virtual_gateways_test.go @@ -20,13 +20,13 @@ func TestAccOthers_DataSourceVpnGateways_unattached(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVpnGatewaysUnattachedConfig(rInt), + Config: testAccDataSourceOutscaleVpnGatewaysUnattachedConfig(rInt), }, }, }) } -func testAccDataSourceOutscaleOAPIVpnGatewaysUnattachedConfig(rInt int) string { +func testAccDataSourceOutscaleVpnGatewaysUnattachedConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_virtual_gateway" "unattached" { connection_type = "ipsec.1" diff --git a/outscale/data_source_outscale_vm.go b/outscale/data_source_outscale_vm.go index 2ad68199e..ec816123f 100644 --- a/outscale/data_source_outscale_vm.go +++ b/outscale/data_source_outscale_vm.go @@ -15,13 +15,13 @@ import ( "github.com/spf13/cast" ) -func dataSourceOutscaleOAPIVM() *schema.Resource { +func DataSourceOutscaleVM() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVMRead, + Read: DataSourceOutscaleVMRead, Schema: getDataSourceOAPIVMSchemas(), } } -func dataSourceOutscaleOAPIVMRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVMRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -33,7 +33,7 @@ func dataSourceOutscaleOAPIVMRead(d *schema.ResourceData, meta interface{}) erro // Build up search parameters params := oscgo.ReadVmsRequest{} if filtersOk { - params.Filters, err = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) + params.Filters, err = buildOutscaleDataSourceVMFilters(filters.(*schema.Set)) if err != nil { return err } @@ -270,7 +270,7 @@ func getDataSourceOAPIVMSchemas() map[string]*schema.Schema { return wholeSchema } -func buildOutscaleOAPIDataSourceVMFilters(set *schema.Set) (*oscgo.FiltersVm, error) { +func buildOutscaleDataSourceVMFilters(set *schema.Set) (*oscgo.FiltersVm, error) { filters := new(oscgo.FiltersVm) for _, v := range set.List() { diff --git a/outscale/data_source_outscale_vm_state.go b/outscale/data_source_outscale_vm_state.go index 558932509..b9b053973 100644 --- a/outscale/data_source_outscale_vm_state.go +++ b/outscale/data_source_outscale_vm_state.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVMState() *schema.Resource { +func DataSourceOutscaleVMState() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVMStateRead, + Read: DataSourceOutscaleVMStateRead, Schema: getOAPIVMStateDataSourceSchema(), } } @@ -84,7 +84,7 @@ func getVMStateAttrsSchema() map[string]*schema.Schema { } } -func dataSourceOutscaleOAPIVMStateRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVMStateRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -96,7 +96,7 @@ func dataSourceOutscaleOAPIVMStateRead(d *schema.ResourceData, meta interface{}) params := oscgo.ReadVmsStateRequest{} if filtersOk { - params.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) + params.SetFilters(buildOutscaleDataSourceVMStateFilters(filters.(*schema.Set))) } if instanceIDOk { filter := oscgo.FiltersVmsState{} @@ -178,7 +178,7 @@ func statusSetOAPIVMState(status []oscgo.MaintenanceEvent) []map[string]interfac return s } -func buildOutscaleOAPIDataSourceVMStateFilters(set *schema.Set) oscgo.FiltersVmsState { +func buildOutscaleDataSourceVMStateFilters(set *schema.Set) oscgo.FiltersVmsState { var filters oscgo.FiltersVmsState for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_vm_state_test.go b/outscale/data_source_outscale_vm_state_test.go index f422d7f6e..f924dfe90 100644 --- a/outscale/data_source_outscale_vm_state_test.go +++ b/outscale/data_source_outscale_vm_state_test.go @@ -18,16 +18,16 @@ func TestAccVM_StateDataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVmStateConfig(omi, "tinav4.c2r2p2"), + Config: testAccDataSourceOutscaleVmStateConfig(omi, "tinav4.c2r2p2"), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIVMStateCheck("data.outscale_vm_state.state"), + testAccDataSourceOutscaleVMStateCheck("data.outscale_vm_state.state"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIVMStateCheck(name string) resource.TestCheckFunc { +func testAccDataSourceOutscaleVMStateCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -53,7 +53,7 @@ func testAccDataSourceOutscaleOAPIVMStateCheck(name string) resource.TestCheckFu } } -func testAccDataSourceOutscaleOAPIVmStateConfig(omi, vmType string) string { +func testAccDataSourceOutscaleVmStateConfig(omi, vmType string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_vm_state" { security_group_name = "sg_vmState" diff --git a/outscale/data_source_outscale_vm_states.go b/outscale/data_source_outscale_vm_states.go index 7ecd97e77..ac781d368 100644 --- a/outscale/data_source_outscale_vm_states.go +++ b/outscale/data_source_outscale_vm_states.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleOAPIVMStates() *schema.Resource { +func DataSourceOutscaleVMStates() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVMStatesRead, + Read: DataSourceOutscaleVMStatesRead, Schema: getOAPIVMStatesDataSourceSchema(), } } @@ -49,7 +49,7 @@ func getOAPIVMStatesDataSourceSchema() map[string]*schema.Schema { return wholeSchema } -func dataSourceOutscaleOAPIVMStatesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVMStatesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -61,7 +61,7 @@ func dataSourceOutscaleOAPIVMStatesRead(d *schema.ResourceData, meta interface{} params := oscgo.ReadVmsStateRequest{} if filtersOk { - params.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) + params.SetFilters(buildOutscaleDataSourceVMStateFilters(filters.(*schema.Set))) } if instanceIdsOk { filter := oscgo.FiltersVmsState{} diff --git a/outscale/data_source_outscale_vm_states_test.go b/outscale/data_source_outscale_vm_states_test.go index 641b59f66..1bc664da4 100644 --- a/outscale/data_source_outscale_vm_states_test.go +++ b/outscale/data_source_outscale_vm_states_test.go @@ -17,13 +17,13 @@ func TestAccVM_StatesDataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVMStatesConfig(omi, "tinav4.c2r2p2"), + Config: testAccDataSourceOutscaleVMStatesConfig(omi, "tinav4.c2r2p2"), }, }, }) } -func testAccDataSourceOutscaleOAPIVMStatesConfig(omi, vmType string) string { +func testAccDataSourceOutscaleVMStatesConfig(omi, vmType string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_vStates" { description = "testAcc Terraform security group" diff --git a/outscale/data_source_outscale_vm_types.go b/outscale/data_source_outscale_vm_types.go index f4c34443b..37fcaa380 100644 --- a/outscale/data_source_outscale_vm_types.go +++ b/outscale/data_source_outscale_vm_types.go @@ -13,9 +13,9 @@ import ( "github.com/spf13/cast" ) -func dataSourceOutscaleOAPIVMTypes() *schema.Resource { +func DataSourceOutscaleVMTypes() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPIVMTypesRead, + Read: DataSourceOutscaleVMTypesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -63,14 +63,14 @@ func dataSourceOutscaleOAPIVMTypes() *schema.Resource { } } -func dataSourceOutscaleOAPIVMTypesRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVMTypesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filter, filterOk := d.GetOk("filter") filtersReq := oscgo.FiltersVmType{} if filterOk { - filtersReq = buildOutscaleOAPIDataSourceVMTypesFilters(filter.(*schema.Set)) + filtersReq = buildOutscaleDataSourceVMTypesFilters(filter.(*schema.Set)) } req := oscgo.ReadVmTypesRequest{Filters: &filtersReq} @@ -151,7 +151,7 @@ func statusDescriptionOAPIVMTypesAttributes(d *schema.ResourceData, fTypes []osc } -func buildOutscaleOAPIDataSourceVMTypesFilters(set *schema.Set) oscgo.FiltersVmType { +func buildOutscaleDataSourceVMTypesFilters(set *schema.Set) oscgo.FiltersVmType { var filters oscgo.FiltersVmType for _, v := range set.List() { m := v.(map[string]interface{}) diff --git a/outscale/data_source_outscale_vm_types_test.go b/outscale/data_source_outscale_vm_types_test.go index 382b23338..328e8c8c5 100644 --- a/outscale/data_source_outscale_vm_types_test.go +++ b/outscale/data_source_outscale_vm_types_test.go @@ -19,13 +19,13 @@ func TestAccVM_TypesDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVMTypesConfig(omi, "tinav4.c1r1p1"), + Config: testAccDataSourceOutscaleVMTypesConfig(omi, "tinav4.c1r1p1"), }, }, }) } -func testAccDataSourceOutscaleOAPIVMTypesConfig(omi, vmType string) string { +func testAccDataSourceOutscaleVMTypesConfig(omi, vmType string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_vms_types" { security_group_name = "sg_vm_type" diff --git a/outscale/data_source_outscale_vms.go b/outscale/data_source_outscale_vms.go index b20c5c9b2..d3963e5cc 100644 --- a/outscale/data_source_outscale_vms.go +++ b/outscale/data_source_outscale_vms.go @@ -13,11 +13,11 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func datasourceOutscaleOApiVMS() *schema.Resource { +func DataSourceOutscaleVMS() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOApiVMSRead, + Read: DataSourceOutscaleVMSRead, - Schema: datasourceOutscaleOApiVMSSchema(), + Schema: DataSourceOutscaleVMSSchema(), } } @@ -43,7 +43,7 @@ func dataSourceFiltersSchema() *schema.Schema { } } -func datasourceOutscaleOApiVMSSchema() map[string]*schema.Schema { +func DataSourceOutscaleVMSSchema() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "vms": { @@ -62,7 +62,7 @@ func datasourceOutscaleOApiVMSSchema() map[string]*schema.Schema { return wholeSchema } -func dataSourceOutscaleOApiVMSRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVMSRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") @@ -75,7 +75,7 @@ func dataSourceOutscaleOApiVMSRead(d *schema.ResourceData, meta interface{}) err // Build up search parameters params := oscgo.ReadVmsRequest{} if filtersOk { - params.Filters, err = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) + params.Filters, err = buildOutscaleDataSourceVMFilters(filters.(*schema.Set)) if err != nil { return err } diff --git a/outscale/data_source_outscale_volume.go b/outscale/data_source_outscale_volume.go index 971237cf0..6703abbea 100644 --- a/outscale/data_source_outscale_volume.go +++ b/outscale/data_source_outscale_volume.go @@ -15,7 +15,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func datasourceOutscaleOAPIVolume() *schema.Resource { +func DataSourceOutscaleVolume() *schema.Resource { return &schema.Resource{ Read: datasourceOAPIVolumeRead, diff --git a/outscale/data_source_outscale_volume_test.go b/outscale/data_source_outscale_volume_test.go index ad7698341..b00312f5e 100644 --- a/outscale/data_source_outscale_volume_test.go +++ b/outscale/data_source_outscale_volume_test.go @@ -17,9 +17,9 @@ func TestAccOthers_VolumeDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfig(utils.GetRegion()), + Config: testAccCheckOutscaleVolumeDataSourceConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volume.ebs_volume"), + testAccCheckOutscaleVolumeDataSourceID("data.outscale_volume.ebs_volume"), resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "size", "10"), resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "volume_type", "standard"), ), @@ -36,9 +36,9 @@ func TestAccOthers_VolumeDataSource_filterByTags(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfigFilterByTags(utils.GetRegion()), + Config: testAccCheckOutscaleVolumeDataSourceConfigFilterByTags(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volume.ebs_volume"), + testAccCheckOutscaleVolumeDataSourceID("data.outscale_volume.ebs_volume"), resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "size", "10"), resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "volume_type", "standard"), ), @@ -47,7 +47,7 @@ func TestAccOthers_VolumeDataSource_filterByTags(t *testing.T) { }) } -func testAccCheckOutscaleOAPIVolumeDataSourceID(n string) resource.TestCheckFunc { +func testAccCheckOutscaleVolumeDataSourceID(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -61,7 +61,7 @@ func testAccCheckOutscaleOAPIVolumeDataSourceID(n string) resource.TestCheckFunc } } -func testAccCheckOutscaleOAPIVolumeDataSourceConfig(region string) string { +func testAccCheckOutscaleVolumeDataSourceConfig(region string) string { return fmt.Sprintf(` resource "outscale_volume" "example" { subregion_name = "%sa" @@ -83,7 +83,7 @@ func testAccCheckOutscaleOAPIVolumeDataSourceConfig(region string) string { `, region) } -func testAccCheckOutscaleOAPIVolumeDataSourceConfigFilterByTags(region string) string { +func testAccCheckOutscaleVolumeDataSourceConfigFilterByTags(region string) string { return fmt.Sprintf(` resource "outscale_volume" "example" { subregion_name = "%sa" diff --git a/outscale/data_source_outscale_volumes.go b/outscale/data_source_outscale_volumes.go index 018246ab9..449cc4659 100644 --- a/outscale/data_source_outscale_volumes.go +++ b/outscale/data_source_outscale_volumes.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func datasourceOutscaleOAPIVolumes() *schema.Resource { +func DataSourceOutscaleVolumes() *schema.Resource { return &schema.Resource{ Read: datasourceOAPIVolumesRead, diff --git a/outscale/data_source_outscale_volumes_test.go b/outscale/data_source_outscale_volumes_test.go index dc684f528..7806ce8e5 100644 --- a/outscale/data_source_outscale_volumes_test.go +++ b/outscale/data_source_outscale_volumes_test.go @@ -17,9 +17,9 @@ func TestAccOthers_VolumesDataSource_multipleFilters(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfigWithMultipleFilters(utils.GetRegion()), + Config: testAccCheckOutscaleVolumeDataSourceConfigWithMultipleFilters(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volumes.ebs_volume"), + testAccCheckOutscaleVolumeDataSourceID("data.outscale_volumes.ebs_volume"), resource.TestCheckResourceAttr("data.outscale_volumes.ebs_volume", "volumes.0.size", "1"), resource.TestCheckResourceAttr("data.outscale_volumes.ebs_volume", "volumes.0.volume_type", "standard"), ), @@ -36,9 +36,9 @@ func TestAccOthers_VolumeDataSource_multipleVIdsFilters(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter(utils.GetRegion()), + Config: testAccCheckOutscaleVolumesDataSourceConfigWithMultipleVolumeIDsFilter(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), + testAccCheckOutscaleVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), resource.TestCheckResourceAttr("data.outscale_volumes.outscale_volumes", "volumes.0.size", "40"), ), }, @@ -56,9 +56,9 @@ func TestAccVM_withVolumesDataSource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(utils.GetRegion(), omi, keypair), + Config: testAccCheckOutscaleVolumesDataSourceConfigWithVM(utils.GetRegion(), omi, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), + testAccCheckOutscaleVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), // resource.TestCheckResourceAttr("data.outscale_volumes.outscale_volumes", "volumes.0.size", "1"), // resource.TestCheckResourceAttr("data.outscale_volumes.outscale_volumes", "volumes.0.volume_type", "standard"), ), @@ -67,7 +67,7 @@ func TestAccVM_withVolumesDataSource(t *testing.T) { }) } -func testAccCheckOutscaleOAPIVolumeDataSourceConfigWithMultipleFilters(region string) string { +func testAccCheckOutscaleVolumeDataSourceConfigWithMultipleFilters(region string) string { return fmt.Sprintf(` resource "outscale_volume" "external" { subregion_name = "%sa" @@ -94,7 +94,7 @@ func testAccCheckOutscaleOAPIVolumeDataSourceConfigWithMultipleFilters(region st `, region) } -func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter(region string) string { +func testAccCheckOutscaleVolumesDataSourceConfigWithMultipleVolumeIDsFilter(region string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume" { subregion_name = "%[1]sa" @@ -115,7 +115,7 @@ func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter( `, region) } -func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keypair string) string { +func testAccCheckOutscaleVolumesDataSourceConfigWithVM(region, imageID, keypair string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume" { subregion_name = "%[1]sa" diff --git a/outscale/data_source_outscale_vpn_connection.go b/outscale/data_source_outscale_vpn_connection.go index e6a80c075..8d2b64232 100644 --- a/outscale/data_source_outscale_vpn_connection.go +++ b/outscale/data_source_outscale_vpn_connection.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func dataSourceOutscaleVPNConnection() *schema.Resource { +func DataSourceOutscaleVPNConnection() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleVPNConnectionRead, + Read: DataSourceOutscaleVPNConnectionRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), "vpn_connection_id": { @@ -104,7 +104,7 @@ func dataSourceOutscaleVPNConnection() *schema.Resource { } } -func dataSourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_outscale_vpn_connections.go b/outscale/data_source_outscale_vpn_connections.go index 792d87ab1..611b3af0a 100644 --- a/outscale/data_source_outscale_vpn_connections.go +++ b/outscale/data_source_outscale_vpn_connections.go @@ -12,9 +12,9 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func dataSourceOutscaleVPNConnections() *schema.Resource { +func DataSourceOutscaleVPNConnections() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleVPNConnectionsRead, + Read: DataSourceOutscaleVPNConnectionsRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), @@ -116,7 +116,7 @@ func dataSourceOutscaleVPNConnections() *schema.Resource { } } -func dataSourceOutscaleVPNConnectionsRead(d *schema.ResourceData, meta interface{}) error { +func DataSourceOutscaleVPNConnectionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") diff --git a/outscale/data_source_quota.go b/outscale/data_source_quota.go index 5b07ad385..66f9ad61d 100644 --- a/outscale/data_source_quota.go +++ b/outscale/data_source_quota.go @@ -145,7 +145,7 @@ func (d *dataSourceQuota) Read(ctx context.Context, req datasource.ReadRequest, if err != nil { goto CHECK_ERR } - filters, err = buildOutscaleQuotaDataSourceFilters(listFilters) + filters, err = buildOutscaleQuotaDataSourceFrameworkFilters(listFilters) if err != nil { goto CHECK_ERR } @@ -222,7 +222,7 @@ CHECK_ERR: } } -func buildOutscaleQuotaDataSourceFilters(listFilters []tftypes.Value) (*oscgo.FiltersQuota, error) { +func buildOutscaleQuotaDataSourceFrameworkFilters(listFilters []tftypes.Value) (*oscgo.FiltersQuota, error) { var filters oscgo.FiltersQuota for _, val := range listFilters { diff --git a/outscale/data_source_quota_test.go b/outscale/data_source_quota_test.go index da0e16251..a097780b1 100644 --- a/outscale/data_source_quota_test.go +++ b/outscale/data_source_quota_test.go @@ -20,14 +20,14 @@ func TestAccFwOthers_DataSourceQuota(t *testing.T) { PreCheck: func() { TestAccFwPreCheck(t) }, Steps: []resource.TestStep{ { - Config: testAccFwDataSourceOutscaleOAPIQuotaConfig, + Config: testAccFwDataSourceOutscaleQuotaConfig, Check: resource.ComposeTestCheckFunc(), }, }, }) } -const testAccFwDataSourceOutscaleOAPIQuotaConfig = ` +const testAccFwDataSourceOutscaleQuotaConfig = ` data "outscale_quota" "lbuQuota1" { filter { name = "quota_names" diff --git a/outscale/framework_provider_test.go b/outscale/framework_provider_test.go index 8c7063ef9..31250c838 100644 --- a/outscale/framework_provider_test.go +++ b/outscale/framework_provider_test.go @@ -48,7 +48,7 @@ func TestMuxServer(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: fwtestAccDataSourceOutscaleOAPIQuotaConfig, + Config: fwtestAccDataSourceOutscaleQuotaConfig, }, }, }) @@ -64,7 +64,7 @@ func TestDataSource_UpgradeFromVersion(t *testing.T) { Source: "outscale/outscale", }, }, - Config: fwtestAccDataSourceOutscaleOAPIQuotaConfig, + Config: fwtestAccDataSourceOutscaleQuotaConfig, }, { ProtoV5ProviderFactories: map[string]func() (tfprotov5.ProviderServer, error){ @@ -83,14 +83,14 @@ func TestDataSource_UpgradeFromVersion(t *testing.T) { return muxServer.ProviderServer(), nil }, }, - Config: fwtestAccDataSourceOutscaleOAPIQuotaConfig, + Config: fwtestAccDataSourceOutscaleQuotaConfig, PlanOnly: true, }, }, }) } -const fwtestAccDataSourceOutscaleOAPIQuotaConfig = ` +const fwtestAccDataSourceOutscaleQuotaConfig = ` data "outscale_quota" "lbuquota1" { filter { name = "quota_names" diff --git a/outscale/import_outscale_net_attributes_test.go b/outscale/import_outscale_net_attributes_test.go index a6b5333be..2f69aa6f2 100644 --- a/outscale/import_outscale_net_attributes_test.go +++ b/outscale/import_outscale_net_attributes_test.go @@ -15,7 +15,7 @@ func TestAccNet_Attr_import(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinAttrConfig, + Config: testAccOutscaleLinAttrConfig, }, { ResourceName: resourceName, diff --git a/outscale/provider.go b/outscale/provider.go index e4e9c9afb..fe577b12e 100644 --- a/outscale/provider.go +++ b/outscale/provider.go @@ -52,134 +52,134 @@ func Provider() *schema.Provider { }, ResourcesMap: map[string]*schema.Resource{ - "outscale_vm": resourceOutscaleOApiVM(), - "outscale_keypair": resourceOutscaleOAPIKeyPair(), - "outscale_image": resourceOutscaleOAPIImage(), - "outscale_internet_service_link": resourceOutscaleOAPIInternetServiceLink(), - "outscale_internet_service": resourceOutscaleOAPIInternetService(), - "outscale_net": resourceOutscaleOAPINet(), - "outscale_security_group": resourceOutscaleOAPISecurityGroup(), - "outscale_outbound_rule": resourceOutscaleOAPIOutboundRule(), - "outscale_security_group_rule": resourceOutscaleOAPIOutboundRule(), - "outscale_tag": resourceOutscaleOAPITags(), - "outscale_public_ip": resourceOutscaleOAPIPublicIP(), - "outscale_public_ip_link": resourceOutscaleOAPIPublicIPLink(), - "outscale_volume": resourceOutscaleOAPIVolume(), - "outscale_volumes_link": resourceOutscaleOAPIVolumeLink(), - "outscale_net_attributes": resourceOutscaleOAPILinAttributes(), - "outscale_nat_service": resourceOutscaleOAPINatService(), - "outscale_subnet": resourceOutscaleOAPISubNet(), - "outscale_route": resourceOutscaleOAPIRoute(), - "outscale_route_table": resourceOutscaleOAPIRouteTable(), - "outscale_route_table_link": resourceOutscaleOAPILinkRouteTable(), - "outscale_nic": resourceOutscaleOAPINic(), - "outscale_snapshot": resourceOutscaleOAPISnapshot(), - "outscale_image_launch_permission": resourceOutscaleOAPIImageLaunchPermission(), - "outscale_net_peering": resourceOutscaleOAPILinPeeringConnection(), - "outscale_net_peering_acceptation": resourceOutscaleOAPILinPeeringConnectionAccepter(), - "outscale_net_access_point": resourceOutscaleNetAccessPoint(), - "outscale_nic_link": resourceOutscaleOAPINetworkInterfaceAttachment(), - "outscale_nic_private_ip": resourceOutscaleOAPINetworkInterfacePrivateIP(), - "outscale_snapshot_attributes": resourcedOutscaleOAPISnapshotAttributes(), - "outscale_dhcp_option": resourceOutscaleDHCPOption(), - "outscale_client_gateway": resourceOutscaleClientGateway(), - "outscale_virtual_gateway": resourceOutscaleOAPIVirtualGateway(), - "outscale_virtual_gateway_link": resourceOutscaleOAPIVirtualGatewayLink(), - "outscale_virtual_gateway_route_propagation": resourceOutscaleOAPIVirtualGatewayRoutePropagation(), - "outscale_vpn_connection": resourceOutscaleVPNConnection(), - "outscale_vpn_connection_route": resourceOutscaleVPNConnectionRoute(), - "outscale_access_key": resourceOutscaleAccessKey(), - "outscale_load_balancer": resourceOutscaleOAPILoadBalancer(), - "outscale_load_balancer_policy": resourceOutscaleAppCookieStickinessPolicy(), - "outscale_load_balancer_vms": resourceLBUAttachment(), - "outscale_load_balancer_attributes": resourceOutscaleOAPILoadBalancerAttributes(), - "outscale_load_balancer_listener_rule": resourceOutscaleLoadBalancerListenerRule(), - "outscale_flexible_gpu": resourceOutscaleOAPIFlexibleGpu(), - "outscale_flexible_gpu_link": resourceOutscaleOAPIFlexibleGpuLink(), - "outscale_image_export_task": resourceOutscaleOAPIIMageExportTask(), - "outscale_server_certificate": resourceOutscaleOAPIServerCertificate(), - "outscale_snapshot_export_task": resourceOutscaleOAPISnapshotExportTask(), - "outscale_ca": resourceOutscaleOAPICa(), - "outscale_api_access_rule": resourceOutscaleOAPIApiAccessRule(), - "outscale_api_access_policy": resourceOutscaleOAPIApiAccessPolicy(), + "outscale_vm": ResourceOutscaleVM(), + "outscale_keypair": ResourceOutscaleKeyPair(), + "outscale_image": ResourceOutscaleImage(), + "outscale_internet_service_link": ResourceOutscaleInternetServiceLink(), + "outscale_internet_service": ResourceOutscaleInternetService(), + "outscale_net": ResourceOutscaleNet(), + "outscale_security_group": ResourceOutscaleSecurityGroup(), + "outscale_outbound_rule": ResourceOutscaleOutboundRule(), + "outscale_security_group_rule": ResourceOutscaleOutboundRule(), + "outscale_tag": ResourceOutscaleTags(), + "outscale_public_ip": ResourceOutscalePublicIP(), + "outscale_public_ip_link": ResourceOutscalePublicIPLink(), + "outscale_volume": ResourceOutscaleVolume(), + "outscale_volumes_link": ResourceOutscaleVolumeLink(), + "outscale_net_attributes": ResourceOutscaleLinAttributes(), + "outscale_nat_service": ResourceOutscaleNatService(), + "outscale_subnet": ResourceOutscaleSubNet(), + "outscale_route": ResourceOutscaleRoute(), + "outscale_route_table": ResourceOutscaleRouteTable(), + "outscale_route_table_link": ResourceOutscaleLinkRouteTable(), + "outscale_nic": ResourceOutscaleNic(), + "outscale_snapshot": ResourceOutscaleSnapshot(), + "outscale_image_launch_permission": ResourceOutscaleImageLaunchPermission(), + "outscale_net_peering": ResourceOutscaleLinPeeringConnection(), + "outscale_net_peering_acceptation": ResourceOutscaleLinPeeringConnectionAccepter(), + "outscale_net_access_point": ResourceOutscaleNetAccessPoint(), + "outscale_nic_link": ResourceOutscaleNetworkInterfaceAttachment(), + "outscale_nic_private_ip": ResourceOutscaleNetworkInterfacePrivateIP(), + "outscale_snapshot_attributes": ResourcedOutscaleSnapshotAttributes(), + "outscale_dhcp_option": ResourceOutscaleDHCPOption(), + "outscale_client_gateway": ResourceOutscaleClientGateway(), + "outscale_virtual_gateway": ResourceOutscaleVirtualGateway(), + "outscale_virtual_gateway_link": ResourceOutscaleVirtualGatewayLink(), + "outscale_virtual_gateway_route_propagation": ResourceOutscaleVirtualGatewayRoutePropagation(), + "outscale_vpn_connection": ResourceOutscaleVPNConnection(), + "outscale_vpn_connection_route": ResourceOutscaleVPNConnectionRoute(), + "outscale_access_key": ResourceOutscaleAccessKey(), + "outscale_load_balancer": ResourceOutscaleLoadBalancer(), + "outscale_load_balancer_policy": ResourceOutscaleAppCookieStickinessPolicy(), + "outscale_load_balancer_vms": ResourceLBUAttachment(), + "outscale_load_balancer_attributes": ResourceOutscaleLoadBalancerAttributes(), + "outscale_load_balancer_listener_rule": ResourceOutscaleLoadBalancerListenerRule(), + "outscale_flexible_gpu": ResourceOutscaleFlexibleGpu(), + "outscale_flexible_gpu_link": ResourceOutscaleFlexibleGpuLink(), + "outscale_image_export_task": ResourceOutscaleIMageExportTask(), + "outscale_server_certificate": ResourceOutscaleServerCertificate(), + "outscale_snapshot_export_task": ResourceOutscaleSnapshotExportTask(), + "outscale_ca": ResourceOutscaleCa(), + "outscale_api_access_rule": ResourceOutscaleApiAccessRule(), + "outscale_api_access_policy": ResourceOutscaleApiAccessPolicy(), "outscale_main_route_table_link": resourceLinkMainRouteTable(), }, DataSourcesMap: map[string]*schema.Resource{ - "outscale_vm": dataSourceOutscaleOAPIVM(), - "outscale_vms": datasourceOutscaleOApiVMS(), - "outscale_security_group": dataSourceOutscaleOAPISecurityGroup(), - "outscale_security_groups": dataSourceOutscaleOAPISecurityGroups(), - "outscale_image": dataSourceOutscaleOAPIImage(), - "outscale_images": dataSourceOutscaleOAPIImages(), - "outscale_tag": dataSourceOutscaleOAPITag(), - "outscale_tags": dataSourceOutscaleOAPITags(), - "outscale_public_ip": dataSourceOutscaleOAPIPublicIP(), - "outscale_public_ips": dataSourceOutscaleOAPIPublicIPS(), - "outscale_volume": datasourceOutscaleOAPIVolume(), - "outscale_volumes": datasourceOutscaleOAPIVolumes(), - "outscale_nat_service": dataSourceOutscaleOAPINatService(), - "outscale_nat_services": dataSourceOutscaleOAPINatServices(), - "outscale_keypair": datasourceOutscaleOAPIKeyPair(), - "outscale_keypairs": datasourceOutscaleOAPIKeyPairs(), - "outscale_vm_state": dataSourceOutscaleOAPIVMState(), - "outscale_vm_states": dataSourceOutscaleOAPIVMStates(), - "outscale_internet_service": datasourceOutscaleOAPIInternetService(), - "outscale_internet_services": datasourceOutscaleOAPIInternetServices(), - "outscale_subnet": dataSourceOutscaleOAPISubnet(), - "outscale_subnets": dataSourceOutscaleOAPISubnets(), - "outscale_net": dataSourceOutscaleOAPIVpc(), - "outscale_nets": dataSourceOutscaleOAPIVpcs(), - "outscale_net_attributes": dataSourceOutscaleOAPIVpcAttr(), - "outscale_route_table": dataSourceOutscaleOAPIRouteTable(), - "outscale_route_tables": dataSourceOutscaleOAPIRouteTables(), - "outscale_snapshot": dataSourceOutscaleOAPISnapshot(), - "outscale_snapshots": dataSourceOutscaleOAPISnapshots(), - "outscale_net_peering": dataSourceOutscaleOAPILinPeeringConnection(), - "outscale_net_peerings": dataSourceOutscaleOAPILinPeeringsConnection(), - "outscale_nics": dataSourceOutscaleOAPINics(), - "outscale_nic": dataSourceOutscaleOAPINic(), - "outscale_client_gateway": dataSourceOutscaleClientGateway(), - "outscale_client_gateways": dataSourceOutscaleClientGateways(), - "outscale_virtual_gateway": dataSourceOutscaleOAPIVirtualGateway(), - "outscale_virtual_gateways": dataSourceOutscaleOAPIVirtualGateways(), - "outscale_vpn_connection": dataSourceOutscaleVPNConnection(), - "outscale_vpn_connections": dataSourceOutscaleVPNConnections(), - "outscale_access_key": dataSourceOutscaleAccessKey(), - "outscale_access_keys": dataSourceOutscaleAccessKeys(), - "outscale_dhcp_option": dataSourceOutscaleDHCPOption(), - "outscale_dhcp_options": dataSourceOutscaleDHCPOptions(), - "outscale_load_balancer": dataSourceOutscaleOAPILoadBalancer(), - "outscale_load_balancer_listener_rule": dataSourceOutscaleOAPILoadBalancerLDRule(), - "outscale_load_balancer_listener_rules": dataSourceOutscaleOAPILoadBalancerLDRules(), - "outscale_load_balancer_tags": dataSourceOutscaleOAPILBUTags(), - "outscale_load_balancer_vm_health": dataSourceOutscaleLoadBalancerVmsHeals(), - "outscale_load_balancers": dataSourceOutscaleOAPILoadBalancers(), - "outscale_vm_types": dataSourceOutscaleOAPIVMTypes(), - "outscale_net_access_point": dataSourceOutscaleNetAccessPoint(), - "outscale_net_access_points": dataSourceOutscaleNetAccessPoints(), - "outscale_flexible_gpu": dataSourceOutscaleOAPIFlexibleGpu(), - "outscale_flexible_gpus": dataSourceOutscaleOAPIFlexibleGpus(), - "outscale_subregions": dataSourceOutscaleOAPISubregions(), - "outscale_regions": dataSourceOutscaleOAPIRegions(), - "outscale_net_access_point_services": dataSourceOutscaleOAPINetAccessPointServices(), - "outscale_flexible_gpu_catalog": dataSourceOutscaleOAPIFlexibleGpuCatalog(), - "outscale_product_type": dataSourceOutscaleOAPIProductType(), - "outscale_product_types": dataSourceOutscaleOAPIProductTypes(), - "outscale_quotas": dataSourceOutscaleOAPIQuotas(), - "outscale_image_export_task": dataSourceOutscaleOAPIImageExportTask(), - "outscale_image_export_tasks": dataSourceOutscaleOAPIImageExportTasks(), - "outscale_server_certificate": datasourceOutscaleOAPIServerCertificate(), - "outscale_server_certificates": datasourceOutscaleOAPIServerCertificates(), - "outscale_snapshot_export_task": dataSourceOutscaleOAPISnapshotExportTask(), - "outscale_snapshot_export_tasks": dataSourceOutscaleOAPISnapshotExportTasks(), - "outscale_ca": dataSourceOutscaleOAPICa(), - "outscale_cas": dataSourceOutscaleOAPICas(), - "outscale_api_access_rule": dataSourceOutscaleOAPIApiAccessRule(), - "outscale_api_access_rules": dataSourceOutscaleOAPIApiAccessRules(), - "outscale_api_access_policy": dataSourceOutscaleOAPIApiAccessPolicy(), - "outscale_public_catalog": dataSourceOutscaleOAPIPublicCatalog(), - "outscale_account": dataSourceAccount(), - "outscale_accounts": dataSourceAccounts(), + "outscale_vm": DataSourceOutscaleVM(), + "outscale_vms": DataSourceOutscaleVMS(), + "outscale_security_group": DataSourceOutscaleSecurityGroup(), + "outscale_security_groups": DataSourceOutscaleSecurityGroups(), + "outscale_image": DataSourceOutscaleImage(), + "outscale_images": DataSourceOutscaleImages(), + "outscale_tag": DataSourceOutscaleTag(), + "outscale_tags": DataSourceOutscaleTags(), + "outscale_public_ip": DataSourceOutscalePublicIP(), + "outscale_public_ips": DataSourceOutscalePublicIPS(), + "outscale_volume": DataSourceOutscaleVolume(), + "outscale_volumes": DataSourceOutscaleVolumes(), + "outscale_nat_service": DataSourceOutscaleNatService(), + "outscale_nat_services": DataSourceOutscaleNatServices(), + "outscale_keypair": DataSourceOutscaleKeyPair(), + "outscale_keypairs": DataSourceOutscaleKeyPairs(), + "outscale_vm_state": DataSourceOutscaleVMState(), + "outscale_vm_states": DataSourceOutscaleVMStates(), + "outscale_internet_service": DataSourceOutscaleInternetService(), + "outscale_internet_services": DataSourceOutscaleInternetServices(), + "outscale_subnet": DataSourceOutscaleSubnet(), + "outscale_subnets": DataSourceOutscaleSubnets(), + "outscale_net": DataSourceOutscaleVpc(), + "outscale_nets": DataSourceOutscaleVpcs(), + "outscale_net_attributes": DataSourceOutscaleVpcAttr(), + "outscale_route_table": DataSourceOutscaleRouteTable(), + "outscale_route_tables": DataSourceOutscaleRouteTables(), + "outscale_snapshot": DataSourceOutscaleSnapshot(), + "outscale_snapshots": DataSourceOutscaleSnapshots(), + "outscale_net_peering": DataSourceOutscaleLinPeeringConnection(), + "outscale_net_peerings": DataSourceOutscaleLinPeeringsConnection(), + "outscale_nics": DataSourceOutscaleNics(), + "outscale_nic": DataSourceOutscaleNic(), + "outscale_client_gateway": DataSourceOutscaleClientGateway(), + "outscale_client_gateways": DataSourceOutscaleClientGateways(), + "outscale_virtual_gateway": DataSourceOutscaleVirtualGateway(), + "outscale_virtual_gateways": DataSourceOutscaleVirtualGateways(), + "outscale_vpn_connection": DataSourceOutscaleVPNConnection(), + "outscale_vpn_connections": DataSourceOutscaleVPNConnections(), + "outscale_access_key": DataSourceOutscaleAccessKey(), + "outscale_access_keys": DataSourceOutscaleAccessKeys(), + "outscale_dhcp_option": DataSourceOutscaleDHCPOption(), + "outscale_dhcp_options": DataSourceOutscaleDHCPOptions(), + "outscale_load_balancer": DataSourceOutscaleLoadBalancer(), + "outscale_load_balancer_listener_rule": DataSourceOutscaleLoadBalancerLDRule(), + "outscale_load_balancer_listener_rules": DataSourceOutscaleLoadBalancerLDRules(), + "outscale_load_balancer_tags": DataSourceOutscaleLBUTags(), + "outscale_load_balancer_vm_health": DataSourceOutscaleLoadBalancerVmsHeals(), + "outscale_load_balancers": DataSourceOutscaleLoadBalancers(), + "outscale_vm_types": DataSourceOutscaleVMTypes(), + "outscale_net_access_point": DataSourceOutscaleNetAccessPoint(), + "outscale_net_access_points": DataSourceOutscaleNetAccessPoints(), + "outscale_flexible_gpu": DataSourceOutscaleFlexibleGpu(), + "outscale_flexible_gpus": DataSourceOutscaleFlexibleGpus(), + "outscale_subregions": DataSourceOutscaleSubregions(), + "outscale_regions": DataSourceOutscaleRegions(), + "outscale_net_access_point_services": DataSourceOutscaleNetAccessPointServices(), + "outscale_flexible_gpu_catalog": DataSourceOutscaleFlexibleGpuCatalog(), + "outscale_product_type": DataSourceOutscaleProductType(), + "outscale_product_types": DataSourceOutscaleProductTypes(), + "outscale_quotas": DataSourceOutscaleQuotas(), + "outscale_image_export_task": DataSourceOutscaleImageExportTask(), + "outscale_image_export_tasks": DataSourceOutscaleImageExportTasks(), + "outscale_server_certificate": DataSourceOutscaleServerCertificate(), + "outscale_server_certificates": DataSourceOutscaleServerCertificates(), + "outscale_snapshot_export_task": DataSourceOutscaleSnapshotExportTask(), + "outscale_snapshot_export_tasks": DataSourceOutscaleSnapshotExportTasks(), + "outscale_ca": DataSourceOutscaleCa(), + "outscale_cas": DataSourceOutscaleCas(), + "outscale_api_access_rule": DataSourceOutscaleApiAccessRule(), + "outscale_api_access_rules": DataSourceOutscaleApiAccessRules(), + "outscale_api_access_policy": DataSourceOutscaleApiAccessPolicy(), + "outscale_public_catalog": DataSourceOutscalePublicCatalog(), + "outscale_account": DataSourceAccount(), + "outscale_accounts": DataSourceAccounts(), }, ConfigureFunc: providerConfigureClient, diff --git a/outscale/resource_outscale_access_key.go b/outscale/resource_outscale_access_key.go index fc5e0ccc8..451889930 100644 --- a/outscale/resource_outscale_access_key.go +++ b/outscale/resource_outscale_access_key.go @@ -13,12 +13,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleAccessKey() *schema.Resource { +func ResourceOutscaleAccessKey() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleAccessKeyCreate, - Read: resourceOutscaleAccessKeyRead, - Update: resourceOutscaleAccessKeyUpdate, - Delete: resourceOutscaleAccessKeyDelete, + Create: ResourceOutscaleAccessKeyCreate, + Read: ResourceOutscaleAccessKeyRead, + Update: ResourceOutscaleAccessKeyUpdate, + Delete: ResourceOutscaleAccessKeyDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -63,7 +63,7 @@ func resourceOutscaleAccessKey() *schema.Resource { } } -func resourceOutscaleAccessKeyCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAccessKeyCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var err error @@ -98,10 +98,10 @@ func resourceOutscaleAccessKeyCreate(d *schema.ResourceData, meta interface{}) e } } - return resourceOutscaleAccessKeyRead(d, meta) + return ResourceOutscaleAccessKeyRead(d, meta) } -func resourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filter := oscgo.ReadSecretAccessKeyRequest{ @@ -149,7 +149,7 @@ func resourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) err return nil } -func resourceOutscaleAccessKeyUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAccessKeyUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.UpdateAccessKeyRequest{AccessKeyId: d.Id()} @@ -178,10 +178,10 @@ func resourceOutscaleAccessKeyUpdate(d *schema.ResourceData, meta interface{}) e if err != nil { return err } - return resourceOutscaleAccessKeyRead(d, meta) + return ResourceOutscaleAccessKeyRead(d, meta) } -func resourceOutscaleAccessKeyDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAccessKeyDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteAccessKeyRequest{ diff --git a/outscale/resource_outscale_api_access_policy.go b/outscale/resource_outscale_api_access_policy.go index 7293ca149..114452b7a 100644 --- a/outscale/resource_outscale_api_access_policy.go +++ b/outscale/resource_outscale_api_access_policy.go @@ -11,12 +11,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIApiAccessPolicy() *schema.Resource { +func ResourceOutscaleApiAccessPolicy() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIApiAccessPolicyCreate, - Read: resourceOutscaleOAPIApiAccessPolicyRead, - Update: resourceOutscaleOAPIApiAccessPolicyUpdate, - Delete: resourceOutscaleOAPIApiAccessPolicyDelete, + Create: ResourceOutscaleApiAccessPolicyCreate, + Read: ResourceOutscaleApiAccessPolicyRead, + Update: ResourceOutscaleApiAccessPolicyUpdate, + Delete: ResourceOutscaleApiAccessPolicyDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -37,7 +37,7 @@ func resourceOutscaleOAPIApiAccessPolicy() *schema.Resource { } } -func resourceOutscaleOAPIApiAccessPolicyCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessPolicyCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI maxAcc := d.Get("max_access_key_expiration_seconds") @@ -63,10 +63,10 @@ func resourceOutscaleOAPIApiAccessPolicyCreate(d *schema.ResourceData, meta inte if err != nil { return err } - return resourceOutscaleOAPIApiAccessPolicyRead(d, meta) + return ResourceOutscaleApiAccessPolicyRead(d, meta) } -func resourceOutscaleOAPIApiAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadApiAccessPolicyRequest{} @@ -102,7 +102,7 @@ func resourceOutscaleOAPIApiAccessPolicyRead(d *schema.ResourceData, meta interf return nil } -func resourceOutscaleOAPIApiAccessPolicyUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessPolicyUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI _, maxAcc := d.GetChange("max_access_key_expiration_seconds") @@ -128,10 +128,10 @@ func resourceOutscaleOAPIApiAccessPolicyUpdate(d *schema.ResourceData, meta inte if err != nil { return err } - return resourceOutscaleOAPIApiAccessPolicyRead(d, meta) + return ResourceOutscaleApiAccessPolicyRead(d, meta) } -func resourceOutscaleOAPIApiAccessPolicyDelete(d *schema.ResourceData, _ interface{}) error { +func ResourceOutscaleApiAccessPolicyDelete(d *schema.ResourceData, _ interface{}) error { d.SetId("") return nil } diff --git a/outscale/resource_outscale_api_access_rule.go b/outscale/resource_outscale_api_access_rule.go index 9c7ce6810..4de834b50 100644 --- a/outscale/resource_outscale_api_access_rule.go +++ b/outscale/resource_outscale_api_access_rule.go @@ -12,12 +12,12 @@ import ( "github.com/spf13/cast" ) -func resourceOutscaleOAPIApiAccessRule() *schema.Resource { +func ResourceOutscaleApiAccessRule() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIApiAccessRuleCreate, - Read: resourceOutscaleOAPIApiAccessRuleRead, - Update: resourceOutscaleOAPIApiAccessRuleUpdate, - Delete: resourceOutscaleOAPIApiAccessRuleDelete, + Create: ResourceOutscaleApiAccessRuleCreate, + Read: ResourceOutscaleApiAccessRuleRead, + Update: ResourceOutscaleApiAccessRuleUpdate, + Delete: ResourceOutscaleApiAccessRuleDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -53,7 +53,7 @@ func resourceOutscaleOAPIApiAccessRule() *schema.Resource { } } -func resourceOutscaleOAPIApiAccessRuleCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessRuleCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var checkParam = false req := oscgo.CreateApiAccessRuleRequest{} @@ -92,10 +92,10 @@ func resourceOutscaleOAPIApiAccessRuleCreate(d *schema.ResourceData, meta interf } d.SetId(cast.ToString(resp.ApiAccessRule.GetApiAccessRuleId())) - return resourceOutscaleOAPIApiAccessRuleRead(d, meta) + return ResourceOutscaleApiAccessRuleRead(d, meta) } -func resourceOutscaleOAPIApiAccessRuleRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadApiAccessRulesRequest{ @@ -153,7 +153,7 @@ func resourceOutscaleOAPIApiAccessRuleRead(d *schema.ResourceData, meta interfac return nil } -func resourceOutscaleOAPIApiAccessRuleUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessRuleUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI accRid, isIdOk := d.GetOk("api_access_rule_id") @@ -197,10 +197,10 @@ func resourceOutscaleOAPIApiAccessRuleUpdate(d *schema.ResourceData, meta interf if err != nil { return err } - return resourceOutscaleOAPIApiAccessRuleRead(d, meta) + return ResourceOutscaleApiAccessRuleRead(d, meta) } -func resourceOutscaleOAPIApiAccessRuleDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleApiAccessRuleDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteApiAccessRuleRequest{ diff --git a/outscale/resource_outscale_api_access_rule_test.go b/outscale/resource_outscale_api_access_rule_test.go index 86516101a..b873bf5dd 100644 --- a/outscale/resource_outscale_api_access_rule_test.go +++ b/outscale/resource_outscale_api_access_rule_test.go @@ -24,7 +24,7 @@ func TestAccOthers_AccessRule_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleApiAccessRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIApiAccessRuleConfig(ca_path), + Config: testAccOutscaleApiAccessRuleConfig(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleApiAccessRuleExists(resourceName), ), @@ -117,7 +117,7 @@ func testAccCheckOutscaleApiAccessRuleDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIApiAccessRuleConfig(path string) string { +func testAccOutscaleApiAccessRuleConfig(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_rule" { ca_pem = file(%q) diff --git a/outscale/resource_outscale_ca.go b/outscale/resource_outscale_ca.go index b6a25615b..8236260c1 100644 --- a/outscale/resource_outscale_ca.go +++ b/outscale/resource_outscale_ca.go @@ -12,12 +12,12 @@ import ( "github.com/spf13/cast" ) -func resourceOutscaleOAPICa() *schema.Resource { +func ResourceOutscaleCa() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPICaCreate, - Read: resourceOutscaleOAPICaRead, - Update: resourceOutscaleOAPICaUpdate, - Delete: resourceOutscaleOAPICaDelete, + Create: ResourceOutscaleCaCreate, + Read: ResourceOutscaleCaRead, + Update: ResourceOutscaleCaUpdate, + Delete: ResourceOutscaleCaDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -47,7 +47,7 @@ func resourceOutscaleOAPICa() *schema.Resource { } } -func resourceOutscaleOAPICaCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleCaCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if _, ok := d.GetOk("ca_pem"); ok == false { @@ -76,10 +76,10 @@ func resourceOutscaleOAPICaCreate(d *schema.ResourceData, meta interface{}) erro } d.SetId(cast.ToString(resp.Ca.GetCaId())) - return resourceOutscaleOAPICaRead(d, meta) + return ResourceOutscaleCaRead(d, meta) } -func resourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleCaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadCasRequest{ @@ -121,7 +121,7 @@ func resourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) error return nil } -func resourceOutscaleOAPICaUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleCaUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.UpdateCaRequest{ @@ -143,10 +143,10 @@ func resourceOutscaleOAPICaUpdate(d *schema.ResourceData, meta interface{}) erro if err != nil { return err } - return resourceOutscaleOAPICaRead(d, meta) + return ResourceOutscaleCaRead(d, meta) } -func resourceOutscaleOAPICaDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleCaDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteCaRequest{ diff --git a/outscale/resource_outscale_ca_test.go b/outscale/resource_outscale_ca_test.go index 42b443e42..49fe050ba 100644 --- a/outscale/resource_outscale_ca_test.go +++ b/outscale/resource_outscale_ca_test.go @@ -24,13 +24,13 @@ func TestAccOthers_Ca_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleCaDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPICaConfig(ca_path), + Config: testAccOutscaleCaConfig(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resourceName), ), }, { - Config: testAccOutscaleOAPICaConfigUpdateDescription(ca_path), + Config: testAccOutscaleCaConfigUpdateDescription(ca_path), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resourceName), ), @@ -122,7 +122,7 @@ func testAccCheckOutscaleCaDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPICaConfig(path string) string { +func testAccOutscaleCaConfig(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_test" { ca_pem = file(%q) @@ -130,7 +130,7 @@ resource "outscale_ca" "ca_test" { }`, path) } -func testAccOutscaleOAPICaConfigUpdateDescription(path string) string { +func testAccOutscaleCaConfigUpdateDescription(path string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_test" { ca_pem = file(%q) diff --git a/outscale/resource_outscale_client_gateway.go b/outscale/resource_outscale_client_gateway.go index 7886354b3..951728822 100644 --- a/outscale/resource_outscale_client_gateway.go +++ b/outscale/resource_outscale_client_gateway.go @@ -15,12 +15,12 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" ) -func resourceOutscaleClientGateway() *schema.Resource { +func ResourceOutscaleClientGateway() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleClientGatewayCreate, - Read: resourceOutscaleClientGatewayRead, - Update: resourceOutscaleClientGatewayUpdate, - Delete: resourceOutscaleClientGatewayDelete, + Create: ResourceOutscaleClientGatewayCreate, + Read: ResourceOutscaleClientGatewayRead, + Update: ResourceOutscaleClientGatewayUpdate, + Delete: ResourceOutscaleClientGatewayDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -58,7 +58,7 @@ func resourceOutscaleClientGateway() *schema.Resource { } } -func resourceOutscaleClientGatewayCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleClientGatewayCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateClientGatewayRequest{ @@ -90,10 +90,10 @@ func resourceOutscaleClientGatewayCreate(d *schema.ResourceData, meta interface{ d.SetId(*resp.GetClientGateway().ClientGatewayId) - return resourceOutscaleClientGatewayRead(d, meta) + return ResourceOutscaleClientGatewayRead(d, meta) } -func resourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI clientGatewayID := d.Id() @@ -142,17 +142,17 @@ func resourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) return nil } -func resourceOutscaleClientGatewayUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleClientGatewayUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleClientGatewayRead(d, meta) + return ResourceOutscaleClientGatewayRead(d, meta) } -func resourceOutscaleClientGatewayDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleClientGatewayDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI gatewayID := d.Id() diff --git a/outscale/resource_outscale_dhcp_option.go b/outscale/resource_outscale_dhcp_option.go index 756acfd48..d6483de99 100644 --- a/outscale/resource_outscale_dhcp_option.go +++ b/outscale/resource_outscale_dhcp_option.go @@ -12,12 +12,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleDHCPOption() *schema.Resource { +func ResourceOutscaleDHCPOption() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleDHCPOptionCreate, - Read: resourceOutscaleDHCPOptionRead, - Update: resourceOutscaleDHCPOptionUpdate, - Delete: resourceOutscaleDHCPOptionDelete, + Create: ResourceOutscaleDHCPOptionCreate, + Read: ResourceOutscaleDHCPOptionRead, + Update: ResourceOutscaleDHCPOptionUpdate, + Delete: ResourceOutscaleDHCPOptionDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -72,7 +72,7 @@ func resourceOutscaleDHCPOption() *schema.Resource { } } -func resourceOutscaleDHCPOptionCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleDHCPOptionCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI createOpts := oscgo.CreateDhcpOptionsRequest{} @@ -112,10 +112,10 @@ func resourceOutscaleDHCPOptionCreate(d *schema.ResourceData, meta interface{}) d.SetId(dhcp.GetDhcpOptionsSetId()) - return resourceOutscaleDHCPOptionRead(d, meta) + return ResourceOutscaleDHCPOptionRead(d, meta) } -func resourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI dhcpID := d.Id() @@ -156,16 +156,16 @@ func resourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) er return nil } -func resourceOutscaleDHCPOptionUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleDHCPOptionUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleDHCPOptionRead(d, meta) + return ResourceOutscaleDHCPOptionRead(d, meta) } -func resourceOutscaleDHCPOptionDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleDHCPOptionDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI dhcpID := d.Id() diff --git a/outscale/resource_outscale_flexible_gpu.go b/outscale/resource_outscale_flexible_gpu.go index 453000acd..9c3e73670 100644 --- a/outscale/resource_outscale_flexible_gpu.go +++ b/outscale/resource_outscale_flexible_gpu.go @@ -11,12 +11,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIFlexibleGpu() *schema.Resource { +func ResourceOutscaleFlexibleGpu() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIFlexibleGpuCreate, - Read: resourceOutscaleOAPIFlexibleGpuRead, - Delete: resourceOutscaleOAPIFlexibleGpuDelete, - Update: resourceOutscaleOAPIFlexibleGpuUpdate, + Create: ResourceOutscaleFlexibleGpuCreate, + Read: ResourceOutscaleFlexibleGpuRead, + Delete: ResourceOutscaleFlexibleGpuDelete, + Update: ResourceOutscaleFlexibleGpuUpdate, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -64,7 +64,7 @@ func resourceOutscaleOAPIFlexibleGpu() *schema.Resource { } } -func resourceOutscaleOAPIFlexibleGpuCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.CreateFlexibleGpuRequest{} @@ -102,10 +102,10 @@ func resourceOutscaleOAPIFlexibleGpuCreate(d *schema.ResourceData, meta interfac d.SetId(resp.FlexibleGpu.GetFlexibleGpuId()) - return resourceOutscaleOAPIFlexibleGpuRead(d, meta) + return ResourceOutscaleFlexibleGpuRead(d, meta) } -func resourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI napid := d.Id() @@ -167,7 +167,7 @@ func resourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interface{ return nil } -func resourceOutscaleOAPIFlexibleGpuUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI v := d.Get("delete_on_vm_deletion") @@ -191,11 +191,11 @@ func resourceOutscaleOAPIFlexibleGpuUpdate(d *schema.ResourceData, meta interfac if err != nil { return err } - return resourceOutscaleOAPIFlexibleGpuRead(d, meta) + return ResourceOutscaleFlexibleGpuRead(d, meta) } -func resourceOutscaleOAPIFlexibleGpuDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.DeleteFlexibleGpuRequest{ diff --git a/outscale/resource_outscale_flexible_gpu_link.go b/outscale/resource_outscale_flexible_gpu_link.go index 226d663ff..367c663a8 100644 --- a/outscale/resource_outscale_flexible_gpu_link.go +++ b/outscale/resource_outscale_flexible_gpu_link.go @@ -12,12 +12,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIFlexibleGpuLink() *schema.Resource { +func ResourceOutscaleFlexibleGpuLink() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIFlexibleGpuLinkCreate, - Read: resourceOutscaleOAPIFlexibleGpuLinkRead, + Create: ResourceOutscaleFlexibleGpuLinkCreate, + Read: ResourceOutscaleFlexibleGpuLinkRead, Update: resourceFlexibleGpuLinkUpdate, - Delete: resourceOutscaleOAPIFlexibleGpuLinkDelete, + Delete: ResourceOutscaleFlexibleGpuLinkDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -50,7 +50,7 @@ func resourceOutscaleOAPIFlexibleGpuLink() *schema.Resource { } } -func resourceOutscaleOAPIFlexibleGpuLinkCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuLinkCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vmId := d.Get("vm_id").(string) GpuIdsList := utils.SetToStringSlice(d.Get("flexible_gpu_ids").(*schema.Set)) @@ -83,10 +83,10 @@ func resourceOutscaleOAPIFlexibleGpuLinkCreate(d *schema.ResourceData, meta inte return fmt.Errorf("Unable to change ShutdownBehavior: %s\n", err) } - return resourceOutscaleOAPIFlexibleGpuLinkRead(d, meta) + return ResourceOutscaleFlexibleGpuLinkRead(d, meta) } -func resourceOutscaleOAPIFlexibleGpuLinkRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuLinkRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vmId := d.Get("vm_id").(string) req := &oscgo.ReadFlexibleGpusRequest{ @@ -129,7 +129,7 @@ func resourceOutscaleOAPIFlexibleGpuLinkRead(d *schema.ResourceData, meta interf return nil } -func resourceOutscaleOAPIFlexibleGpuLinkDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleFlexibleGpuLinkDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI GpuIdsList := utils.SetToStringSlice(d.Get("flexible_gpu_ids").(*schema.Set)) vmId := d.Get("vm_id").(string) @@ -239,7 +239,7 @@ func resourceFlexibleGpuLinkUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Unable to change ShutdownBehavior: %s\n", err) } - return resourceOutscaleOAPIFlexibleGpuLinkRead(d, meta) + return ResourceOutscaleFlexibleGpuLinkRead(d, meta) } func changeShutdownBehavior(conn *oscgo.APIClient, vmId string, timeOut time.Duration) error { diff --git a/outscale/resource_outscale_flexible_gpu_link_test.go b/outscale/resource_outscale_flexible_gpu_link_test.go index 1cbf3ab57..6cefbfa27 100644 --- a/outscale/resource_outscale_flexible_gpu_link_test.go +++ b/outscale/resource_outscale_flexible_gpu_link_test.go @@ -19,7 +19,7 @@ func TestAccVM_withFlexibleGpuLink_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIFlexibleGpuLinkConfig(omi, "tinav5.c2r2p2", utils.GetRegion()), + Config: testAccOutscaleFlexibleGpuLinkConfig(omi, "tinav5.c2r2p2", utils.GetRegion()), }, }, }) @@ -28,7 +28,7 @@ func TestAccVM_withFlexibleGpuLink_basic(t *testing.T) { } } -func testAccOutscaleOAPIFlexibleGpuLinkConfig(omi, vmType, region string) string { +func testAccOutscaleFlexibleGpuLinkConfig(omi, vmType, region string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_fgpu" { security_group_name = "sg_GPU" diff --git a/outscale/resource_outscale_flexible_gpu_test.go b/outscale/resource_outscale_flexible_gpu_test.go index 00e49fe7e..9e35af961 100644 --- a/outscale/resource_outscale_flexible_gpu_test.go +++ b/outscale/resource_outscale_flexible_gpu_test.go @@ -18,13 +18,13 @@ func TestAccOthers_FlexibleGpu_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIFlexibleGpuConfig(utils.GetRegion()), + Config: testAccOutscaleFlexibleGpuConfig(utils.GetRegion()), }, }, }) } -func testAccOutscaleOAPIFlexibleGpuConfig(region string) string { +func testAccOutscaleFlexibleGpuConfig(region string) string { return fmt.Sprintf(` resource "outscale_flexible_gpu" "fGPU-1" { model_name = "nvidia-p6" diff --git a/outscale/resource_outscale_image.go b/outscale/resource_outscale_image.go index c70e44ea3..bdd2025a9 100644 --- a/outscale/resource_outscale_image.go +++ b/outscale/resource_outscale_image.go @@ -24,7 +24,7 @@ const ( OutscaleImageRetryMinTimeout = 3 * time.Second ) -func resourceOutscaleOAPIImage() *schema.Resource { +func ResourceOutscaleImage() *schema.Resource { return &schema.Resource{ Create: resourceOAPIImageCreate, Read: resourceOAPIImageRead, @@ -436,7 +436,7 @@ func resourceOAPIImageDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting the image %s", err) } - if err := resourceOutscaleOAPIImageWaitForDestroy(d.Id(), conn); err != nil { + if err := ResourceOutscaleImageWaitForDestroy(d.Id(), conn); err != nil { return err } @@ -444,7 +444,7 @@ func resourceOAPIImageDelete(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceOutscaleOAPIImageWaitForDestroy(id string, conn *oscgo.APIClient) error { +func ResourceOutscaleImageWaitForDestroy(id string, conn *oscgo.APIClient) error { log.Printf("[INFO] Waiting for OMI %s to be deleted...", id) filterReq := oscgo.ReadImagesRequest{ diff --git a/outscale/resource_outscale_image_export_task.go b/outscale/resource_outscale_image_export_task.go index f06e438ad..5230fe255 100644 --- a/outscale/resource_outscale_image_export_task.go +++ b/outscale/resource_outscale_image_export_task.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIIMageExportTask() *schema.Resource { +func ResourceOutscaleIMageExportTask() *schema.Resource { return &schema.Resource{ Create: resourceOAPIImageExportTaskCreate, Read: resourceOAPIImageExportTaskRead, @@ -179,7 +179,7 @@ func resourceOAPIImageExportTaskCreate(d *schema.ResourceData, meta interface{}) return err } } - _, err = resourceOutscaleImageTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) + _, err = ResourceOutscaleImageTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) if err != nil { return err } @@ -281,7 +281,7 @@ func resourceOAPIImageExportTaskUpdate(d *schema.ResourceData, meta interface{}) return resourceOAPIImageExportTaskRead(d, meta) } -func resourceOutscaleImageTaskWaitForAvailable(id string, client *oscgo.APIClient, timeout time.Duration) (oscgo.ImageExportTask, error) { +func ResourceOutscaleImageTaskWaitForAvailable(id string, client *oscgo.APIClient, timeout time.Duration) (oscgo.ImageExportTask, error) { log.Printf("Waiting for Image Task %s to become available...", id) var image oscgo.ImageExportTask stateConf := &resource.StateChangeConf{ diff --git a/outscale/resource_outscale_image_export_task_test.go b/outscale/resource_outscale_image_export_task_test.go index d0efd5ed4..487b2e719 100644 --- a/outscale/resource_outscale_image_export_task_test.go +++ b/outscale/resource_outscale_image_export_task_test.go @@ -33,13 +33,13 @@ func TestAccVM_withImageExportTask_basic(t *testing.T) { { Config: testAccOAPIImageExportTaskConfigBasic(omi, "tinav4.c2r2p2", region, imageName, ""), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPImageExportTaskExists("outscale_image_export_task.outscale_image_export_task"), + testAccCheckOutscalemageExportTaskExists("outscale_image_export_task.outscale_image_export_task"), ), }, { Config: testAccOAPIImageExportTaskConfigBasic(omi, "tinav4.c2r2p2", region, imageName, tags), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPImageExportTaskExists("outscale_image_export_task.outscale_image_export_task"), + testAccCheckOutscalemageExportTaskExists("outscale_image_export_task.outscale_image_export_task"), ), }, }, @@ -49,7 +49,7 @@ func TestAccVM_withImageExportTask_basic(t *testing.T) { } } -func testAccCheckOutscaleOAPImageExportTaskExists(n string) resource.TestCheckFunc { +func testAccCheckOutscalemageExportTaskExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/outscale/resource_outscale_image_launch_permission.go b/outscale/resource_outscale_image_launch_permission.go index e849b7666..4de6ae4ff 100644 --- a/outscale/resource_outscale_image_launch_permission.go +++ b/outscale/resource_outscale_image_launch_permission.go @@ -17,12 +17,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIImageLaunchPermission() *schema.Resource { +func ResourceOutscaleImageLaunchPermission() *schema.Resource { return &schema.Resource{ - Exists: resourceOutscaleOAPIImageLaunchPermissionExists, - Create: resourceOutscaleOAPIImageLaunchPermissionCreate, - Read: resourceOutscaleOAPIImageLaunchPermissionRead, - Delete: resourceOutscaleOAPIImageLaunchPermissionDelete, + Exists: ResourceOutscaleImageLaunchPermissionExists, + Create: ResourceOutscaleImageLaunchPermissionCreate, + Read: ResourceOutscaleImageLaunchPermissionRead, + Delete: ResourceOutscaleImageLaunchPermissionDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -106,7 +106,7 @@ func resourceOutscaleOAPIImageLaunchPermission() *schema.Resource { } } -func resourceOutscaleOAPIImageLaunchPermissionExists(d *schema.ResourceData, meta interface{}) (bool, error) { +func ResourceOutscaleImageLaunchPermissionExists(d *schema.ResourceData, meta interface{}) (bool, error) { conn := meta.(*OutscaleClient).OSCAPI imageID := d.Get("image_id").(string) @@ -130,7 +130,7 @@ func expandOAPIImagePermission(permissionType interface{}) (res oscgo.Permission return } -func resourceOutscaleOAPIImageLaunchPermissionCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleImageLaunchPermissionCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI imageID, ok := d.GetOk("image_id") @@ -171,10 +171,10 @@ func resourceOutscaleOAPIImageLaunchPermissionCreate(d *schema.ResourceData, met d.SetId(imageID.(string)) - return resourceOutscaleOAPIImageLaunchPermissionRead(d, meta) + return ResourceOutscaleImageLaunchPermissionRead(d, meta) } -func resourceOutscaleOAPIImageLaunchPermissionRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleImageLaunchPermissionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.ReadImagesResponse @@ -221,7 +221,7 @@ func resourceOutscaleOAPIImageLaunchPermissionRead(d *schema.ResourceData, meta return d.Set("permissions_to_launch", []map[string]interface{}{lp}) } -func resourceOutscaleOAPIImageLaunchPermissionDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleImageLaunchPermissionDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI imageID, ok := d.GetOk("image_id") diff --git a/outscale/resource_outscale_image_launch_permission_test.go b/outscale/resource_outscale_image_launch_permission_test.go index 2ed02e318..e98ba3101 100644 --- a/outscale/resource_outscale_image_launch_permission_test.go +++ b/outscale/resource_outscale_image_launch_permission_test.go @@ -31,21 +31,21 @@ func TestAccVM_WithImageLaunchPermission_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), + Config: testAccOutscaleImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), }, // Drop just launch permission to test destruction { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, false, rInt), + Config: testAccOutscaleImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, false, rInt), Check: r.ComposeTestCheckFunc( - testAccOutscaleOAPIImageLaunchPermissionDestroyed(accountID, &imageID), + testAccOutscaleImageLaunchPermissionDestroyed(accountID, &imageID), ), }, // Re-add everything so we can test when AMI disappears { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), + Config: testAccOutscaleImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -53,9 +53,9 @@ func TestAccVM_WithImageLaunchPermission_Basic(t *testing.T) { // Here we delete the AMI to verify the follow-on refresh after this step // should not error. { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), + Config: testAccOutscaleImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( - testAccOutscaleOAPIImageDisappears(&imageID), + testAccOutscaleImageDisappears(&imageID), ), ExpectNonEmptyPlan: true, }, @@ -78,14 +78,14 @@ func TestAccVM_ImageLaunchPermissionDestruction_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, false), + Config: testAccOutscaleImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, false), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), - testAccOutscaleOAPIImageLaunchPermissionExists(accountID, &imageID), + testAccOutscaleImageLaunchPermissionExists(accountID, &imageID), ), }, { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, true), + Config: testAccOutscaleImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, true), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -112,7 +112,7 @@ func testCheckResourceOAPILPIGetAttr(name, key string, value *string) r.TestChec } } -func testAccOutscaleOAPIImageLaunchPermissionExists(accountID string, imageID *string) r.TestCheckFunc { +func testAccOutscaleImageLaunchPermissionExists(accountID string, imageID *string) r.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI if has, err := hasOAPILaunchPermission(conn, *imageID); err != nil { @@ -124,7 +124,7 @@ func testAccOutscaleOAPIImageLaunchPermissionExists(accountID string, imageID *s } } -func testAccOutscaleOAPIImageLaunchPermissionDestroyed(accountID string, imageID *string) r.TestCheckFunc { +func testAccOutscaleImageLaunchPermissionDestroyed(accountID string, imageID *string) r.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI if has, err := hasOAPILaunchPermission(conn, *imageID); err != nil { @@ -136,10 +136,10 @@ func testAccOutscaleOAPIImageLaunchPermissionDestroyed(accountID string, imageID } } -// testAccOutscaleOAPIImageDisappears is technically a "test check function" but really it +// testAccOutscaleImageDisappears is technically a "test check function" but really it // exists to perform a side effect of deleting an AMI out from under a resource // so we can test that Terraform will react properly -func testAccOutscaleOAPIImageDisappears(imageID *string) r.TestCheckFunc { +func testAccOutscaleImageDisappears(imageID *string) r.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI req := oscgo.DeleteImageRequest{ @@ -158,7 +158,7 @@ func testAccOutscaleOAPIImageDisappears(imageID *string) r.TestCheckFunc { return err } - return resourceOutscaleOAPIImageWaitForDestroy(*imageID, conn) + return ResourceOutscaleImageWaitForDestroy(*imageID, conn) } } @@ -180,7 +180,7 @@ func testCheckResourceGetAttr(name, key string, value *string) r.TestCheckFunc { } } -func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, accountID, keypair string, includeLaunchPermission bool, r int) string { +func testAccOutscaleImageLaunchPermissionConfig(omi, vmType, region, accountID, keypair string, includeLaunchPermission bool, r int) string { base := fmt.Sprintf(` resource "outscale_security_group" "sg_perm" { security_group_name = "sgLPerm" @@ -221,7 +221,7 @@ func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, account `, accountID) } -func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region, keypair string, r int, includeAddtion, includeRemoval bool) string { +func testAccOutscaleImageLaunchPermissionCreateConfig(omi, vmType, region, keypair string, r int, includeAddtion, includeRemoval bool) string { base := fmt.Sprintf(` resource "outscale_security_group" "sg_perm" { security_group_name = "sgLPerm" diff --git a/outscale/resource_outscale_internet_service.go b/outscale/resource_outscale_internet_service.go index d1bf23fe1..e843ca4ce 100644 --- a/outscale/resource_outscale_internet_service.go +++ b/outscale/resource_outscale_internet_service.go @@ -12,12 +12,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIInternetService() *schema.Resource { +func ResourceOutscaleInternetService() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIInternetServiceCreate, - Read: resourceOutscaleOAPIInternetServiceRead, - Update: resourceOutscaleOAPIInternetServiceUpdate, - Delete: resourceOutscaleOAPIInternetServiceDelete, + Create: ResourceOutscaleInternetServiceCreate, + Read: ResourceOutscaleInternetServiceRead, + Update: ResourceOutscaleInternetServiceUpdate, + Delete: ResourceOutscaleInternetServiceDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -44,7 +44,7 @@ func resourceOutscaleOAPIInternetService() *schema.Resource { } } -func resourceOutscaleOAPIInternetServiceCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.CreateInternetServiceResponse @@ -71,10 +71,10 @@ func resourceOutscaleOAPIInternetServiceCreate(d *schema.ResourceData, meta inte d.SetId(resp.InternetService.GetInternetServiceId()) - return resourceOutscaleOAPIInternetServiceRead(d, meta) + return ResourceOutscaleInternetServiceRead(d, meta) } -func resourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() @@ -119,16 +119,16 @@ func resourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta interf return d.Set("tags", tagsOSCAPIToMap(resp.GetInternetServices()[0].GetTags())) } -func resourceOutscaleOAPIInternetServiceUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPIInternetServiceRead(d, meta) + return ResourceOutscaleInternetServiceRead(d, meta) } -func resourceOutscaleOAPIInternetServiceDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI internetServiceID := d.Id() diff --git a/outscale/resource_outscale_internet_service_link.go b/outscale/resource_outscale_internet_service_link.go index 98e943cba..2bbb64602 100644 --- a/outscale/resource_outscale_internet_service_link.go +++ b/outscale/resource_outscale_internet_service_link.go @@ -12,11 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIInternetServiceLink() *schema.Resource { +func ResourceOutscaleInternetServiceLink() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIInternetServiceLinkCreate, - Read: resourceOutscaleOAPIInternetServiceLinkRead, - Delete: resourceOutscaleOAPIInternetServiceLinkDelete, + Create: ResourceOutscaleInternetServiceLinkCreate, + Read: ResourceOutscaleInternetServiceLinkRead, + Delete: ResourceOutscaleInternetServiceLinkDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -63,7 +63,7 @@ func resourceOutscaleOAPIInternetServiceLink() *schema.Resource { } } -func resourceOutscaleOAPIInternetServiceLinkCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceLinkCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI internetServiceID := d.Get("internet_service_id").(string) @@ -107,10 +107,10 @@ func resourceOutscaleOAPIInternetServiceLinkCreate(d *schema.ResourceData, meta d.SetId(internetServiceID) - return resourceOutscaleOAPIInternetServiceLinkRead(d, meta) + return ResourceOutscaleInternetServiceLinkRead(d, meta) } -func resourceOutscaleOAPIInternetServiceLinkRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceLinkRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI internetServiceID := d.Id() @@ -158,7 +158,7 @@ func resourceOutscaleOAPIInternetServiceLinkRead(d *schema.ResourceData, meta in }) } -func resourceOutscaleOAPIInternetServiceLinkDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleInternetServiceLinkDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI internetServiceID := d.Id() diff --git a/outscale/resource_outscale_internet_service_test.go b/outscale/resource_outscale_internet_service_test.go index 1ed197143..3cbea0ab6 100644 --- a/outscale/resource_outscale_internet_service_test.go +++ b/outscale/resource_outscale_internet_service_test.go @@ -21,13 +21,13 @@ func TestAccOthers_InternetService_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleInternetServiceDestroyed, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIInternetServiceConfig(), + Config: testAccOutscaleInternetServiceConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleInternetServiceExists("outscale_internet_service.outscale_internet_service"), ), }, { - Config: testAccOutscaleOAPIInternetServiceConfig(), + Config: testAccOutscaleInternetServiceConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleInternetServiceExists("outscale_internet_service.outscale_internet_service"), ), @@ -99,7 +99,7 @@ func testAccCheckOutscaleInternetServiceDestroyed(s *terraform.State) error { return nil } -func testAccOutscaleOAPIInternetServiceConfig() string { +func testAccOutscaleInternetServiceConfig() string { return ` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_keypair.go b/outscale/resource_outscale_keypair.go index 2427b8bd8..3fe2aed9d 100644 --- a/outscale/resource_outscale_keypair.go +++ b/outscale/resource_outscale_keypair.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIKeyPair() *schema.Resource { +func ResourceOutscaleKeyPair() *schema.Resource { return &schema.Resource{ Create: resourceOAPIKeyPairCreate, Read: resourceOAPIKeyPairRead, diff --git a/outscale/resource_outscale_keypair_test.go b/outscale/resource_outscale_keypair_test.go index ad3d617da..038bc8fbe 100644 --- a/outscale/resource_outscale_keypair_test.go +++ b/outscale/resource_outscale_keypair_test.go @@ -24,13 +24,13 @@ func TestAccOthers_Keypair_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIKeyPairDestroy, + CheckDestroy: testAccCheckOutscaleKeyPairDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIKeyPairConfig(rInt), + Config: testAccOutscaleKeyPairConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeyPairExists("outscale_keypair.a_key_pair", &conf), - testAccCheckOutscaleOAPIKeyPairFingerprint("8a:47:95:bb:b1:45:66:ef:99:f5:80:91:cc:be:94:48", &conf), + testAccCheckOutscaleKeyPairExists("outscale_keypair.a_key_pair", &conf), + testAccCheckOutscaleKeyPairFingerprint("8a:47:95:bb:b1:45:66:ef:99:f5:80:91:cc:be:94:48", &conf), ), }, }, @@ -45,12 +45,12 @@ func TestAccOthers_Keypair_retrieveName(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIKeyPairDestroy, + CheckDestroy: testAccCheckOutscaleKeyPairDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIKeyPairConfigRetrieveName(rInt), + Config: testAccOutscaleKeyPairConfigRetrieveName(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeyPairExists("outscale_keypair.a_key_pair", &conf), + testAccCheckOutscaleKeyPairExists("outscale_keypair.a_key_pair", &conf), resource.TestCheckResourceAttr( "outscale_keypair.a_key_pair", "keypair_name", fmt.Sprintf("tf-acc-key-pair-%d", rInt), ), @@ -68,13 +68,13 @@ func TestAccOthers_Keypair_generatedName(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIKeyPairDestroy, + CheckDestroy: testAccCheckOutscaleKeyPairDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIKeyPairConfigGeneratedName, + Config: testAccOutscaleKeyPairConfigGeneratedName, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeyPairExists("outscale_keypair.a_key_pair", &conf), - testAccCheckOutscaleOAPIKeyPairFingerprint("8a:47:95:bb:b1:45:66:ef:99:f5:80:91:cc:be:94:48", &conf), + testAccCheckOutscaleKeyPairExists("outscale_keypair.a_key_pair", &conf), + testAccCheckOutscaleKeyPairFingerprint("8a:47:95:bb:b1:45:66:ef:99:f5:80:91:cc:be:94:48", &conf), func(s *terraform.State) error { if conf.GetKeypairName() == "" { return fmt.Errorf("bad: No SG name") @@ -90,7 +90,7 @@ func TestAccOthers_Keypair_generatedName(t *testing.T) { }) } -func testAccCheckOutscaleOAPIKeyPairDestroy(s *terraform.State) error { +func testAccCheckOutscaleKeyPairDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient) for _, rs := range s.RootModule().Resources { @@ -126,7 +126,7 @@ func testAccCheckOutscaleOAPIKeyPairDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPIKeyPairFingerprint(expectedFingerprint string, conf *oscgo.Keypair) resource.TestCheckFunc { +func testAccCheckOutscaleKeyPairFingerprint(expectedFingerprint string, conf *oscgo.Keypair) resource.TestCheckFunc { return func(s *terraform.State) error { if conf.GetKeypairFingerprint() != expectedFingerprint { return fmt.Errorf("incorrect fingerprint. expected %s, got %s", expectedFingerprint, conf.GetKeypairFingerprint()) @@ -135,7 +135,7 @@ func testAccCheckOutscaleOAPIKeyPairFingerprint(expectedFingerprint string, conf } } -func testAccCheckOutscaleOAPIKeyPairExists(n string, res *oscgo.Keypair) resource.TestCheckFunc { +func testAccCheckOutscaleKeyPairExists(n string, res *oscgo.Keypair) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -175,7 +175,7 @@ func testAccCheckOutscaleOAPIKeyPairExists(n string, res *oscgo.Keypair) resourc } } -func testAccOutscaleOAPIKeyPairConfig(r int) string { +func testAccOutscaleKeyPairConfig(r int) string { return fmt.Sprintf(` resource "outscale_keypair" "a_key_pair" { keypair_name = "tf-acc-key-pair-%d" @@ -184,7 +184,7 @@ func testAccOutscaleOAPIKeyPairConfig(r int) string { `, r) } -func testAccOutscaleOAPIKeyPairConfigRetrieveName(r int) string { +func testAccOutscaleKeyPairConfigRetrieveName(r int) string { return fmt.Sprintf(` resource "outscale_keypair" "a_key_pair" { keypair_name = "tf-acc-key-pair-%d" @@ -192,7 +192,7 @@ func testAccOutscaleOAPIKeyPairConfigRetrieveName(r int) string { `, r) } -const testAccOutscaleOAPIKeyPairConfigGeneratedName = ` +const testAccOutscaleKeyPairConfigGeneratedName = ` resource "outscale_keypair" "a_key_pair" { public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 phodgson@thoughtworks.com" } diff --git a/outscale/resource_outscale_load_balancer.go b/outscale/resource_outscale_load_balancer.go index 28f2ee58d..4079c9350 100644 --- a/outscale/resource_outscale_load_balancer.go +++ b/outscale/resource_outscale_load_balancer.go @@ -35,12 +35,12 @@ func lb_sg_schema() *schema.Schema { } } -func resourceOutscaleOAPILoadBalancer() *schema.Resource { +func ResourceOutscaleLoadBalancer() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILoadBalancerCreate, - Read: resourceOutscaleOAPILoadBalancerRead, - Update: resourceOutscaleOAPILoadBalancerUpdate, - Delete: resourceOutscaleOAPILoadBalancerDelete, + Create: ResourceOutscaleLoadBalancerCreate, + Read: ResourceOutscaleLoadBalancerRead, + Update: ResourceOutscaleLoadBalancerUpdate, + Delete: ResourceOutscaleLoadBalancerDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -365,11 +365,11 @@ func lb_listener_schema(computed bool) map[string]*schema.Schema { } } -func resourceOutscaleOAPILoadBalancerCreate(d *schema.ResourceData, meta interface{}) error { - return resourceOutscaleOAPILoadBalancerCreate_(d, meta, false) +func ResourceOutscaleLoadBalancerCreate(d *schema.ResourceData, meta interface{}) error { + return ResourceOutscaleLoadBalancerCreate_(d, meta, false) } -func resourceOutscaleOAPILoadBalancerCreate_(d *schema.ResourceData, meta interface{}, isUpdate bool) error { +func ResourceOutscaleLoadBalancerCreate_(d *schema.ResourceData, meta interface{}, isUpdate bool) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.CreateLoadBalancerRequest{} @@ -462,7 +462,7 @@ func resourceOutscaleOAPILoadBalancerCreate_(d *schema.ResourceData, meta interf } } - return resourceOutscaleOAPILoadBalancerRead(d, meta) + return ResourceOutscaleLoadBalancerRead(d, meta) } func readResourceLb(conn *oscgo.APIClient, elbName string) (*oscgo.LoadBalancer, *oscgo.ReadLoadBalancersResponse, error) { @@ -498,7 +498,7 @@ func readResourceLb(conn *oscgo.APIClient, elbName string) (*oscgo.LoadBalancer, return &lb, &resp, nil } -func resourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI elbName := d.Id() @@ -580,7 +580,7 @@ func resourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interface return nil } -func resourceOutscaleOAPILoadBalancerUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var err error @@ -893,10 +893,10 @@ func resourceOutscaleOAPILoadBalancerUpdate(d *schema.ResourceData, meta interfa } } - return resourceOutscaleOAPILoadBalancerRead(d, meta) + return ResourceOutscaleLoadBalancerRead(d, meta) } -func resourceOutscaleOAPILoadBalancerDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[INFO] Deleting Load Balancer: %s", d.Id()) diff --git a/outscale/resource_outscale_load_balancer_attributes.go b/outscale/resource_outscale_load_balancer_attributes.go index e6c891a95..da61c1c03 100644 --- a/outscale/resource_outscale_load_balancer_attributes.go +++ b/outscale/resource_outscale_load_balancer_attributes.go @@ -15,12 +15,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { +func ResourceOutscaleLoadBalancerAttributes() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILoadBalancerAttributesCreate, - Update: resourceOutscaleOAPILoadBalancerAttributesUpdate, - Read: resourceOutscaleOAPILoadBalancerAttributesRead, - Delete: resourceOutscaleOAPILoadBalancerAttributesDelete, + Create: ResourceOutscaleLoadBalancerAttributesCreate, + Update: ResourceOutscaleLoadBalancerAttributesUpdate, + Read: ResourceOutscaleLoadBalancerAttributesRead, + Delete: ResourceOutscaleLoadBalancerAttributesDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -272,13 +272,13 @@ func lb_atoi_at(hc map[string]interface{}, el string) (int, bool) { return r, err == nil } -func resourceOutscaleOAPILoadBalancerAttributesUpdate(d *schema.ResourceData, +func ResourceOutscaleLoadBalancerAttributesUpdate(d *schema.ResourceData, meta interface{}) error { - return resourceOutscaleOAPILoadBalancerAttributesCreate_(d, meta, true) + return ResourceOutscaleLoadBalancerAttributesCreate_(d, meta, true) } -func resourceOutscaleOAPILoadBalancerAttributesCreate(d *schema.ResourceData, meta interface{}) error { - return resourceOutscaleOAPILoadBalancerAttributesCreate_(d, meta, false) +func ResourceOutscaleLoadBalancerAttributesCreate(d *schema.ResourceData, meta interface{}) error { + return ResourceOutscaleLoadBalancerAttributesCreate_(d, meta, false) } func loadBalancerAttributesDoRequest(d *schema.ResourceData, meta interface{}, req oscgo.UpdateLoadBalancerRequest) error { @@ -300,11 +300,11 @@ func loadBalancerAttributesDoRequest(d *schema.ResourceData, meta interface{}, r d.SetId(req.LoadBalancerName) log.Printf("[INFO] LBU Attr ID: %s", d.Id()) - return resourceOutscaleOAPILoadBalancerAttributesRead(d, meta) + return ResourceOutscaleLoadBalancerAttributesRead(d, meta) } -func resourceOutscaleOAPILoadBalancerAttributesCreate_(d *schema.ResourceData, meta interface{}, isUpdate bool) error { +func ResourceOutscaleLoadBalancerAttributesCreate_(d *schema.ResourceData, meta interface{}, isUpdate bool) error { ename, ok := d.GetOk("load_balancer_name") if !ok { @@ -394,7 +394,7 @@ func resourceOutscaleOAPILoadBalancerAttributesCreate_(d *schema.ResourceData, m return loadBalancerAttributesDoRequest(d, meta, req) } -func resourceOutscaleOAPILoadBalancerAttributesRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerAttributesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI elbName := d.Id() @@ -494,7 +494,7 @@ func resourceOutscaleOAPILoadBalancerAttributesRead(d *schema.ResourceData, meta return nil } -func resourceOutscaleOAPILoadBalancerAttributesDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerAttributesDelete(d *schema.ResourceData, meta interface{}) error { var err error conn := meta.(*OutscaleClient).OSCAPI diff --git a/outscale/resource_outscale_load_balancer_attributes_test.go b/outscale/resource_outscale_load_balancer_attributes_test.go index 18e55099b..f994bb9fc 100644 --- a/outscale/resource_outscale_load_balancer_attributes_test.go +++ b/outscale/resource_outscale_load_balancer_attributes_test.go @@ -25,15 +25,15 @@ func TestAccOthers_LBUAttr_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILBUAttrConfig(utils.GetRegion(), r), + Config: testAccOutscaleLBUAttrConfig(utils.GetRegion(), r), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUAttrExists("outscale_load_balancer_attributes.bar2", &conf), + testAccCheckOutscaleLBUAttrExists("outscale_load_balancer_attributes.bar2", &conf), )}, }, }) } -func testAccCheckOutscaleOAPILBUAttrExists(n string, res *oscgo.AccessLog) resource.TestCheckFunc { +func testAccCheckOutscaleLBUAttrExists(n string, res *oscgo.AccessLog) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -48,7 +48,7 @@ func testAccCheckOutscaleOAPILBUAttrExists(n string, res *oscgo.AccessLog) resou } } -func testAccOutscaleOAPILBUAttrConfig(region string, r int) string { +func testAccOutscaleLBUAttrConfig(region string, r int) string { return fmt.Sprintf(` resource "outscale_load_balancer" "barAtt" { subregion_names = ["%sa"] diff --git a/outscale/resource_outscale_load_balancer_listener_rule.go b/outscale/resource_outscale_load_balancer_listener_rule.go index 59b070c62..cc8423518 100644 --- a/outscale/resource_outscale_load_balancer_listener_rule.go +++ b/outscale/resource_outscale_load_balancer_listener_rule.go @@ -13,12 +13,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleLoadBalancerListenerRule() *schema.Resource { +func ResourceOutscaleLoadBalancerListenerRule() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleLoadBalancerListenerRuleCreate, - Read: resourceOutscaleLoadBalancerListenerRuleRead, - Update: resourceOutscaleLoadBalancerListenerRuleUpdate, - Delete: resourceOutscaleLoadBalancerListenerRuleDelete, + Create: ResourceOutscaleLoadBalancerListenerRuleCreate, + Read: ResourceOutscaleLoadBalancerListenerRuleRead, + Update: ResourceOutscaleLoadBalancerListenerRuleUpdate, + Delete: ResourceOutscaleLoadBalancerListenerRuleDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -97,7 +97,7 @@ func resourceOutscaleLoadBalancerListenerRule() *schema.Resource { } } -func resourceOutscaleLoadBalancerListenerRuleCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerListenerRuleCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.CreateListenerRuleRequest{} @@ -168,10 +168,10 @@ func resourceOutscaleLoadBalancerListenerRuleCreate(d *schema.ResourceData, meta d.SetId(*resp.ListenerRule.ListenerRuleName) - return resourceOutscaleLoadBalancerListenerRuleRead(d, meta) + return ResourceOutscaleLoadBalancerListenerRuleRead(d, meta) } -func resourceOutscaleLoadBalancerListenerRuleRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerListenerRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lrName := d.Id() @@ -239,7 +239,7 @@ func resourceOutscaleLoadBalancerListenerRuleRead(d *schema.ResourceData, meta i return nil } -func resourceOutscaleLoadBalancerListenerRuleUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerListenerRuleUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if d.HasChange("listener_rule") { @@ -282,10 +282,10 @@ func resourceOutscaleLoadBalancerListenerRuleUpdate(d *schema.ResourceData, meta return err } } - return resourceOutscaleLoadBalancerListenerRuleRead(d, meta) + return ResourceOutscaleLoadBalancerListenerRuleRead(d, meta) } -func resourceOutscaleLoadBalancerListenerRuleDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLoadBalancerListenerRuleDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[INFO] Deleting Listener Rule: %s", d.Id()) diff --git a/outscale/resource_outscale_load_balancer_policy.go b/outscale/resource_outscale_load_balancer_policy.go index 01cbe151d..20d4861f5 100644 --- a/outscale/resource_outscale_load_balancer_policy.go +++ b/outscale/resource_outscale_load_balancer_policy.go @@ -14,11 +14,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { +func ResourceOutscaleAppCookieStickinessPolicy() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleAppCookieStickinessPolicyCreate, - Read: resourceOutscaleAppCookieStickinessPolicyRead, - Delete: resourceOutscaleAppCookieStickinessPolicyDelete, + Create: ResourceOutscaleAppCookieStickinessPolicyCreate, + Read: ResourceOutscaleAppCookieStickinessPolicyRead, + Delete: ResourceOutscaleAppCookieStickinessPolicyDelete, Schema: map[string]*schema.Schema{ "policy_name": { @@ -239,7 +239,7 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { } } -func resourceOutscaleAppCookieStickinessPolicyCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAppCookieStickinessPolicyCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI l := d.Get("load_balancer_name") @@ -357,11 +357,11 @@ func resourceOutscaleAppCookieStickinessPolicyCreate(d *schema.ResourceData, met return nil } -func resourceOutscaleAppCookieStickinessPolicyRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAppCookieStickinessPolicyRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceOutscaleAppCookieStickinessPolicyDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleAppCookieStickinessPolicyDelete(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*OutscaleClient).OSCAPI l := d.Get("load_balancer_name").(string) diff --git a/outscale/resource_outscale_load_balancer_test.go b/outscale/resource_outscale_load_balancer_test.go index 7eaf8c520..a1edd1d1c 100644 --- a/outscale/resource_outscale_load_balancer_test.go +++ b/outscale/resource_outscale_load_balancer_test.go @@ -28,12 +28,12 @@ func TestAccOthers_LBUBasic(t *testing.T) { }, IDRefreshName: lbResourceName, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, + CheckDestroy: testAccCheckOutscaleLBUDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILBUConfig(r), + Config: testAccOutscaleLBUConfig(r), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists(lbResourceName, &conf), + testAccCheckOutscaleLBUExists(lbResourceName, &conf), resource.TestCheckResourceAttr(lbResourceName, "subregion_names.#", "1"), resource.TestCheckResourceAttr(lbResourceName, "subregion_names.0", zone), resource.TestCheckResourceAttr(lbResourceName, "listeners.#", "1"), @@ -58,12 +58,12 @@ func TestAccOthers_LBUPublicIp(t *testing.T) { }, IDRefreshName: resourceName, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, + CheckDestroy: testAccCheckOutscaleLBUDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILBUPublicIpConfig(r), + Config: testAccOutscaleLBUPublicIpConfig(r), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists(resourceName, &conf), + testAccCheckOutscaleLBUExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "listeners.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "public_ip"), )}, @@ -71,7 +71,7 @@ func TestAccOthers_LBUPublicIp(t *testing.T) { }) } -func testAccCheckOutscaleOAPILBUDestroy(s *terraform.State) error { +func testAccCheckOutscaleLBUDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI for _, rs := range s.RootModule().Resources { @@ -120,7 +120,7 @@ func testAccCheckOutscaleOAPILBUDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPILBUExists(n string, res *oscgo.LoadBalancer) resource.TestCheckFunc { +func testAccCheckOutscaleLBUExists(n string, res *oscgo.LoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -176,7 +176,7 @@ func testAccCheckOutscaleOAPILBUExists(n string, res *oscgo.LoadBalancer) resour } } -func testAccOutscaleOAPILBUConfig(r int) string { +func testAccOutscaleLBUConfig(r int) string { return fmt.Sprintf(` resource "outscale_load_balancer" "barRes" { subregion_names = ["%sa"] @@ -200,7 +200,7 @@ resource "outscale_load_balancer" "barRes" { `, utils.GetRegion(), r) } -func testAccOutscaleOAPILBUPublicIpConfig(r int) string { +func testAccOutscaleLBUPublicIpConfig(r int) string { return fmt.Sprintf(` resource "outscale_public_ip" "my_public_ip" { diff --git a/outscale/resource_outscale_load_balancer_vms.go b/outscale/resource_outscale_load_balancer_vms.go index 81bfa2816..495a44877 100644 --- a/outscale/resource_outscale_load_balancer_vms.go +++ b/outscale/resource_outscale_load_balancer_vms.go @@ -13,12 +13,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceLBUAttachment() *schema.Resource { +func ResourceLBUAttachment() *schema.Resource { return &schema.Resource{ - Create: resourceLBUAttachmentCreate, - Read: resourceLBUAttachmentRead, - Update: resourceLBUAttachmentUpdate, - Delete: resourceLBUAttachmentDelete, + Create: ResourceLBUAttachmentCreate, + Read: ResourceLBUAttachmentRead, + Update: ResourceLBUAttachmentUpdate, + Delete: ResourceLBUAttachmentDelete, Schema: map[string]*schema.Schema{ "load_balancer_name": { @@ -39,7 +39,7 @@ func resourceLBUAttachment() *schema.Resource { }, } } -func resourceLBUAttachmentCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceLBUAttachmentCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lbuName := d.Get("load_balancer_name").(string) vmIds := d.Get("backend_vm_ids").(*schema.Set) @@ -63,10 +63,10 @@ func resourceLBUAttachmentCreate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Failure registering backend_vm_ids with LBU: %s", err) } d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", lbuName))) - return resourceLBUAttachmentRead(d, meta) + return ResourceLBUAttachmentRead(d, meta) } -func resourceLBUAttachmentRead(d *schema.ResourceData, meta interface{}) error { +func ResourceLBUAttachmentRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lbuName := d.Get("load_balancer_name").(string) lb, _, err := readResourceLb(conn, lbuName) @@ -99,7 +99,7 @@ func resourceLBUAttachmentRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceLBUAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceLBUAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lbuName := d.Get("load_balancer_name").(string) var err error @@ -151,10 +151,10 @@ func resourceLBUAttachmentUpdate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Failure deregistering old backend_vm_ids from LBU: %s", err) } } - return resourceLBUAttachmentRead(d, meta) + return ResourceLBUAttachmentRead(d, meta) } -func resourceLBUAttachmentDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceLBUAttachmentDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI lbuName := d.Get("load_balancer_name").(string) vmIds := d.Get("backend_vm_ids").(*schema.Set) diff --git a/outscale/resource_outscale_load_balancer_vms_test.go b/outscale/resource_outscale_load_balancer_vms_test.go index 671e5995b..7116493a2 100644 --- a/outscale/resource_outscale_load_balancer_vms_test.go +++ b/outscale/resource_outscale_load_balancer_vms_test.go @@ -34,12 +34,12 @@ func TestAccVM_WithLBUAttachment_basic(t *testing.T) { PreCheck: func() { testAccPreCheckValues(t) }, IDRefreshName: "outscale_load_balancer.barTach", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, + CheckDestroy: testAccCheckOutscaleLBUDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILBUAttachmentConfig1(rand, omi, utils.GetRegion()), + Config: testAccOutscaleLBUAttachmentConfig1(rand, omi, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.barTach", &conf), + testAccCheckOutscaleLBUExists("outscale_load_balancer.barTach", &conf), testCheckInstanceAttached(1), ), }, @@ -48,7 +48,7 @@ func TestAccVM_WithLBUAttachment_basic(t *testing.T) { } // add one attachment -func testAccOutscaleOAPILBUAttachmentConfig1(num int, omi, region string) string { +func testAccOutscaleLBUAttachmentConfig1(num int, omi, region string) string { return fmt.Sprintf(` resource "outscale_load_balancer" "barTach" { load_balancer_name = "load-test-%d" diff --git a/outscale/resource_outscale_main_route_table_link.go b/outscale/resource_outscale_main_route_table_link.go index 09c7608c6..c4a081f63 100644 --- a/outscale/resource_outscale_main_route_table_link.go +++ b/outscale/resource_outscale_main_route_table_link.go @@ -86,7 +86,7 @@ func resourceLinkMainRouteTableCreate(d *schema.ResourceData, meta interface{}) } d.SetId(resp.GetLinkRouteTableId()) - return resourceOutscaleOAPILinkRouteTableRead(d, meta) + return ResourceOutscaleLinkRouteTableRead(d, meta) } func resourceLinkMainRouteTableRead(d *schema.ResourceData, meta interface{}) error { diff --git a/outscale/resource_outscale_nat_service.go b/outscale/resource_outscale_nat_service.go index d39f02182..f5f8bb0d7 100644 --- a/outscale/resource_outscale_nat_service.go +++ b/outscale/resource_outscale_nat_service.go @@ -13,12 +13,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPINatService() *schema.Resource { +func ResourceOutscaleNatService() *schema.Resource { return &schema.Resource{ Create: resourceOAPINatServiceCreate, Read: resourceOAPINatServiceRead, Delete: resourceOAPINatServiceDelete, - Update: resourceOutscaleOAPINatServiceUpdate, + Update: ResourceOutscaleNatServiceUpdate, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -196,7 +196,7 @@ func resourceOAPINatServiceRead(d *schema.ResourceData, meta interface{}) error }) } -func resourceOutscaleOAPINatServiceUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNatServiceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { diff --git a/outscale/resource_outscale_net.go b/outscale/resource_outscale_net.go index 30a2e2581..c68c3eda5 100644 --- a/outscale/resource_outscale_net.go +++ b/outscale/resource_outscale_net.go @@ -13,12 +13,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPINet() *schema.Resource { +func ResourceOutscaleNet() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPINetCreate, - Read: resourceOutscaleOAPINetRead, - Update: resourceOutscaleOAPINetUpdate, - Delete: resourceOutscaleOAPINetDelete, + Create: ResourceOutscaleNetCreate, + Read: ResourceOutscaleNetRead, + Update: ResourceOutscaleNetUpdate, + Delete: ResourceOutscaleNetDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -27,7 +27,7 @@ func resourceOutscaleOAPINet() *schema.Resource { } } -func resourceOutscaleOAPINetCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateNetRequest{ @@ -69,7 +69,7 @@ func resourceOutscaleOAPINetCreate(d *schema.ResourceData, meta interface{}) err d.SetId(resp.Net.GetNetId()) return resource.Retry(120*time.Second, func() *resource.RetryError { - err = resourceOutscaleOAPINetRead(d, meta) + err = ResourceOutscaleNetRead(d, meta) if err != nil { return resource.NonRetryableError(err) } @@ -83,7 +83,7 @@ func resourceOutscaleOAPINetCreate(d *schema.ResourceData, meta interface{}) err }) } -func resourceOutscaleOAPINetRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI filters := oscgo.FiltersNet{ @@ -131,16 +131,16 @@ func resourceOutscaleOAPINetRead(d *schema.ResourceData, meta interface{}) error return d.Set("tags", tagsOSCAPIToMap(resp.GetNets()[0].GetTags())) } -func resourceOutscaleOAPINetUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPINetRead(d, meta) + return ResourceOutscaleNetRead(d, meta) } -func resourceOutscaleOAPINetDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteNetRequest{ diff --git a/outscale/resource_outscale_net_access_point.go b/outscale/resource_outscale_net_access_point.go index edda9530c..3e4f70bbe 100644 --- a/outscale/resource_outscale_net_access_point.go +++ b/outscale/resource_outscale_net_access_point.go @@ -13,12 +13,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleNetAccessPoint() *schema.Resource { +func ResourceOutscaleNetAccessPoint() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleNetAccessPointCreate, - Read: resourceOutscaleNetAccessPointRead, - Delete: resourceOutscaleNetAccessPointDelete, - Update: resourceOutscaleNetAccessPointUpdate, + Create: ResourceOutscaleNetAccessPointCreate, + Read: ResourceOutscaleNetAccessPointRead, + Delete: ResourceOutscaleNetAccessPointDelete, + Update: ResourceOutscaleNetAccessPointUpdate, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -56,7 +56,7 @@ func resourceOutscaleNetAccessPoint() *schema.Resource { } } -func resourceOutscaleNetAccessPointUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetAccessPointUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if d.HasChange("route_table_ids") { @@ -118,7 +118,7 @@ func resourceOutscaleNetAccessPointUpdate(d *schema.ResourceData, meta interface return err } } - return resourceOutscaleNetAccessPointRead(d, meta) + return ResourceOutscaleNetAccessPointRead(d, meta) } func napStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefreshFunc { @@ -157,7 +157,7 @@ func napStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefresh } } -func resourceOutscaleNetAccessPointCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetAccessPointCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.CreateNetAccessPointRequest{} @@ -215,10 +215,10 @@ func resourceOutscaleNetAccessPointCreate(d *schema.ResourceData, meta interface d.Set("net_access_point_id", id) d.SetId(id) - return resourceOutscaleNetAccessPointRead(d, meta) + return ResourceOutscaleNetAccessPointRead(d, meta) } -func resourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI napid := d.Id() @@ -264,7 +264,7 @@ func resourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{} return nil } -func resourceOutscaleNetAccessPointDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetAccessPointDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := &oscgo.DeleteNetAccessPointRequest{ diff --git a/outscale/resource_outscale_net_access_point_test.go b/outscale/resource_outscale_net_access_point_test.go index fadde54a3..0754b0291 100644 --- a/outscale/resource_outscale_net_access_point_test.go +++ b/outscale/resource_outscale_net_access_point_test.go @@ -18,13 +18,13 @@ func TestAccNet_AccessPoint_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPINetAccessPointConfig(ServiceName), + Config: testAccOutscaleNetAccessPointConfig(ServiceName), }, }, }) } -func testAccOutscaleOAPINetAccessPointConfig(sName string) string { +func testAccOutscaleNetAccessPointConfig(sName string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_net_attributes.go b/outscale/resource_outscale_net_attributes.go index 1554c8841..260860fab 100644 --- a/outscale/resource_outscale_net_attributes.go +++ b/outscale/resource_outscale_net_attributes.go @@ -13,12 +13,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPILinAttributes() *schema.Resource { +func ResourceOutscaleLinAttributes() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILinAttrCreate, - Read: resourceOutscaleOAPILinAttrRead, - Update: resourceOutscaleOAPILinAttrUpdate, - Delete: resourceOutscaleOAPILinAttrDelete, + Create: ResourceOutscaleLinAttrCreate, + Read: ResourceOutscaleLinAttrRead, + Update: ResourceOutscaleLinAttrUpdate, + Delete: ResourceOutscaleLinAttrDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -54,7 +54,7 @@ func resourceOutscaleOAPILinAttributes() *schema.Resource { } } -func resourceOutscaleOAPILinAttrCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinAttrCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.UpdateNetRequest{ @@ -84,10 +84,10 @@ func resourceOutscaleOAPILinAttrCreate(d *schema.ResourceData, meta interface{}) d.SetId(resp.Net.GetNetId()) - return resourceOutscaleOAPILinAttrRead(d, meta) + return ResourceOutscaleLinAttrRead(d, meta) } -func resourceOutscaleOAPILinAttrUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinAttrUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.UpdateNetRequest{ @@ -108,10 +108,10 @@ func resourceOutscaleOAPILinAttrUpdate(d *schema.ResourceData, meta interface{}) d.SetId(d.Get("net_id").(string)) - return resourceOutscaleOAPILinAttrRead(d, meta) + return ResourceOutscaleLinAttrRead(d, meta) } -func resourceOutscaleOAPILinAttrRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinAttrRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadNetsRequest{ @@ -154,7 +154,7 @@ func resourceOutscaleOAPILinAttrRead(d *schema.ResourceData, meta interface{}) e return d.Set("tags", tagsOSCAPIToMap(resp.GetNets()[0].GetTags())) } -func resourceOutscaleOAPILinAttrDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinAttrDelete(d *schema.ResourceData, meta interface{}) error { d.SetId("") return nil diff --git a/outscale/resource_outscale_net_attributes_test.go b/outscale/resource_outscale_net_attributes_test.go index 0071d8b7f..fbb1893c2 100644 --- a/outscale/resource_outscale_net_attributes_test.go +++ b/outscale/resource_outscale_net_attributes_test.go @@ -15,7 +15,7 @@ func TestAccNet_Attributes_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinAttrConfig, + Config: testAccOutscaleLinAttrConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "dhcp_options_set_id"), resource.TestCheckResourceAttrSet(resourceName, "net_id"), @@ -33,14 +33,14 @@ func TestAccNet_Attributes_withoutDHCPID(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinAttrConfigwithoutDHCPID("outscale_net.vpc.id"), + Config: testAccOutscaleLinAttrConfigwithoutDHCPID("outscale_net.vpc.id"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "dhcp_options_set_id"), resource.TestCheckResourceAttrSet(resourceName, "net_id"), ), }, { - Config: testAccOutscaleOAPILinAttrConfigwithoutDHCPID("outscale_net.vpc2.id"), + Config: testAccOutscaleLinAttrConfigwithoutDHCPID("outscale_net.vpc2.id"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "dhcp_options_set_id"), resource.TestCheckResourceAttrSet(resourceName, "net_id"), @@ -50,7 +50,7 @@ func TestAccNet_Attributes_withoutDHCPID(t *testing.T) { }) } -const testAccOutscaleOAPILinAttrConfig = ` +const testAccOutscaleLinAttrConfig = ` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" @@ -75,7 +75,7 @@ const testAccOutscaleOAPILinAttrConfig = ` } ` -func testAccOutscaleOAPILinAttrConfigwithoutDHCPID(vpc string) string { +func testAccOutscaleLinAttrConfigwithoutDHCPID(vpc string) string { return fmt.Sprintf(` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_net_peering.go b/outscale/resource_outscale_net_peering.go index 756cd9b1e..4f42ef967 100644 --- a/outscale/resource_outscale_net_peering.go +++ b/outscale/resource_outscale_net_peering.go @@ -17,12 +17,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPILinPeeringConnection() *schema.Resource { +func ResourceOutscaleLinPeeringConnection() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILinPeeringCreate, - Read: resourceOutscaleOAPILinPeeringRead, - Update: resourceOutscaleOAPINetPeeringUpdate, - Delete: resourceOutscaleOAPILinPeeringDelete, + Create: ResourceOutscaleLinPeeringCreate, + Read: ResourceOutscaleLinPeeringRead, + Update: ResourceOutscaleNetPeeringUpdate, + Delete: ResourceOutscaleLinPeeringDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -77,7 +77,7 @@ func resourceOutscaleOAPILinPeeringConnection() *schema.Resource { } } -func resourceOutscaleOAPILinPeeringCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinPeeringCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI // Create the vpc peering connection @@ -123,7 +123,7 @@ func resourceOutscaleOAPILinPeeringCreate(d *schema.ResourceData, meta interface stateConf := &resource.StateChangeConf{ Pending: []string{"initiating-request", "provisioning", "pending"}, Target: []string{"pending-acceptance", "active"}, - Refresh: resourceOutscaleOAPILinPeeringConnectionStateRefreshFunc(conn, d.Id()), + Refresh: ResourceOutscaleLinPeeringConnectionStateRefreshFunc(conn, d.Id()), Timeout: 1 * time.Minute, } if _, err := stateConf.WaitForState(); err != nil { @@ -132,10 +132,10 @@ func resourceOutscaleOAPILinPeeringCreate(d *schema.ResourceData, meta interface d.Id()), err) } - return resourceOutscaleOAPILinPeeringRead(d, meta) + return ResourceOutscaleLinPeeringRead(d, meta) } -func resourceOutscaleOAPILinPeeringRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinPeeringRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.ReadNetPeeringsResponse var err error @@ -220,16 +220,16 @@ func resourceOutscaleOAPILinPeeringRead(d *schema.ResourceData, meta interface{} return nil } -func resourceOutscaleOAPINetPeeringUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetPeeringUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPILinPeeringRead(d, meta) + return ResourceOutscaleLinPeeringRead(d, meta) } -func resourceOutscaleOAPILinPeeringDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinPeeringDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var err error @@ -252,9 +252,9 @@ func resourceOutscaleOAPILinPeeringDelete(d *schema.ResourceData, meta interface return nil } -// resourceOutscaleOAPILinPeeringConnectionStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch +// ResourceOutscaleLinPeeringConnectionStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch // a VPCPeeringConnection. -func resourceOutscaleOAPILinPeeringConnectionStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefreshFunc { +func ResourceOutscaleLinPeeringConnectionStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefreshFunc { return func() (interface{}, string, error) { var resp oscgo.ReadNetPeeringsResponse var err error diff --git a/outscale/resource_outscale_net_peering_acceptation.go b/outscale/resource_outscale_net_peering_acceptation.go index 7fab7d37c..82c2fb38a 100644 --- a/outscale/resource_outscale_net_peering_acceptation.go +++ b/outscale/resource_outscale_net_peering_acceptation.go @@ -13,11 +13,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPILinPeeringConnectionAccepter() *schema.Resource { +func ResourceOutscaleLinPeeringConnectionAccepter() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILinPeeringAccepterCreate, - Read: resourceOutscaleOAPILinPeeringRead, - Delete: resourceOutscaleOAPILinPeeringAccepterDelete, + Create: ResourceOutscaleLinPeeringAccepterCreate, + Read: ResourceOutscaleLinPeeringRead, + Delete: ResourceOutscaleLinPeeringAccepterDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -65,7 +65,7 @@ func resourceOutscaleOAPILinPeeringConnectionAccepter() *schema.Resource { } } -func resourceOutscaleOAPILinPeeringAccepterCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinPeeringAccepterCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Get("net_peering_id").(string) @@ -90,10 +90,10 @@ func resourceOutscaleOAPILinPeeringAccepterCreate(d *schema.ResourceData, meta i return fmt.Errorf("Error creating Net Peering accepter. Details: %s", errString) } - return resourceOutscaleOAPILinPeeringRead(d, meta) + return ResourceOutscaleLinPeeringRead(d, meta) } -func resourceOutscaleOAPILinPeeringAccepterDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinPeeringAccepterDelete(d *schema.ResourceData, meta interface{}) error { log.Printf("[WARN] Will not delete VPC peering connection. Terraform will remove this resource from the state file, however resources may remain.") d.SetId("") return nil diff --git a/outscale/resource_outscale_net_peering_acceptation_test.go b/outscale/resource_outscale_net_peering_acceptation_test.go index f7c6dda94..dc820c935 100644 --- a/outscale/resource_outscale_net_peering_acceptation_test.go +++ b/outscale/resource_outscale_net_peering_acceptation_test.go @@ -12,19 +12,19 @@ func TestAccNet_PeeringConnectionAccepter_sameAccount(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccOutscaleOAPILinPeeringConnectionAccepterDestroy, + CheckDestroy: testAccOutscaleLinPeeringConnectionAccepterDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinPeeringConnectionAccepterSameAccountConfig, + Config: testAccOutscaleLinPeeringConnectionAccepterSameAccountConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinPeeringConnectionAccepterExists("outscale_net_peering_acceptation.peer"), + testAccCheckOutscaleLinPeeringConnectionAccepterExists("outscale_net_peering_acceptation.peer"), ), }, }, }) } -func testAccCheckOutscaleOAPILinPeeringConnectionAccepterExists(n string) resource.TestCheckFunc { +func testAccCheckOutscaleLinPeeringConnectionAccepterExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -38,12 +38,12 @@ func testAccCheckOutscaleOAPILinPeeringConnectionAccepterExists(n string) resour } } -func testAccOutscaleOAPILinPeeringConnectionAccepterDestroy(s *terraform.State) error { +func testAccOutscaleLinPeeringConnectionAccepterDestroy(s *terraform.State) error { // We don't destroy the underlying VPC Peering Connection. return nil } -const testAccOutscaleOAPILinPeeringConnectionAccepterSameAccountConfig = ` +const testAccOutscaleLinPeeringConnectionAccepterSameAccountConfig = ` resource "outscale_net" "foo" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_net_peering_test.go b/outscale/resource_outscale_net_peering_test.go index 88d6da7ca..015fd9ca9 100644 --- a/outscale/resource_outscale_net_peering_test.go +++ b/outscale/resource_outscale_net_peering_test.go @@ -21,12 +21,12 @@ func TestAccNet_PeeringConnection_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_net_peering.foo", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILinPeeringConnectionDestroy, + CheckDestroy: testAccCheckOutscaleLinPeeringConnectionDestroy, Steps: []resource.TestStep{ { Config: testAccOAPIVpcPeeringConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinPeeringConnectionExists( + testAccCheckOutscaleLinPeeringConnectionExists( "outscale_net_peering.foo", &connection), ), @@ -41,14 +41,14 @@ func TestAccNet_PeeringConnection_importBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILinPeeringConnectionDestroy, + CheckDestroy: testAccCheckOutscaleLinPeeringConnectionDestroy, Steps: []resource.TestStep{ { Config: testAccOAPIVpcPeeringConfig, }, { ResourceName: resourceName, - ImportStateIdFunc: testAccCheckOutscaleOAPILinkPeeeringConnectionImportStateIDFunc(resourceName), + ImportStateIdFunc: testAccCheckOutscaleLinkPeeeringConnectionImportStateIDFunc(resourceName), ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"request_id"}, @@ -57,7 +57,7 @@ func TestAccNet_PeeringConnection_importBasic(t *testing.T) { }) } -func testAccCheckOutscaleOAPILinkPeeeringConnectionImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { +func testAccCheckOutscaleLinkPeeeringConnectionImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] if !ok { @@ -93,12 +93,12 @@ func TestAccNet_PeeringConnection_plan(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILinPeeringConnectionDestroy, + CheckDestroy: testAccCheckOutscaleLinPeeringConnectionDestroy, Steps: []resource.TestStep{ { Config: testAccOAPIVpcPeeringConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinPeeringConnectionExists( + testAccCheckOutscaleLinPeeringConnectionExists( "outscale_net_peering.foo", &connection), testDestroy, @@ -109,7 +109,7 @@ func TestAccNet_PeeringConnection_plan(t *testing.T) { }) } -func testAccCheckOutscaleOAPILinPeeringConnectionDestroy(s *terraform.State) error { +func testAccCheckOutscaleLinPeeringConnectionDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI for _, rs := range s.RootModule().Resources { @@ -159,12 +159,12 @@ func testAccCheckOutscaleOAPILinPeeringConnectionDestroy(s *terraform.State) err // return error here; we've found the vpc_peering object we want, however // it's not in an expected state - return fmt.Errorf("Fall through error for testAccCheckOutscaleOAPILinPeeringConnectionDestroy") + return fmt.Errorf("Fall through error for testAccCheckOutscaleLinPeeringConnectionDestroy") } return nil } -func testAccCheckOutscaleOAPILinPeeringConnectionExists(n string, connection *oscgo.NetPeering) resource.TestCheckFunc { +func testAccCheckOutscaleLinPeeringConnectionExists(n string, connection *oscgo.NetPeering) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/outscale/resource_outscale_net_test.go b/outscale/resource_outscale_net_test.go index 03904df37..088c6d55a 100644 --- a/outscale/resource_outscale_net_test.go +++ b/outscale/resource_outscale_net_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPILin_basic(t *testing.T) { +func TestAccOutscaleLin_basic(t *testing.T) { t.Parallel() var conf oscgo.Net @@ -23,9 +23,9 @@ func TestAccOutscaleOAPILin_basic(t *testing.T) { // CheckDestroy: testAccCheckOutscaleLinDestroyed, // we need to create the destroyed test case Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinConfig, + Config: testAccOutscaleLinConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinExists("outscale_net.vpc", &conf), + testAccCheckOutscaleLinExists("outscale_net.vpc", &conf), resource.TestCheckResourceAttr( "outscale_net.vpc", "ip_range", "10.0.0.0/16"), ), @@ -39,21 +39,21 @@ func TestAccNet_UpdateTags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPINICDestroy, + CheckDestroy: testAccCheckOutscaleNICDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILinConfigUpdateTags("Terraform_net"), + Config: testAccOutscaleLinConfigUpdateTags("Terraform_net"), Check: resource.ComposeTestCheckFunc(), }, { - Config: testAccOutscaleOAPILinConfigUpdateTags("Terraform_net2"), + Config: testAccOutscaleLinConfigUpdateTags("Terraform_net2"), Check: resource.ComposeTestCheckFunc(), }, }, }) } -func testAccCheckOutscaleOAPILinExists(n string, res *oscgo.Net) resource.TestCheckFunc { +func testAccCheckOutscaleLinExists(n string, res *oscgo.Net) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -91,7 +91,7 @@ func testAccCheckOutscaleOAPILinExists(n string, res *oscgo.Net) resource.TestCh } } -const testAccOutscaleOAPILinConfig = ` +const testAccOutscaleLinConfig = ` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" tags { @@ -101,7 +101,7 @@ const testAccOutscaleOAPILinConfig = ` } ` -func testAccOutscaleOAPILinConfigUpdateTags(value string) string { +func testAccOutscaleLinConfigUpdateTags(value string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_nic.go b/outscale/resource_outscale_nic.go index 23ee3eee6..40c39a7d7 100644 --- a/outscale/resource_outscale_nic.go +++ b/outscale/resource_outscale_nic.go @@ -19,12 +19,12 @@ import ( ) // Creates a network interface in the specified subnet -func resourceOutscaleOAPINic() *schema.Resource { +func ResourceOutscaleNic() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPINicCreate, - Read: resourceOutscaleOAPINicRead, - Update: resourceOutscaleOAPINicUpdate, - Delete: resourceOutscaleOAPINicDelete, + Create: ResourceOutscaleNicCreate, + Read: ResourceOutscaleNicRead, + Update: ResourceOutscaleNicUpdate, + Delete: ResourceOutscaleNicDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -234,7 +234,7 @@ func getOAPINicSchema() map[string]*schema.Schema { } // Create OAPINic -func resourceOutscaleOAPINicCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNicCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI @@ -283,11 +283,11 @@ func resourceOutscaleOAPINicCreate(d *schema.ResourceData, meta interface{}) err if err := d.Set("private_ip", ""); err != nil { return err } - return resourceOutscaleOAPINicRead(d, meta) + return ResourceOutscaleNicRead(d, meta) } // Read OAPINic -func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNicRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI dnir := oscgo.ReadNicsRequest{ @@ -405,13 +405,13 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error } // Delete OAPINic -func resourceOutscaleOAPINicDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNicDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[INFO] Deleting ENI: %s", d.Id()) - err := resourceOutscaleOAPINicDetach(meta, d.Id()) + err := ResourceOutscaleNicDetach(meta, d.Id()) if err != nil { return err } @@ -436,7 +436,7 @@ func resourceOutscaleOAPINicDelete(d *schema.ResourceData, meta interface{}) err return nil } -func resourceOutscaleOAPINicDetach(meta interface{}, nicID string) error { +func ResourceOutscaleNicDetach(meta interface{}, nicID string) error { // if there was an old nic_link, remove it conn := meta.(*OutscaleClient).OSCAPI @@ -481,14 +481,14 @@ func resourceOutscaleOAPINicDetach(meta interface{}, nicID string) error { } // Update OAPINic -func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNicUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var err error if d.HasChange("link_nic") { _, na := d.GetChange("link_nic") - err := resourceOutscaleOAPINicDetach(meta, d.Id()) + err := ResourceOutscaleNicDetach(meta, d.Id()) if err != nil { return err } @@ -655,7 +655,7 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPINicRead(d, meta) + return ResourceOutscaleNicRead(d, meta) } func expandPrivateIPLight(pIPs []interface{}) []oscgo.PrivateIpLight { diff --git a/outscale/resource_outscale_nic_link.go b/outscale/resource_outscale_nic_link.go index 2ad441086..125f56a2c 100644 --- a/outscale/resource_outscale_nic_link.go +++ b/outscale/resource_outscale_nic_link.go @@ -16,13 +16,13 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPINetworkInterfaceAttachment() *schema.Resource { +func ResourceOutscaleNetworkInterfaceAttachment() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPINetworkInterfaceAttachmentCreate, - Read: resourceOutscaleOAPINetworkInterfaceAttachmentRead, - Delete: resourceOutscaleOAPINetworkInterfaceAttachmentDelete, + Create: ResourceOutscaleNetworkInterfaceAttachmentCreate, + Read: ResourceOutscaleNetworkInterfaceAttachmentRead, + Delete: ResourceOutscaleNetworkInterfaceAttachmentDelete, Importer: &schema.ResourceImporter{ - State: resourceOutscaleNetworkInterfaceAttachmentImportState, + State: ResourceOutscaleNetworkInterfaceAttachmentImportState, }, Schema: map[string]*schema.Schema{ "device_number": { @@ -66,7 +66,7 @@ func resourceOutscaleOAPINetworkInterfaceAttachment() *schema.Resource { } } -func resourceOutscaleOAPINetworkInterfaceAttachmentCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfaceAttachmentCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI di := d.Get("device_number").(int) @@ -97,10 +97,10 @@ func resourceOutscaleOAPINetworkInterfaceAttachmentCreate(d *schema.ResourceData } d.SetId(resp.GetLinkNicId()) - return resourceOutscaleOAPINetworkInterfaceAttachmentRead(d, meta) + return ResourceOutscaleNetworkInterfaceAttachmentRead(d, meta) } -func resourceOutscaleOAPINetworkInterfaceAttachmentRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfaceAttachmentRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI nicID := d.Get("nic_id").(string) @@ -143,7 +143,7 @@ func resourceOutscaleOAPINetworkInterfaceAttachmentRead(d *schema.ResourceData, return nil } -func resourceOutscaleOAPINetworkInterfaceAttachmentDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfaceAttachmentDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI interfaceID := d.Id() @@ -190,7 +190,7 @@ func resourceOutscaleOAPINetworkInterfaceAttachmentDelete(d *schema.ResourceData return nil } -func resourceOutscaleNetworkInterfaceAttachmentImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func ResourceOutscaleNetworkInterfaceAttachmentImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { if d.Id() == "" { return nil, errors.New("import error: to import a Nic Link, use the format {nic_id} it must not be empty") } diff --git a/outscale/resource_outscale_nic_link_test.go b/outscale/resource_outscale_nic_link_test.go index 5169131b2..97c6f5498 100644 --- a/outscale/resource_outscale_nic_link_test.go +++ b/outscale/resource_outscale_nic_link_test.go @@ -32,7 +32,7 @@ func TestAccNet_withNicLink_Basic(t *testing.T) { { Config: testAccOutscaleNicLinkConfigBasic(rInt, omi, "tinav4.c2r2p2", region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), resource.TestCheckResourceAttr( "outscale_nic_link.outscale_nic_link", "device_number", "1"), resource.TestCheckResourceAttrSet( diff --git a/outscale/resource_outscale_nic_private_ip.go b/outscale/resource_outscale_nic_private_ip.go index 9b96eec6a..8f81ccc55 100644 --- a/outscale/resource_outscale_nic_private_ip.go +++ b/outscale/resource_outscale_nic_private_ip.go @@ -13,11 +13,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPINetworkInterfacePrivateIP() *schema.Resource { +func ResourceOutscaleNetworkInterfacePrivateIP() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPINetworkInterfacePrivateIPCreate, - Read: resourceOutscaleOAPINetworkInterfacePrivateIPRead, - Delete: resourceOutscaleOAPINetworkInterfacePrivateIPDelete, + Create: ResourceOutscaleNetworkInterfacePrivateIPCreate, + Read: ResourceOutscaleNetworkInterfacePrivateIPRead, + Delete: ResourceOutscaleNetworkInterfacePrivateIPDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -57,7 +57,7 @@ func resourceOutscaleOAPINetworkInterfacePrivateIP() *schema.Resource { } } -func resourceOutscaleOAPINetworkInterfacePrivateIPCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfacePrivateIPCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI input := oscgo.LinkPrivateIpsRequest{ @@ -91,10 +91,10 @@ func resourceOutscaleOAPINetworkInterfacePrivateIPCreate(d *schema.ResourceData, d.SetId(input.NicId) - return resourceOutscaleOAPINetworkInterfacePrivateIPRead(d, meta) + return ResourceOutscaleNetworkInterfacePrivateIPRead(d, meta) } -func resourceOutscaleOAPINetworkInterfacePrivateIPRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfacePrivateIPRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadNicsRequest{ @@ -171,7 +171,7 @@ func resourceOutscaleOAPINetworkInterfacePrivateIPRead(d *schema.ResourceData, m return nil } -func resourceOutscaleOAPINetworkInterfacePrivateIPDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleNetworkInterfacePrivateIPDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI input := oscgo.UnlinkPrivateIpsRequest{ diff --git a/outscale/resource_outscale_nic_private_ip_test.go b/outscale/resource_outscale_nic_private_ip_test.go index 82f6371dd..fc3fe7de6 100644 --- a/outscale/resource_outscale_nic_private_ip_test.go +++ b/outscale/resource_outscale_nic_private_ip_test.go @@ -17,12 +17,12 @@ func TestAccNet_NICPrivateIPBasic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, + CheckDestroy: testAccCheckOutscaleENIDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPINetworkInterfacePrivateIPConfigBasic(utils.GetRegion()), + Config: testAccOutscaleNetworkInterfacePrivateIPConfigBasic(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), resource.TestCheckResourceAttr("outscale_nic_private_ip.outscale_nic_private_ip", "private_ips.#", "1"), resource.TestCheckResourceAttr("outscale_nic_private_ip.outscale_nic_private_ip", "private_ips.0", "10.0.45.67"), resource.TestCheckResourceAttrSet("outscale_nic_private_ip.outscale_nic_private_ip", "primary_private_ip")), @@ -38,10 +38,10 @@ func TestAccNet_Import_NIC_PrivateIP_Basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, + CheckDestroy: testAccCheckOutscaleENIDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPINetworkInterfacePrivateIPConfigBasic(utils.GetRegion()), + Config: testAccOutscaleNetworkInterfacePrivateIPConfigBasic(utils.GetRegion()), }, { ResourceName: resourceName, @@ -53,7 +53,7 @@ func TestAccNet_Import_NIC_PrivateIP_Basic(t *testing.T) { }) } -func testAccOutscaleOAPINetworkInterfacePrivateIPConfigBasic(region string) string { +func testAccOutscaleNetworkInterfacePrivateIPConfigBasic(region string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_nic_test.go b/outscale/resource_outscale_nic_test.go index 73997fca4..ef7f671c4 100644 --- a/outscale/resource_outscale_nic_test.go +++ b/outscale/resource_outscale_nic_test.go @@ -22,21 +22,21 @@ func TestAccNet_WithNic_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPINICDestroy, + CheckDestroy: testAccCheckOutscaleNICDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIENIConfig(subregion), + Config: testAccOutscaleENIConfig(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIAttributes(&conf, subregion), resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "2"), ), }, { - Config: testAccOutscaleOAPIENIConfigUpdate(subregion), + Config: testAccOutscaleENIConfigUpdate(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), + testAccCheckOutscaleENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleENIAttributes(&conf, subregion), resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "3"), ), }, @@ -44,7 +44,7 @@ func TestAccNet_WithNic_basic(t *testing.T) { }) } -func testAccCheckOutscaleOAPIENIExists(n string, res *oscgo.Nic) resource.TestCheckFunc { +func testAccCheckOutscaleENIExists(n string, res *oscgo.Nic) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -88,7 +88,7 @@ func testAccCheckOutscaleOAPIENIExists(n string, res *oscgo.Nic) resource.TestCh } } -func testAccCheckOutscaleOAPIENIAttributes(conf *oscgo.Nic, suregion string) resource.TestCheckFunc { +func testAccCheckOutscaleENIAttributes(conf *oscgo.Nic, suregion string) resource.TestCheckFunc { return func(s *terraform.State) error { if !reflect.DeepEqual(conf.GetLinkNic(), oscgo.LinkNic{}) { @@ -103,7 +103,7 @@ func testAccCheckOutscaleOAPIENIAttributes(conf *oscgo.Nic, suregion string) res } } -func testAccOutscaleOAPIENIConfig(subregion string) string { +func testAccOutscaleENIConfig(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -142,7 +142,7 @@ func testAccOutscaleOAPIENIConfig(subregion string) string { `, subregion) } -func testAccOutscaleOAPIENIConfigUpdate(subregion string) string { +func testAccOutscaleENIConfigUpdate(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_public_ip.go b/outscale/resource_outscale_public_ip.go index 44701289c..842f89b3f 100644 --- a/outscale/resource_outscale_public_ip.go +++ b/outscale/resource_outscale_public_ip.go @@ -13,12 +13,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIPublicIP() *schema.Resource { +func ResourceOutscalePublicIP() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIPublicIPCreate, - Read: resourceOutscaleOAPIPublicIPRead, - Delete: resourceOutscaleOAPIPublicIPDelete, - Update: resourceOutscaleOAPIPublicIPUpdate, + Create: ResourceOutscalePublicIPCreate, + Read: ResourceOutscalePublicIPRead, + Delete: ResourceOutscalePublicIPDelete, + Update: ResourceOutscalePublicIPUpdate, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -32,7 +32,7 @@ func resourceOutscaleOAPIPublicIP() *schema.Resource { } } -func resourceOutscaleOAPIPublicIPCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI allocOpts := oscgo.CreatePublicIpRequest{} @@ -67,10 +67,10 @@ func resourceOutscaleOAPIPublicIPCreate(d *schema.ResourceData, meta interface{} } log.Printf("[INFO] EIP ID: %s (placement: %v)", d.Id(), allocResp.GetPublicIp()) - return resourceOutscaleOAPIPublicIPUpdate(d, meta) + return ResourceOutscalePublicIPUpdate(d, meta) } -func resourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() @@ -135,7 +135,7 @@ func resourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{}) return nil } -func resourceOutscaleOAPIPublicIPUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vVm, okInstance := d.GetOk("vm_id") @@ -185,7 +185,7 @@ func resourceOutscaleOAPIPublicIPUpdate(d *schema.ResourceData, meta interface{} if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPIPublicIPRead(d, meta) + return ResourceOutscalePublicIPRead(d, meta) } func unlinkPublicIp(conn *oscgo.APIClient, publicIpId *string) error { @@ -202,10 +202,10 @@ func unlinkPublicIp(conn *oscgo.APIClient, publicIpId *string) error { return err } -func resourceOutscaleOAPIPublicIPDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - if err := resourceOutscaleOAPIPublicIPRead(d, meta); err != nil { + if err := ResourceOutscalePublicIPRead(d, meta); err != nil { return err } if d.Id() == "" { @@ -218,7 +218,7 @@ func resourceOutscaleOAPIPublicIPDelete(d *schema.ResourceData, meta interface{} if (okInstance && vInstance.(string) != "") || (okAssociationID && linkPublicIPID.(string) != "") { log.Printf("[DEBUG] Disassociating EIP: %s", d.Id()) var err error - switch resourceOutscaleOAPIPublicIPDomain(d) { + switch ResourceOutscalePublicIPDomain(d) { case "vpc": linIpId := d.Get("link_public_ip_id").(string) err = unlinkPublicIp(conn, &linIpId) @@ -289,7 +289,7 @@ func getOAPIPublicIPSchema() map[string]*schema.Schema { } } -func resourceOutscaleOAPIPublicIPDomain(d *schema.ResourceData) string { +func ResourceOutscalePublicIPDomain(d *schema.ResourceData) string { if v, ok := d.GetOk("placement"); ok { return v.(string) } else if strings.Contains(d.Id(), "eipalloc") { diff --git a/outscale/resource_outscale_public_ip_link.go b/outscale/resource_outscale_public_ip_link.go index ba6c3afa8..cd3995877 100644 --- a/outscale/resource_outscale_public_ip_link.go +++ b/outscale/resource_outscale_public_ip_link.go @@ -14,11 +14,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIPublicIPLink() *schema.Resource { +func ResourceOutscalePublicIPLink() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIPublicIPLinkCreate, - Read: resourceOutscaleOAPIPublicIPLinkRead, - Delete: resourceOutscaleOAPIPublicIPLinkDelete, + Create: ResourceOutscalePublicIPLinkCreate, + Read: ResourceOutscalePublicIPLinkRead, + Delete: ResourceOutscalePublicIPLinkDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -32,7 +32,7 @@ func resourceOutscaleOAPIPublicIPLink() *schema.Resource { } } -func resourceOutscaleOAPIPublicIPLinkCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPLinkCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI request := oscgo.LinkPublicIpRequest{} @@ -72,7 +72,7 @@ func resourceOutscaleOAPIPublicIPLinkCreate(d *schema.ResourceData, meta interfa }) if err != nil { - log.Printf("[WARN] ERROR resourceOutscaleOAPIPublicIPLinkCreate (%s)", err) + log.Printf("[WARN] ERROR ResourceOutscalePublicIPLinkCreate (%s)", err) return err } //Using validation with request. @@ -82,10 +82,10 @@ func resourceOutscaleOAPIPublicIPLinkCreate(d *schema.ResourceData, meta interfa d.SetId(request.GetPublicIp()) } - return resourceOutscaleOAPIPublicIPLinkRead(d, meta) + return ResourceOutscalePublicIPLinkRead(d, meta) } -func resourceOutscaleOAPIPublicIPLinkRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPLinkRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() @@ -118,7 +118,7 @@ func resourceOutscaleOAPIPublicIPLinkRead(d *schema.ResourceData, meta interface }) if err != nil { - log.Printf("[WARN] ERROR resourceOutscaleOAPIPublicIPLinkRead (%s)", err) + log.Printf("[WARN] ERROR ResourceOutscalePublicIPLinkRead (%s)", err) return fmt.Errorf("Error reading Outscale VM Public IP %s: %#v", d.Get("public_ip_id").(string), err) } if utils.IsResponseEmpty(len(response.GetPublicIps()), "PublicIpLink", d.Id()) { @@ -130,10 +130,10 @@ func resourceOutscaleOAPIPublicIPLinkRead(d *schema.ResourceData, meta interface return err } - return readOutscaleOAPIPublicIPLink(d, &response.GetPublicIps()[0]) + return readOutscalePublicIPLink(d, &response.GetPublicIps()[0]) } -func resourceOutscaleOAPIPublicIPLinkDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscalePublicIPLinkDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI linkID := d.Get("link_public_ip_id") @@ -152,14 +152,14 @@ func resourceOutscaleOAPIPublicIPLinkDelete(d *schema.ResourceData, meta interfa }) if err != nil { - log.Printf("[WARN] ERROR resourceOutscaleOAPIPublicIPLinkDelete (%s)", err) + log.Printf("[WARN] ERROR ResourceOutscalePublicIPLinkDelete (%s)", err) return fmt.Errorf("Error deleting Elastic IP association: %s", err) } return nil } -func readOutscaleOAPIPublicIPLink(d *schema.ResourceData, address *oscgo.PublicIp) error { +func readOutscalePublicIPLink(d *schema.ResourceData, address *oscgo.PublicIp) error { // if err := d.Set("public_ip_id", address.ReservationId); err != nil { // log.Printf("[WARN] ERROR readOutscalePublicIPLink1 (%s)", err) @@ -181,31 +181,31 @@ func readOutscaleOAPIPublicIPLink(d *schema.ResourceData, address *oscgo.PublicI return err } if err := d.Set("public_ip", address.GetPublicIp()); err != nil { - fmt.Printf("[WARN] ERROR readOutscaleOAPIPublicIPLink (%s)", err) + fmt.Printf("[WARN] ERROR readOutscalePublicIPLink (%s)", err) return err } if err := d.Set("link_public_ip_id", address.GetLinkPublicIpId()); err != nil { - fmt.Printf("[WARN] ERROR readOutscaleOAPIPublicIPLink (%s)", err) + fmt.Printf("[WARN] ERROR readOutscalePublicIPLink (%s)", err) return err } if err := d.Set("nic_account_id", address.GetNicAccountId()); err != nil { - fmt.Printf("[WARN] ERROR readOutscaleOAPIPublicIPLink (%s)", err) + fmt.Printf("[WARN] ERROR readOutscalePublicIPLink (%s)", err) return err } if err := d.Set("public_ip_id", address.GetPublicIpId()); err != nil { - fmt.Printf("[WARN] ERROR readOutscaleOAPIPublicIPLink (%s)", err) + fmt.Printf("[WARN] ERROR readOutscalePublicIPLink (%s)", err) return err } if err := d.Set("tags", tagsOSCAPIToMap(address.GetTags())); err != nil { - fmt.Printf("[WARN] ERROR readOutscaleOAPIPublicIPLink TAGS PROBLEME (%s)", err) + fmt.Printf("[WARN] ERROR readOutscalePublicIPLink TAGS PROBLEME (%s)", err) } return nil diff --git a/outscale/resource_outscale_public_ip_link_test.go b/outscale/resource_outscale_public_ip_link_test.go index 55cb450b7..f5b5d201e 100644 --- a/outscale/resource_outscale_public_ip_link_test.go +++ b/outscale/resource_outscale_public_ip_link_test.go @@ -25,14 +25,14 @@ func TestAccVM_WithPublicIPLink_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIPublicIPLinkDestroy, + CheckDestroy: testAccCheckOutscalePublicIPLinkDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPLinkConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), + Config: testAccOutscalePublicIPLinkConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPLExists( + testAccCheckOutscalePublicIPLExists( "outscale_public_ip.ip_link", &a), - testAccCheckOutscaleOAPIPublicIPLinkExists( + testAccCheckOutscalePublicIPLinkExists( "outscale_public_ip_link.by_public_ip", &a), ), }, @@ -40,7 +40,7 @@ func TestAccVM_WithPublicIPLink_basic(t *testing.T) { }) } -func testAccCheckOutscaleOAPIPublicIPLinkExists(name string, res *oscgo.PublicIp) resource.TestCheckFunc { +func testAccCheckOutscalePublicIPLinkExists(name string, res *oscgo.PublicIp) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -69,7 +69,7 @@ func testAccCheckOutscaleOAPIPublicIPLinkExists(name string, res *oscgo.PublicIp }) if err != nil { - log.Printf("[DEBUG] ERROR testAccCheckOutscaleOAPIPublicIPLinkExists (%s)", err) + log.Printf("[DEBUG] ERROR testAccCheckOutscalePublicIPLinkExists (%s)", err) return err } @@ -87,7 +87,7 @@ func testAccCheckOutscaleOAPIPublicIPLinkExists(name string, res *oscgo.PublicIp } } -func testAccCheckOutscaleOAPIPublicIPLinkDestroy(s *terraform.State) error { +func testAccCheckOutscalePublicIPLinkDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "outscale_public_ip_link" { continue @@ -117,7 +117,7 @@ func testAccCheckOutscaleOAPIPublicIPLinkDestroy(s *terraform.State) error { }) if err != nil { - log.Printf("[DEBUG] ERROR testAccCheckOutscaleOAPIPublicIPLinkDestroy (%s)", err) + log.Printf("[DEBUG] ERROR testAccCheckOutscalePublicIPLinkDestroy (%s)", err) return err } @@ -128,7 +128,7 @@ func testAccCheckOutscaleOAPIPublicIPLinkDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPIPublicIPLExists(n string, res *oscgo.PublicIp) resource.TestCheckFunc { +func testAccCheckOutscalePublicIPLExists(n string, res *oscgo.PublicIp) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -210,7 +210,7 @@ func testAccCheckOutscaleOAPIPublicIPLExists(n string, res *oscgo.PublicIp) reso } } -func testAccOutscaleOAPIPublicIPLinkConfig(omi, vmType, region, keypair string) string { +func testAccOutscalePublicIPLinkConfig(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_link" { security_group_name = "%[4]s" diff --git a/outscale/resource_outscale_public_ip_test.go b/outscale/resource_outscale_public_ip_test.go index 2df5d8b5d..d90530a93 100644 --- a/outscale/resource_outscale_public_ip_test.go +++ b/outscale/resource_outscale_public_ip_test.go @@ -24,13 +24,13 @@ func TestAccOthers_PublicIP_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_public_ip.bar", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIPublicIPDestroy, + CheckDestroy: testAccCheckOutscalePublicIPDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPConfig, + Config: testAccOutscalePublicIPConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &conf), - testAccCheckOutscaleOAPIPublicIPAttributes(&conf), + testAccCheckOutscalePublicIPExists("outscale_public_ip.bar", &conf), + testAccCheckOutscalePublicIPAttributes(&conf), ), }, }, @@ -49,13 +49,13 @@ func TestAccVM_PublicIP_instance(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_public_ip.bar1", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIPublicIPDestroy, + CheckDestroy: testAccCheckOutscalePublicIPDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPInstanceConfig(omi, "tinav4.c2r2p2", region, keypair), + Config: testAccOutscalePublicIPInstanceConfig(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar1", &conf), - testAccCheckOutscaleOAPIPublicIPAttributes(&conf), + testAccCheckOutscalePublicIPExists("outscale_public_ip.bar1", &conf), + testAccCheckOutscalePublicIPAttributes(&conf), ), }, }, @@ -74,27 +74,27 @@ func TestAccNet_PublicIP_associated_user_private_ip(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_public_ip.bar", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIPublicIPDestroy, + CheckDestroy: testAccCheckOutscalePublicIPDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, "tinav4.c2r2p2", region, keypair), + Config: testAccOutscalePublicIPInstanceConfigAssociated(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &one), - testAccCheckOutscaleOAPIPublicIPAttributes(&one), + testAccCheckOutscalePublicIPExists("outscale_public_ip.bar", &one), + testAccCheckOutscalePublicIPAttributes(&one), ), }, { - Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, "tinav4.c2r2p2", region, keypair), + Config: testAccOutscalePublicIPInstanceConfigAssociatedSwitch(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &one), - testAccCheckOutscaleOAPIPublicIPAttributes(&one), + testAccCheckOutscalePublicIPExists("outscale_public_ip.bar", &one), + testAccCheckOutscalePublicIPAttributes(&one), ), }, }, }) } -func testAccCheckOutscaleOAPIPublicIPDestroy(s *terraform.State) error { +func testAccCheckOutscalePublicIPDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient) for _, rs := range s.RootModule().Resources { @@ -165,7 +165,7 @@ func testAccCheckOutscaleOAPIPublicIPDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPIPublicIPAttributes(conf *oscgo.PublicIp) resource.TestCheckFunc { +func testAccCheckOutscalePublicIPAttributes(conf *oscgo.PublicIp) resource.TestCheckFunc { return func(s *terraform.State) error { if conf.GetPublicIp() == "" { return fmt.Errorf("empty public_ip") @@ -175,7 +175,7 @@ func testAccCheckOutscaleOAPIPublicIPAttributes(conf *oscgo.PublicIp) resource.T } } -func testAccCheckOutscaleOAPIPublicIPExists(n string, res *oscgo.PublicIp) resource.TestCheckFunc { +func testAccCheckOutscalePublicIPExists(n string, res *oscgo.PublicIp) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -249,7 +249,7 @@ func testAccCheckOutscaleOAPIPublicIPExists(n string, res *oscgo.PublicIp) resou } } -const testAccOutscaleOAPIPublicIPConfig = ` +const testAccOutscalePublicIPConfig = ` resource "outscale_public_ip" "bar" { tags { key = "Name" @@ -258,7 +258,7 @@ resource "outscale_public_ip" "bar" { } ` -func testAccOutscaleOAPIPublicIPInstanceConfig(omi, vmType, region, keypair string) string { +func testAccOutscalePublicIPInstanceConfig(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_ip" { security_group_name = "sg_publicIp" @@ -287,7 +287,7 @@ func testAccOutscaleOAPIPublicIPInstanceConfig(omi, vmType, region, keypair stri `, omi, vmType, region, keypair) } -func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, keypair string) string { +func testAccOutscalePublicIPInstanceConfigAssociated(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sgIP" { security_group_name = "%[4]s" @@ -319,7 +319,7 @@ func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, ke `, omi, vmType, region, keypair) } -func testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, vmType, region, keypair string) string { +func testAccOutscalePublicIPInstanceConfigAssociatedSwitch(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sgIP" { security_group_name = "%[4]s" diff --git a/outscale/resource_outscale_route.go b/outscale/resource_outscale_route.go index e3ee6cbf1..e51181918 100644 --- a/outscale/resource_outscale_route.go +++ b/outscale/resource_outscale_route.go @@ -27,15 +27,15 @@ var allowedTargets = []string{ "net_peering_id", } -func resourceOutscaleOAPIRoute() *schema.Resource { +func ResourceOutscaleRoute() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIRouteCreate, - Read: resourceOutscaleOAPIRouteRead, - Update: resourceOutscaleOAPIRouteUpdate, - Delete: resourceOutscaleOAPIRouteDelete, - Exists: resourceOutscaleOAPIRouteExists, + Create: ResourceOutscaleRouteCreate, + Read: ResourceOutscaleRouteRead, + Update: ResourceOutscaleRouteUpdate, + Delete: ResourceOutscaleRouteDelete, + Exists: ResourceOutscaleRouteExists, Importer: &schema.ResourceImporter{ - State: resourceOutscaleOAPIRouteImportState, + State: ResourceOutscaleRouteImportState, }, Schema: map[string]*schema.Schema{ "creation_method": { @@ -107,7 +107,7 @@ func resourceOutscaleOAPIRoute() *schema.Resource { } } -func resourceOutscaleOAPIRouteCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI numTargets, target := getTarget(d) awaitActiveState := d.Get("await_active_state").(bool) @@ -178,10 +178,10 @@ func resourceOutscaleOAPIRouteCreate(d *schema.ResourceData, meta interface{}) e } } d.SetId(d.Get("route_table_id").(string) + "_" + d.Get("destination_ip_range").(string)) - return resourceOutscaleOAPIRouteSetResourceData(d, route, requestID) + return ResourceOutscaleRouteSetResourceData(d, route, requestID) } -func resourceOutscaleOAPIRouteRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI routeTableID := d.Get("route_table_id").(string) @@ -197,10 +197,10 @@ func resourceOutscaleOAPIRouteRead(d *schema.ResourceData, meta interface{}) err d.SetId("") return nil } - return resourceOutscaleOAPIRouteSetResourceData(d, route, requestID) + return ResourceOutscaleRouteSetResourceData(d, route, requestID) } -func resourceOutscaleOAPIRouteSetResourceData(d *schema.ResourceData, route *oscgo.Route, requestID string) error { +func ResourceOutscaleRouteSetResourceData(d *schema.ResourceData, route *oscgo.Route, requestID string) error { if err := d.Set("destination_service_id", route.GetDestinationServiceId()); err != nil { return err } @@ -249,7 +249,7 @@ func getTarget(d *schema.ResourceData) (n int, target string) { return } -func resourceOutscaleOAPIRouteUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI nothingToDo := true o, n := d.GetChange("") @@ -326,10 +326,10 @@ func resourceOutscaleOAPIRouteUpdate(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("error updating route: %s", utils.GetErrorResponse(err)) } - return resourceOutscaleOAPIRouteRead(d, meta) + return ResourceOutscaleRouteRead(d, meta) } -func resourceOutscaleOAPIRouteDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI deleteOpts := oscgo.DeleteRouteRequest{ @@ -361,7 +361,7 @@ func resourceOutscaleOAPIRouteDelete(d *schema.ResourceData, meta interface{}) e return nil } -func resourceOutscaleOAPIRouteExists(d *schema.ResourceData, meta interface{}) (bool, error) { +func ResourceOutscaleRouteExists(d *schema.ResourceData, meta interface{}) (bool, error) { conn := meta.(*OutscaleClient).OSCAPI routeTableID := d.Get("route_table_id").(string) @@ -463,7 +463,7 @@ func findResourceOAPIRoute(conn *oscgo.APIClient, rtbid string, cidr string) (*o } -func resourceOutscaleOAPIRouteImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func ResourceOutscaleRouteImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { conn := meta.(*OutscaleClient).OSCAPI parts := strings.SplitN(d.Id(), "_", 2) diff --git a/outscale/resource_outscale_route_table.go b/outscale/resource_outscale_route_table.go index c08247b07..e23d542dc 100644 --- a/outscale/resource_outscale_route_table.go +++ b/outscale/resource_outscale_route_table.go @@ -14,12 +14,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIRouteTable() *schema.Resource { +func ResourceOutscaleRouteTable() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIRouteTableCreate, - Read: resourceOutscaleOAPIRouteTableRead, - Update: resourceOutscaleOAPIRouteTableUpdate, - Delete: resourceOutscaleOAPIRouteTableDelete, + Create: ResourceOutscaleRouteTableCreate, + Read: ResourceOutscaleRouteTableRead, + Update: ResourceOutscaleRouteTableUpdate, + Delete: ResourceOutscaleRouteTableDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -136,7 +136,7 @@ func resourceOutscaleOAPIRouteTable() *schema.Resource { } } -func resourceOutscaleOAPIRouteTableCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteTableCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI createOpts := oscgo.CreateRouteTableRequest{ @@ -168,7 +168,7 @@ func resourceOutscaleOAPIRouteTableCreate(d *schema.ResourceData, meta interface stateConf := &resource.StateChangeConf{ Pending: []string{"pending"}, Target: []string{"ready"}, - Refresh: resourceOutscaleOAPIRouteTableStateRefreshFunc(conn, d.Id()), + Refresh: ResourceOutscaleRouteTableStateRefreshFunc(conn, d.Id()), Timeout: 5 * time.Minute, } if _, err := stateConf.WaitForState(); err != nil { @@ -193,10 +193,10 @@ func resourceOutscaleOAPIRouteTableCreate(d *schema.ResourceData, meta interface return err } - return resourceOutscaleOAPIRouteTableRead(d, meta) + return ResourceOutscaleRouteTableRead(d, meta) } -func resourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteTableRead(d *schema.ResourceData, meta interface{}) error { rtRaw, _, err := readOAPIRouteTable(meta.(*OutscaleClient).OSCAPI, d.Id()) if err != nil { return err @@ -230,16 +230,16 @@ func resourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface{} return nil } -func resourceOutscaleOAPIRouteTableUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteTableUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPIRouteTableRead(d, meta) + return ResourceOutscaleRouteTableRead(d, meta) } -func resourceOutscaleOAPIRouteTableDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleRouteTableDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI rtRaw, _, err := readOAPIRouteTable(meta.(*OutscaleClient).OSCAPI, d.Id()) @@ -303,7 +303,7 @@ func resourceOutscaleOAPIRouteTableDelete(d *schema.ResourceData, meta interface stateConf := &resource.StateChangeConf{ Pending: []string{"ready"}, Target: []string{}, - Refresh: resourceOutscaleOAPIRouteTableStateRefreshFunc(conn, d.Id()), + Refresh: ResourceOutscaleRouteTableStateRefreshFunc(conn, d.Id()), Timeout: 5 * time.Minute, } if _, err := stateConf.WaitForState(); err != nil { @@ -356,7 +356,7 @@ func readOAPIRouteTable(conn *oscgo.APIClient, routeTableID string, linkIds ...s return resp.GetRouteTables()[0], resp.ResponseContext.GetRequestId(), err } -func resourceOutscaleOAPIRouteTableStateRefreshFunc(conn *oscgo.APIClient, routeTableID string, linkIds ...string) resource.StateRefreshFunc { +func ResourceOutscaleRouteTableStateRefreshFunc(conn *oscgo.APIClient, routeTableID string, linkIds ...string) resource.StateRefreshFunc { return func() (interface{}, string, error) { rtRaw, _, err := readOAPIRouteTable(conn, routeTableID, linkIds...) if rtRaw == nil { diff --git a/outscale/resource_outscale_route_table_link.go b/outscale/resource_outscale_route_table_link.go index 97812acdc..31ea79428 100644 --- a/outscale/resource_outscale_route_table_link.go +++ b/outscale/resource_outscale_route_table_link.go @@ -18,13 +18,13 @@ const ( errorLinkRouteTableSetting = "error setting `%s` for Link Route Table (%s): %s" ) -func resourceOutscaleOAPILinkRouteTable() *schema.Resource { +func ResourceOutscaleLinkRouteTable() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPILinkRouteTableCreate, - Read: resourceOutscaleOAPILinkRouteTableRead, - Delete: resourceOutscaleOAPILinkRouteTableDelete, + Create: ResourceOutscaleLinkRouteTableCreate, + Read: ResourceOutscaleLinkRouteTableRead, + Delete: ResourceOutscaleLinkRouteTableDelete, Importer: &schema.ResourceImporter{ - State: resourceOutscaleOAPILinkRouteTableImportState, + State: ResourceOutscaleLinkRouteTableImportState, }, Schema: map[string]*schema.Schema{ "subnet_id": { @@ -53,7 +53,7 @@ func resourceOutscaleOAPILinkRouteTable() *schema.Resource { } } -func resourceOutscaleOAPILinkRouteTableCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinkRouteTableCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.LinkRouteTableResponse var err error @@ -85,10 +85,10 @@ func resourceOutscaleOAPILinkRouteTableCreate(d *schema.ResourceData, meta inter d.SetId(resp.GetLinkRouteTableId()) - return resourceOutscaleOAPILinkRouteTableRead(d, meta) + return ResourceOutscaleLinkRouteTableRead(d, meta) } -func resourceOutscaleOAPILinkRouteTableRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinkRouteTableRead(d *schema.ResourceData, meta interface{}) error { routeTableID := d.Get("route_table_id").(string) linkRTable, err := readOutscaleLinkRouteTable(meta.(*OutscaleClient), routeTableID, d.Id()) if err != nil { @@ -112,7 +112,7 @@ func resourceOutscaleOAPILinkRouteTableRead(d *schema.ResourceData, meta interfa return nil } -func resourceOutscaleOAPILinkRouteTableDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleLinkRouteTableDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI err := resource.Retry(5*time.Minute, func() *resource.RetryError { @@ -131,7 +131,7 @@ func resourceOutscaleOAPILinkRouteTableDelete(d *schema.ResourceData, meta inter return nil } -func resourceOutscaleOAPILinkRouteTableImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func ResourceOutscaleLinkRouteTableImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { parts := strings.SplitN(d.Id(), "_", 2) if len(parts) != 2 { return nil, errors.New("import format error: to import a Link Route Table, use the format {route_table_id}_{link_route_table_id}") diff --git a/outscale/resource_outscale_route_test.go b/outscale/resource_outscale_route_test.go index 106297980..8ac59b55b 100644 --- a/outscale/resource_outscale_route_test.go +++ b/outscale/resource_outscale_route_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccNet_OutscaleOAPIRoute_noopdiff(t *testing.T) { +func TestAccNet_OutscaleRoute_noopdiff(t *testing.T) { var route oscgo.Route resource.Test(t, resource.TestCase{ @@ -24,15 +24,15 @@ func TestAccNet_OutscaleOAPIRoute_noopdiff(t *testing.T) { CheckDestroy: testAccCheckOAPIOutscaleRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIRouteNoopChange, + Config: testAccOutscaleRouteNoopChange, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRouteExists("outscale_route.test", &route), + testAccCheckOutscaleRouteExists("outscale_route.test", &route), ), }, { - Config: testAccOutscaleOAPIRouteNoopChange, + Config: testAccOutscaleRouteNoopChange, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRouteExists("outscale_route.test", &route), + testAccCheckOutscaleRouteExists("outscale_route.test", &route), ), }, }, @@ -49,11 +49,11 @@ func TestAccNet_ImportRoute_Basic(t *testing.T) { CheckDestroy: testAccCheckOAPIOutscaleRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIRouteNoopChange, + Config: testAccOutscaleRouteNoopChange, }, { ResourceName: resourceName, - ImportStateIdFunc: testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName), + ImportStateIdFunc: testAccCheckOutscaleRouteImportStateIDFunc(resourceName), ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"request_id", "await_active_state"}, @@ -71,11 +71,11 @@ func TestAccNet_Route_importWithNatService(t *testing.T) { CheckDestroy: testAccCheckOAPIOutscaleRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIRouteWithNatService, + Config: testAccOutscaleRouteWithNatService, }, { ResourceName: resourceName, - ImportStateIdFunc: testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName), + ImportStateIdFunc: testAccCheckOutscaleRouteImportStateIDFunc(resourceName), ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"request_id", "await_active_state", "routes"}, /*we will remove 'routes' when autorefresh after link resources Ok*/ @@ -98,13 +98,13 @@ func TestAccNet_Route_changeTarget(t *testing.T) { { Config: computeConfigTestChangeTarget([]string{"nat_service_id"}), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRouteExists("outscale_route.rtnatdef", &route), + testAccCheckOutscaleRouteExists("outscale_route.rtnatdef", &route), ), }, { Config: computeConfigTestChangeTarget([]string{"gateway_id"}), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRouteExists("outscale_route.rtnatdef", &route), + testAccCheckOutscaleRouteExists("outscale_route.rtnatdef", &route), ), }, }, @@ -204,7 +204,7 @@ func TestAccNet_Route_onlyOneTarget(t *testing.T) { }) } -func testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { +func testAccCheckOutscaleRouteImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] if !ok { @@ -214,7 +214,7 @@ func testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName string) resourc } } -func testAccCheckOutscaleOAPIRouteExists(n string, res *oscgo.Route) resource.TestCheckFunc { +func testAccCheckOutscaleRouteExists(n string, res *oscgo.Route) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -267,7 +267,7 @@ func testAccCheckOAPIOutscaleRouteDestroy(s *terraform.State) error { return nil } -var testAccOutscaleOAPIRouteNoopChange = fmt.Sprint(` +var testAccOutscaleRouteNoopChange = fmt.Sprint(` resource "outscale_net" "test" { ip_range = "10.0.0.0/24" } @@ -290,7 +290,7 @@ var testAccOutscaleOAPIRouteNoopChange = fmt.Sprint(` } `) -var testAccOutscaleOAPIRouteWithNatService = fmt.Sprint(` +var testAccOutscaleRouteWithNatService = fmt.Sprint(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" tags { @@ -382,10 +382,10 @@ func computeConfigTestChangeTarget(targets []string) string { } } - return fmt.Sprintf(testAccOutscaleOAPIRouteTemplateChangeTarget, strings.Join(extra_configs, "\n")) + return fmt.Sprintf(testAccOutscaleRouteTemplateChangeTarget, strings.Join(extra_configs, "\n")) } -var testAccOutscaleOAPIRouteTemplateChangeTarget = ` +var testAccOutscaleRouteTemplateChangeTarget = ` resource "outscale_net" "net" { ip_range = "10.0.0.0/16" tags { diff --git a/outscale/resource_outscale_security_group.go b/outscale/resource_outscale_security_group.go index c32df05ad..0ed5d3571 100644 --- a/outscale/resource_outscale_security_group.go +++ b/outscale/resource_outscale_security_group.go @@ -14,12 +14,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPISecurityGroup() *schema.Resource { +func ResourceOutscaleSecurityGroup() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPISecurityGroupCreate, - Read: resourceOutscaleOAPISecurityGroupRead, - Delete: resourceOutscaleOAPISecurityGroupDelete, - Update: resourceOutscaleOAPISecurityGroupUpdate, + Create: ResourceOutscaleSecurityGroupCreate, + Read: ResourceOutscaleSecurityGroupRead, + Delete: ResourceOutscaleSecurityGroupDelete, + Update: ResourceOutscaleSecurityGroupUpdate, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -114,7 +114,7 @@ func getOAPIIPPerms() *schema.Schema { } } -func resourceOutscaleOAPISecurityGroupCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSecurityGroupCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI securityGroupOpts := oscgo.CreateSecurityGroupRequest{} @@ -216,10 +216,10 @@ func resourceOutscaleOAPISecurityGroupCreate(d *schema.ResourceData, meta interf return err } } - return resourceOutscaleOAPISecurityGroupRead(d, meta) + return ResourceOutscaleSecurityGroupRead(d, meta) } -func resourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSecurityGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI sg, _, err := readSecurityGroups(conn, d.Id()) @@ -262,7 +262,7 @@ func resourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interfac return d.Set("outbound_rules", flattenOAPISecurityGroupRule(sg.GetOutboundRules())) } -func resourceOutscaleOAPISecurityGroupDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSecurityGroupDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI log.Printf("[DEBUG] Security Group destroy: %v", d.Id()) @@ -294,13 +294,13 @@ func SGOAPIStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefr } } -func resourceOutscaleOAPISecurityGroupUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSecurityGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPISecurityGroupRead(d, meta) + return ResourceOutscaleSecurityGroupRead(d, meta) } func readSecurityGroups(client *oscgo.APIClient, securityGroupID string) (*oscgo.SecurityGroup, *oscgo.ReadSecurityGroupsResponse, error) { diff --git a/outscale/resource_outscale_security_group_rule.go b/outscale/resource_outscale_security_group_rule.go index 027a7a630..4efd0c839 100644 --- a/outscale/resource_outscale_security_group_rule.go +++ b/outscale/resource_outscale_security_group_rule.go @@ -18,13 +18,13 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -func resourceOutscaleOAPIOutboundRule() *schema.Resource { +func ResourceOutscaleOutboundRule() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIOutboundRuleCreate, - Read: resourceOutscaleOAPIOutboundRuleRead, - Delete: resourceOutscaleOAPIOutboundRuleDelete, + Create: ResourceOutscaleOutboundRuleCreate, + Read: ResourceOutscaleOutboundRuleRead, + Delete: ResourceOutscaleOutboundRuleDelete, Importer: &schema.ResourceImporter{ - State: resourceOutscaleOAPISecurityGroupRuleImportState, + State: ResourceOutscaleSecurityGroupRuleImportState, }, Schema: map[string]*schema.Schema{ "flow": { @@ -87,7 +87,7 @@ func resourceOutscaleOAPIOutboundRule() *schema.Resource { } } -func resourceOutscaleOAPIOutboundRuleCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleOutboundRuleCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateSecurityGroupRuleRequest{ @@ -133,10 +133,10 @@ func resourceOutscaleOAPIOutboundRuleCreate(d *schema.ResourceData, meta interfa d.SetId(*resp.GetSecurityGroup().SecurityGroupId) - return resourceOutscaleOAPIOutboundRuleRead(d, meta) + return ResourceOutscaleOutboundRuleRead(d, meta) } -func resourceOutscaleOAPIOutboundRuleRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleOutboundRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI sg, _, err := readSecurityGroups(conn, d.Id()) @@ -159,7 +159,7 @@ func resourceOutscaleOAPIOutboundRuleRead(d *schema.ResourceData, meta interface return nil } -func resourceOutscaleOAPIOutboundRuleDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleOutboundRuleDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteSecurityGroupRuleRequest{ @@ -391,7 +391,7 @@ func getRulesSchema(isForAttr bool) *schema.Schema { } } -func resourceOutscaleOAPISecurityGroupRuleImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func ResourceOutscaleSecurityGroupRuleImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { // example: sg-53173ec7_inbound_tcp_80_80_80.14.129.222/32 // example: sg-53173ec7_inbound_tcp_80_80_sg-53173ec7 diff --git a/outscale/resource_outscale_security_group_rule_test.go b/outscale/resource_outscale_security_group_rule_test.go index 882a0e5ca..c406c845b 100644 --- a/outscale/resource_outscale_security_group_rule_test.go +++ b/outscale/resource_outscale_security_group_rule_test.go @@ -27,19 +27,19 @@ func TestAccOthers_SecurityGroupRule_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPISecurityGroupRuleDestroy, + CheckDestroy: testAccCheckOutscaleSecurityGroupRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISecurityGroupRuleEgressConfig(rInt), + Config: testAccOutscaleSecurityGroupRuleEgressConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRuleExists(resourceName, &group), - testAccCheckOutscaleOAPIRuleAttributes(resourceName, &group, nil, "Inbound"), + testAccCheckOutscaleRuleExists(resourceName, &group), + testAccCheckOutscaleRuleAttributes(resourceName, &group, nil, "Inbound"), ), }, { ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccCheckOutscaleOAPIRuleImportStateIDFunc(resourceName), + ImportStateIdFunc: testAccCheckOutscaleRuleImportStateIDFunc(resourceName), ImportStateVerify: true, ImportStateVerifyIgnore: []string{"request_id"}, }, @@ -74,16 +74,16 @@ func TestAccOthers_SecurityGroupRule_withSecurityGroupMember(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPISecurityGroupRuleDestroy, + CheckDestroy: testAccCheckOutscaleSecurityGroupRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISecurityGroupRuleWithGroupMembers(rInt, accountID), + Config: testAccOutscaleSecurityGroupRuleWithGroupMembers(rInt, accountID), }, }, }) } -func testAccCheckOutscaleOAPISecurityGroupRuleDestroy(s *terraform.State) error { +func testAccCheckOutscaleSecurityGroupRuleDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI for _, rs := range s.RootModule().Resources { @@ -99,7 +99,7 @@ func testAccCheckOutscaleOAPISecurityGroupRuleDestroy(s *terraform.State) error return nil } -func testAccCheckOutscaleOAPIRuleAttributes(n string, group *oscgo.SecurityGroup, p *oscgo.SecurityGroupRule, ruleType string) resource.TestCheckFunc { +func testAccCheckOutscaleRuleAttributes(n string, group *oscgo.SecurityGroup, p *oscgo.SecurityGroupRule, ruleType string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -197,7 +197,7 @@ func testAccCheckOutscaleOAPIRuleAttributes(n string, group *oscgo.SecurityGroup } } -func testAccCheckOutscaleOAPIRuleExists(n string, group *oscgo.SecurityGroup) resource.TestCheckFunc { +func testAccCheckOutscaleRuleExists(n string, group *oscgo.SecurityGroup) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -239,7 +239,7 @@ func testAccCheckOutscaleOAPIRuleExists(n string, group *oscgo.SecurityGroup) re } } -func testAccCheckOutscaleOAPIRuleImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { +func testAccCheckOutscaleRuleImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] if !ok { @@ -249,7 +249,7 @@ func testAccCheckOutscaleOAPIRuleImportStateIDFunc(resourceName string) resource } } -func testAccOutscaleOAPISecurityGroupRuleEgressConfig(rInt int) string { +func testAccOutscaleSecurityGroupRuleEgressConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_security_group_rule" "outscale_security_group_rule" { flow = "Inbound" @@ -276,7 +276,7 @@ func testAccOutscaleOAPISecurityGroupRuleEgressConfig(rInt int) string { `, rInt) } -func testAccOutscaleOAPISecurityGroupRuleWithGroupMembers(rInt int, accountID string) string { +func testAccOutscaleSecurityGroupRuleWithGroupMembers(rInt int, accountID string) string { return fmt.Sprintf(` resource "outscale_security_group" "outscale_security_group" { description = "test group" diff --git a/outscale/resource_outscale_security_group_test.go b/outscale/resource_outscale_security_group_test.go index 9b56b9144..738505d5f 100644 --- a/outscale/resource_outscale_security_group_test.go +++ b/outscale/resource_outscale_security_group_test.go @@ -18,12 +18,12 @@ func TestAccNet_WithSecurityGroup(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPISGRuleDestroy, + CheckDestroy: testAccCheckOutscaleSGRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISecurityGroupConfig(rInt), + Config: testAccOutscaleSecurityGroupConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISecurityGroupRuleExists("outscale_security_group.web", &group), + testAccCheckOutscaleSecurityGroupRuleExists("outscale_security_group.web", &group), resource.TestCheckResourceAttr( "outscale_security_group.web", "security_group_name", fmt.Sprintf("terraform_test_%d", rInt)), ), @@ -32,7 +32,7 @@ func TestAccNet_WithSecurityGroup(t *testing.T) { }) } -func testAccCheckOutscaleOAPISGRuleDestroy(s *terraform.State) error { +func testAccCheckOutscaleSGRuleDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI for _, rs := range s.RootModule().Resources { @@ -48,7 +48,7 @@ func testAccCheckOutscaleOAPISGRuleDestroy(s *terraform.State) error { return nil } -func testAccCheckOutscaleOAPISecurityGroupRuleExists(n string, group *oscgo.SecurityGroup) resource.TestCheckFunc { +func testAccCheckOutscaleSecurityGroupRuleExists(n string, group *oscgo.SecurityGroup) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI @@ -69,7 +69,7 @@ func testAccCheckOutscaleOAPISecurityGroupRuleExists(n string, group *oscgo.Secu } } -func testAccOutscaleOAPISecurityGroupConfig(rInt int) string { +func testAccOutscaleSecurityGroupConfig(rInt int) string { return fmt.Sprintf(` resource "outscale_net" "net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_server_certificate.go b/outscale/resource_outscale_server_certificate.go index 128b46f42..ed14daac0 100644 --- a/outscale/resource_outscale_server_certificate.go +++ b/outscale/resource_outscale_server_certificate.go @@ -13,12 +13,12 @@ import ( "github.com/spf13/cast" ) -func resourceOutscaleOAPIServerCertificate() *schema.Resource { +func ResourceOutscaleServerCertificate() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIServerCertificateCreate, - Read: resourceOutscaleOAPIServerCertificateRead, - Update: resourceOutscaleOAPIServerCertificateUpdate, - Delete: resourceOutscaleOAPIServerCertificateDelete, + Create: ResourceOutscaleServerCertificateCreate, + Read: ResourceOutscaleServerCertificateRead, + Update: ResourceOutscaleServerCertificateUpdate, + Delete: ResourceOutscaleServerCertificateDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -70,7 +70,7 @@ func resourceOutscaleOAPIServerCertificate() *schema.Resource { } } -func resourceOutscaleOAPIServerCertificateCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleServerCertificateCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateServerCertificateRequest{ @@ -112,10 +112,10 @@ func resourceOutscaleOAPIServerCertificateCreate(d *schema.ResourceData, meta in d.SetId(cast.ToString(resp.ServerCertificate.Id)) - return resourceOutscaleOAPIServerCertificateRead(d, meta) + return ResourceOutscaleServerCertificateRead(d, meta) } -func resourceOutscaleOAPIServerCertificateRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleServerCertificateRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() @@ -164,7 +164,7 @@ func resourceOutscaleOAPIServerCertificateRead(d *schema.ResourceData, meta inte return nil } -func resourceOutscaleOAPIServerCertificateUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleServerCertificateUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI oldName, _ := d.GetChange("name") @@ -191,10 +191,10 @@ func resourceOutscaleOAPIServerCertificateUpdate(d *schema.ResourceData, meta in return fmt.Errorf("[DEBUG] Error update Server Certificate: %s", utils.GetErrorResponse(err)) } - return resourceOutscaleOAPIServerCertificateRead(d, meta) + return ResourceOutscaleServerCertificateRead(d, meta) } -func resourceOutscaleOAPIServerCertificateDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleServerCertificateDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.DeleteServerCertificateRequest{ diff --git a/outscale/resource_outscale_server_certificate_test.go b/outscale/resource_outscale_server_certificate_test.go index f04a096f7..ad9d87254 100644 --- a/outscale/resource_outscale_server_certificate_test.go +++ b/outscale/resource_outscale_server_certificate_test.go @@ -108,13 +108,13 @@ kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y CheckDestroy: testAccCheckOutscaleServerCertificateDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIServerCertificateConfig(rName, body, private), + Config: testAccOutscaleServerCertificateConfig(rName, body, private), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleServerCertificateExists(resourceName), ), }, { - Config: testAccOutscaleOAPIServerCertificateConfig(rNameUpdated, body, private), + Config: testAccOutscaleServerCertificateConfig(rNameUpdated, body, private), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleServerCertificateExists(resourceName), ), @@ -208,7 +208,7 @@ func testAccCheckOutscaleServerCertificateDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIServerCertificateConfig(name, body, privateKey string) string { +func testAccOutscaleServerCertificateConfig(name, body, privateKey string) string { return fmt.Sprintf(` resource "outscale_server_certificate" "test" { name = %[1]q diff --git a/outscale/resource_outscale_snapshot.go b/outscale/resource_outscale_snapshot.go index a046af49d..bb9048c4a 100644 --- a/outscale/resource_outscale_snapshot.go +++ b/outscale/resource_outscale_snapshot.go @@ -14,12 +14,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPISnapshot() *schema.Resource { +func ResourceOutscaleSnapshot() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPISnapshotCreate, - Read: resourceOutscaleOAPISnapshotRead, - Update: resourceOutscaleOAPISnapshotUpdate, - Delete: resourceOutscaleOAPISnapshotDelete, + Create: ResourceOutscaleSnapshotCreate, + Read: ResourceOutscaleSnapshotRead, + Update: ResourceOutscaleSnapshotUpdate, + Delete: ResourceOutscaleSnapshotDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -115,7 +115,7 @@ func resourceOutscaleOAPISnapshot() *schema.Resource { } } -func resourceOutscaleOAPISnapshotCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSnapshotCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI v, ok := d.GetOk("volume_id") @@ -191,10 +191,10 @@ func resourceOutscaleOAPISnapshotCreate(d *schema.ResourceData, meta interface{} d.SetId(resp.Snapshot.GetSnapshotId()) - return resourceOutscaleOAPISnapshotRead(d, meta) + return ResourceOutscaleSnapshotRead(d, meta) } -func resourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSnapshotRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSnapshotsRequest{ @@ -259,16 +259,16 @@ func resourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{}) }) } -func resourceOutscaleOAPISnapshotUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSnapshotUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleOAPISnapshotRead(d, meta) + return ResourceOutscaleSnapshotRead(d, meta) } -func resourceOutscaleOAPISnapshotDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSnapshotDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI return resource.Retry(5*time.Minute, func() *resource.RetryError { diff --git a/outscale/resource_outscale_snapshot_attributes.go b/outscale/resource_outscale_snapshot_attributes.go index 5775d8443..c6e90b43f 100644 --- a/outscale/resource_outscale_snapshot_attributes.go +++ b/outscale/resource_outscale_snapshot_attributes.go @@ -12,11 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourcedOutscaleOAPISnapshotAttributes() *schema.Resource { +func ResourcedOutscaleSnapshotAttributes() *schema.Resource { return &schema.Resource{ - Create: resourcedOutscaleOAPISnapshotAttributesCreate, - Read: resourcedOutscaleOAPISnapshotAttributesRead, - Delete: resourcedOutscaleOAPISnapshotAttributesDelete, + Create: ResourcedOutscaleSnapshotAttributesCreate, + Read: ResourcedOutscaleSnapshotAttributesRead, + Delete: ResourcedOutscaleSnapshotAttributesDelete, Schema: map[string]*schema.Schema{ "permissions_to_create_volume_additions": { @@ -73,7 +73,7 @@ func resourcedOutscaleOAPISnapshotAttributes() *schema.Resource { } } -func resourcedOutscaleOAPISnapshotAttributesCreate(d *schema.ResourceData, meta interface{}) error { +func ResourcedOutscaleSnapshotAttributesCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI snapshotID := d.Get("snapshot_id").(string) @@ -148,10 +148,10 @@ func resourcedOutscaleOAPISnapshotAttributesCreate(d *schema.ResourceData, meta } d.SetId(snapshotID) - return resourcedOutscaleOAPISnapshotAttributesRead(d, meta) + return ResourcedOutscaleSnapshotAttributesRead(d, meta) } -func resourcedOutscaleOAPISnapshotAttributesRead(d *schema.ResourceData, meta interface{}) error { +func ResourcedOutscaleSnapshotAttributesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.ReadSnapshotsResponse @@ -190,7 +190,7 @@ func resourcedOutscaleOAPISnapshotAttributesRead(d *schema.ResourceData, meta in return nil } -func resourcedOutscaleOAPISnapshotAttributesDelete(d *schema.ResourceData, meta interface{}) error { +func ResourcedOutscaleSnapshotAttributesDelete(d *schema.ResourceData, meta interface{}) error { d.SetId("") return nil diff --git a/outscale/resource_outscale_snapshot_attributes_test.go b/outscale/resource_outscale_snapshot_attributes_test.go index 6709947fe..32e4bb97e 100644 --- a/outscale/resource_outscale_snapshot_attributes_test.go +++ b/outscale/resource_outscale_snapshot_attributes_test.go @@ -9,7 +9,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func TestAccOutscaleOAPISnapshotAttributes_Basic(t *testing.T) { +func TestAccOutscaleSnapshotAttributes_Basic(t *testing.T) { t.Skip() var snapshotID string accountID := os.Getenv("OUTSCALE_ACCOUNT") @@ -19,13 +19,13 @@ func TestAccOutscaleOAPISnapshotAttributes_Basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotAttributesConfig(true, false, accountID, utils.GetRegion()), + Config: testAccOutscaleSnapshotAttributesConfig(true, false, accountID, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testCheckResourceGetAttr("outscale_snapshot.test", "id", &snapshotID), ), }, { - Config: testAccOutscaleOAPISnapshotAttributesConfig(true, true, accountID, utils.GetRegion()), + Config: testAccOutscaleSnapshotAttributesConfig(true, true, accountID, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testCheckResourceGetAttr("outscale_snapshot.test", "id", &snapshotID), ), @@ -34,7 +34,7 @@ func TestAccOutscaleOAPISnapshotAttributes_Basic(t *testing.T) { }) } -func testAccOutscaleOAPISnapshotAttributesConfig(includeAddition, includeRemoval bool, aid, region string) string { +func testAccOutscaleSnapshotAttributesConfig(includeAddition, includeRemoval bool, aid, region string) string { base := fmt.Sprintf(` resource "outscale_volume" "description_test" { subregion_name = "%[2]sa" diff --git a/outscale/resource_outscale_snapshot_export_task.go b/outscale/resource_outscale_snapshot_export_task.go index 123dab627..a0c150edf 100644 --- a/outscale/resource_outscale_snapshot_export_task.go +++ b/outscale/resource_outscale_snapshot_export_task.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPISnapshotExportTask() *schema.Resource { +func ResourceOutscaleSnapshotExportTask() *schema.Resource { return &schema.Resource{ Create: resourceOAPISnapshotExportTaskCreate, Read: resourceOAPISnapshotExportTaskRead, @@ -171,7 +171,7 @@ func resourceOAPISnapshotExportTaskCreate(d *schema.ResourceData, meta interface return err } } - _, err = resourceOutscaleSnapshotTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) + _, err = ResourceOutscaleSnapshotTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) if err != nil { return err } @@ -267,7 +267,7 @@ func resourceOAPISnapshotExportTaskUpdate(d *schema.ResourceData, meta interface return resourceOAPISnapshotExportTaskRead(d, meta) } -func resourceOutscaleSnapshotTaskWaitForAvailable(id string, client *oscgo.APIClient, timeout time.Duration) (oscgo.SnapshotExportTask, error) { +func ResourceOutscaleSnapshotTaskWaitForAvailable(id string, client *oscgo.APIClient, timeout time.Duration) (oscgo.SnapshotExportTask, error) { log.Printf("Waiting for Image Task %s to become available...", id) var snap oscgo.SnapshotExportTask stateConf := &resource.StateChangeConf{ diff --git a/outscale/resource_outscale_snapshot_export_task_test.go b/outscale/resource_outscale_snapshot_export_task_test.go index 6946d8c1f..5d9cea04b 100644 --- a/outscale/resource_outscale_snapshot_export_task_test.go +++ b/outscale/resource_outscale_snapshot_export_task_test.go @@ -30,22 +30,22 @@ func TestAccOthers_SnapshotExportTask_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotExportTaskConfig("", osuBucketNames[0], utils.GetRegion()), + Config: testAccOutscaleSnapshotExportTaskConfig("", osuBucketNames[0], utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), + testAccCheckOutscaleSnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), ), }, { - Config: testAccOutscaleOAPISnapshotExportTaskConfig(tags, osuBucketNames[1], utils.GetRegion()), + Config: testAccOutscaleSnapshotExportTaskConfig(tags, osuBucketNames[1], utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), + testAccCheckOutscaleSnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), ), }, }, }) } -func testAccCheckOutscaleOAPISnapshotExportTaskExists(n string) resource.TestCheckFunc { +func testAccCheckOutscaleSnapshotExportTaskExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -60,7 +60,7 @@ func testAccCheckOutscaleOAPISnapshotExportTaskExists(n string) resource.TestChe } } -func testAccOutscaleOAPISnapshotExportTaskConfig(tags, osuBucketName, region string) string { +func testAccOutscaleSnapshotExportTaskConfig(tags, osuBucketName, region string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume_snap" { subregion_name = "%[3]sa" diff --git a/outscale/resource_outscale_snapshot_test.go b/outscale/resource_outscale_snapshot_test.go index 0c9985985..adf642fc5 100644 --- a/outscale/resource_outscale_snapshot_test.go +++ b/outscale/resource_outscale_snapshot_test.go @@ -22,7 +22,7 @@ func TestAccOthers_Snapshot_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotConfig(utils.GetRegion()), + Config: testAccOutscaleSnapshotConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOAPISnapshotExists("outscale_snapshot.outscale_snapshot", &v), ), @@ -40,7 +40,7 @@ func TestAccOthers_Snapshot_withDescription(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotConfigWithDescription(utils.GetRegion()), + Config: testAccOutscaleSnapshotConfigWithDescription(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOAPISnapshotExists("outscale_snapshot.test", &v), resource.TestCheckResourceAttr("outscale_snapshot.test", "description", "Snapshot Acceptance Test"), @@ -59,7 +59,7 @@ func TestAccOthers_Snapshot_CopySnapshot(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotConfigCopySnapshot(utils.GetRegion()), + Config: testAccOutscaleSnapshotConfigCopySnapshot(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOAPISnapshotExists("outscale_snapshot.test", &v), resource.TestCheckResourceAttr("outscale_snapshot.test", "description", "Target Snapshot Acceptance Test"), @@ -79,11 +79,11 @@ func TestAccOthers_Snapshot_UpdateTags(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotConfigUpdateTags(region, "Terraform-Snapshot"), + Config: testAccOutscaleSnapshotConfigUpdateTags(region, "Terraform-Snapshot"), Check: resource.ComposeTestCheckFunc(), }, { - Config: testAccOutscaleOAPISnapshotConfigUpdateTags(region, "Terraform-Snapshot-2"), + Config: testAccOutscaleSnapshotConfigUpdateTags(region, "Terraform-Snapshot-2"), Check: resource.ComposeTestCheckFunc(), }, }, @@ -99,7 +99,7 @@ func TestAccOthers_Snapshot_importBasic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotConfig(utils.GetRegion()), + Config: testAccOutscaleSnapshotConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOAPISnapshotExists("outscale_snapshot.outscale_snapshot", &v), ), @@ -152,7 +152,7 @@ func testAccCheckOAPISnapshotExists(n string, v *oscgo.Snapshot) resource.TestCh } } -func testAccOutscaleOAPISnapshotConfig(region string) string { +func testAccOutscaleSnapshotConfig(region string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume" { subregion_name = "%sa" @@ -170,7 +170,7 @@ resource "outscale_snapshot_attributes" "outscale_snapshot_attributes" { `, region) } -func testAccOutscaleOAPISnapshotConfigWithDescription(region string) string { +func testAccOutscaleSnapshotConfigWithDescription(region string) string { return fmt.Sprintf(` resource "outscale_volume" "description_test" { subregion_name = "%sa" @@ -184,7 +184,7 @@ func testAccOutscaleOAPISnapshotConfigWithDescription(region string) string { `, region) } -func testAccOutscaleOAPISnapshotConfigCopySnapshot(region string) string { +func testAccOutscaleSnapshotConfigCopySnapshot(region string) string { return fmt.Sprintf(` resource "outscale_volume" "description_test" { subregion_name = "%[1]sb" @@ -204,7 +204,7 @@ func testAccOutscaleOAPISnapshotConfigCopySnapshot(region string) string { `, region) } -func testAccOutscaleOAPISnapshotConfigUpdateTags(region, value string) string { +func testAccOutscaleSnapshotConfigUpdateTags(region, value string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume" { subregion_name = "%sa" diff --git a/outscale/resource_outscale_subnet.go b/outscale/resource_outscale_subnet.go index e4694f703..c4fbeedef 100644 --- a/outscale/resource_outscale_subnet.go +++ b/outscale/resource_outscale_subnet.go @@ -12,12 +12,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPISubNet() *schema.Resource { +func ResourceOutscaleSubNet() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPISubNetCreate, - Read: resourceOutscaleOAPISubNetRead, - Update: resourceOutscaleOAPISubNetUpdate, - Delete: resourceOutscaleOAPISubNetDelete, + Create: ResourceOutscaleSubNetCreate, + Read: ResourceOutscaleSubNetRead, + Update: ResourceOutscaleSubNetUpdate, + Delete: ResourceOutscaleSubNetDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -30,7 +30,7 @@ func resourceOutscaleOAPISubNet() *schema.Resource { } // Create SubNet -func resourceOutscaleOAPISubNetCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSubNetCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateSubnetRequest{ IpRange: d.Get("ip_range").(string), @@ -96,11 +96,11 @@ func resourceOutscaleOAPISubNetCreate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Failure updating MapPublicIpOnLaunch: %s", err) } } - return resourceOutscaleOAPISubNetRead(d, meta) + return ResourceOutscaleSubNetRead(d, meta) } // Read SubNet -func resourceOutscaleOAPISubNetRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSubNetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() log.Printf("[DEBUG] Reading Subnet(%s)", id) @@ -126,9 +126,9 @@ func resourceOutscaleOAPISubNetRead(d *schema.ResourceData, meta interface{}) er d.SetId("") return nil } - return readOutscaleOAPISubNet(d, &resp.GetSubnets()[0]) + return readOutscaleSubNet(d, &resp.GetSubnets()[0]) } -func resourceOutscaleOAPISubNetUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSubNetUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { @@ -156,10 +156,10 @@ func resourceOutscaleOAPISubNetUpdate(d *schema.ResourceData, meta interface{}) } } - return resourceOutscaleOAPISubNetRead(d, meta) + return ResourceOutscaleSubNetRead(d, meta) } -func resourceOutscaleOAPISubNetDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleSubNetDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI id := d.Id() log.Printf("[DEBUG] Deleting Subnet (%s)", id) @@ -193,7 +193,7 @@ func resourceOutscaleOAPISubNetDelete(d *schema.ResourceData, meta interface{}) d.SetId("") return nil } -func readOutscaleOAPISubNet(d *schema.ResourceData, subnet *oscgo.Subnet) error { +func readOutscaleSubNet(d *schema.ResourceData, subnet *oscgo.Subnet) error { if err := d.Set("subregion_name", subnet.GetSubregionName()); err != nil { fmt.Printf("[WARN] ERROR readOutscaleSubNet1 (%s)", err) return err diff --git a/outscale/resource_outscale_subnet_test.go b/outscale/resource_outscale_subnet_test.go index 7bfb72afe..003c9d0a3 100644 --- a/outscale/resource_outscale_subnet_test.go +++ b/outscale/resource_outscale_subnet_test.go @@ -22,19 +22,19 @@ func TestAccNet_WithSubNet_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPISubNetDestroyed, // we need to create the destroyed test case + CheckDestroy: testAccCheckOutscaleSubNetDestroyed, // we need to create the destroyed test case Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISubnetConfig(utils.GetRegion(), false), + Config: testAccOutscaleSubnetConfig(utils.GetRegion(), false), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubNetExists(resourceName, &conf), + testAccCheckOutscaleSubNetExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "map_public_ip_on_launch", "false"), ), }, { - Config: testAccOutscaleOAPISubnetConfig(utils.GetRegion(), true), + Config: testAccOutscaleSubnetConfig(utils.GetRegion(), true), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubNetExists(resourceName, &conf), + testAccCheckOutscaleSubNetExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "map_public_ip_on_launch", "true"), ), }, @@ -42,7 +42,7 @@ func TestAccNet_WithSubNet_basic(t *testing.T) { }) } -func testAccCheckOutscaleOAPISubNetExists(n string, res *oscgo.Subnet) resource.TestCheckFunc { +func testAccCheckOutscaleSubNetExists(n string, res *oscgo.Subnet) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -85,7 +85,7 @@ func testAccCheckOutscaleOAPISubNetExists(n string, res *oscgo.Subnet) resource. } } -func testAccCheckOutscaleOAPISubNetDestroyed(s *terraform.State) error { +func testAccCheckOutscaleSubNetDestroyed(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "outscale_subnet" { continue @@ -122,7 +122,7 @@ func testAccCheckOutscaleOAPISubNetDestroyed(s *terraform.State) error { return nil } -func testAccOutscaleOAPISubnetConfig(region string, mapPublicIpOnLaunch bool) string { +func testAccOutscaleSubnetConfig(region string, mapPublicIpOnLaunch bool) string { return fmt.Sprintf(` resource "outscale_net" "net" { ip_range = "10.0.0.0/16" diff --git a/outscale/resource_outscale_tags.go b/outscale/resource_outscale_tags.go index 9602142ee..437c724df 100644 --- a/outscale/resource_outscale_tags.go +++ b/outscale/resource_outscale_tags.go @@ -13,11 +13,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPITags() *schema.Resource { +func ResourceOutscaleTags() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPITagsCreate, - Read: resourceOutscaleOAPITagsRead, - Delete: resourceOutscaleOAPITagsDelete, + Create: ResourceOutscaleTagsCreate, + Read: ResourceOutscaleTagsRead, + Delete: ResourceOutscaleTagsDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -31,7 +31,7 @@ func resourceOutscaleOAPITags() *schema.Resource { } } -func resourceOutscaleOAPITagsCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleTagsCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI request := oscgo.CreateTagsRequest{} @@ -72,10 +72,10 @@ func resourceOutscaleOAPITagsCreate(d *schema.ResourceData, meta interface{}) er d.SetId(resource.UniqueId()) - return resourceOutscaleOAPITagsRead(d, meta) + return ResourceOutscaleTagsRead(d, meta) } -func resourceOutscaleOAPITagsRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleTagsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI // Build up search parameters @@ -136,7 +136,7 @@ func resourceOutscaleOAPITagsRead(d *schema.ResourceData, meta interface{}) erro return err } -func resourceOutscaleOAPITagsDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleTagsDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI request := oscgo.DeleteTagsRequest{} diff --git a/outscale/resource_outscale_tags_test.go b/outscale/resource_outscale_tags_test.go index 29f4deb9a..f874bbf43 100644 --- a/outscale/resource_outscale_tags_test.go +++ b/outscale/resource_outscale_tags_test.go @@ -26,7 +26,7 @@ func TestAccVM_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccCheckOAPIInstanceConfigTags(omi, "tinav4.c2r2p2", utils.GetRegion(), "keyOriginal", "valueOriginal"), diff --git a/outscale/resource_outscale_virtual_gateway.go b/outscale/resource_outscale_virtual_gateway.go index 04889c8f9..ebb2ee393 100644 --- a/outscale/resource_outscale_virtual_gateway.go +++ b/outscale/resource_outscale_virtual_gateway.go @@ -14,12 +14,12 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIVirtualGateway() *schema.Resource { +func ResourceOutscaleVirtualGateway() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIVirtualGatewayCreate, - Read: resourceOutscaleOAPIVirtualGatewayRead, - Update: resourceOutscaleOAPIVirtualGatewayUpdate, - Delete: resourceOutscaleOAPIVirtualGatewayDelete, + Create: ResourceOutscaleVirtualGatewayCreate, + Read: ResourceOutscaleVirtualGatewayRead, + Update: ResourceOutscaleVirtualGatewayUpdate, + Delete: ResourceOutscaleVirtualGatewayDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -67,7 +67,7 @@ func resourceOutscaleOAPIVirtualGateway() *schema.Resource { } } -func resourceOutscaleOAPIVirtualGatewayCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI connectType, connecTypeOk := d.GetOk("connection_type") createOpts := oscgo.CreateVirtualGatewayRequest{} @@ -112,10 +112,10 @@ func resourceOutscaleOAPIVirtualGatewayCreate(d *schema.ResourceData, meta inter return err } } - return resourceOutscaleOAPIVirtualGatewayRead(d, meta) + return ResourceOutscaleVirtualGatewayRead(d, meta) } -func resourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var resp oscgo.ReadVirtualGatewaysResponse @@ -171,7 +171,7 @@ func resourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interfa return nil } -func resourceOutscaleOAPIVirtualGatewayUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err @@ -179,7 +179,7 @@ func resourceOutscaleOAPIVirtualGatewayUpdate(d *schema.ResourceData, meta inter return nil } -func resourceOutscaleOAPIVirtualGatewayDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI return resource.Retry(5*time.Minute, func() *resource.RetryError { diff --git a/outscale/resource_outscale_virtual_gateway_link.go b/outscale/resource_outscale_virtual_gateway_link.go index 120bec9f1..6ff0bbe17 100644 --- a/outscale/resource_outscale_virtual_gateway_link.go +++ b/outscale/resource_outscale_virtual_gateway_link.go @@ -14,11 +14,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIVirtualGatewayLink() *schema.Resource { +func ResourceOutscaleVirtualGatewayLink() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIVirtualGatewayLinkCreate, - Read: resourceOutscaleOAPIVirtualGatewayLinkRead, - Delete: resourceOutscaleOAPIVirtualGatewayLinkDelete, + Create: ResourceOutscaleVirtualGatewayLinkCreate, + Read: ResourceOutscaleVirtualGatewayLinkRead, + Delete: ResourceOutscaleVirtualGatewayLinkDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -64,7 +64,7 @@ func resourceOutscaleOAPIVirtualGatewayLink() *schema.Resource { } } -func resourceOutscaleOAPIVirtualGatewayLinkCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayLinkCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI netID := d.Get("net_id").(string) @@ -113,10 +113,10 @@ func resourceOutscaleOAPIVirtualGatewayLinkCreate(d *schema.ResourceData, meta i d.SetId(vgwID) - return resourceOutscaleOAPIVirtualGatewayLinkRead(d, meta) + return ResourceOutscaleVirtualGatewayLinkRead(d, meta) } -func resourceOutscaleOAPIVirtualGatewayLinkRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayLinkRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vgwID := d.Id() @@ -187,7 +187,7 @@ func flattenNetToVirtualGatewayLinks(netToVirtualGatewayLinks *[]oscgo.NetToVirt return res } -func resourceOutscaleOAPIVirtualGatewayLinkDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVirtualGatewayLinkDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI // Get the old VPC ID to detach from diff --git a/outscale/resource_outscale_virtual_gateway_link_test.go b/outscale/resource_outscale_virtual_gateway_link_test.go index 826b14903..825567665 100644 --- a/outscale/resource_outscale_virtual_gateway_link_test.go +++ b/outscale/resource_outscale_virtual_gateway_link_test.go @@ -28,7 +28,7 @@ func TestAccNet_withpnGatewayAttachment_basic(t *testing.T) { { Config: testAccOAPIVpnGatewayAttachmentConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinExists( + testAccCheckOutscaleLinExists( "outscale_net.test", &vpc), testAccCheckOAPIVirtualGatewayExists( @@ -100,7 +100,7 @@ func TestAccNet_WithVpnGatewayAttachment_deleted(t *testing.T) { { Config: testAccOAPIVpnGatewayAttachmentConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinExists( + testAccCheckOutscaleLinExists( "outscale_net.test", &vpc), testAccCheckOAPIVirtualGatewayExists( diff --git a/outscale/resource_outscale_virtual_gateway_route_propagation.go b/outscale/resource_outscale_virtual_gateway_route_propagation.go index a4bbeb7c3..41346ea93 100644 --- a/outscale/resource_outscale_virtual_gateway_route_propagation.go +++ b/outscale/resource_outscale_virtual_gateway_route_propagation.go @@ -12,11 +12,11 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIVirtualGatewayRoutePropagation() *schema.Resource { +func ResourceOutscaleVirtualGatewayRoutePropagation() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleOAPIVpnGatewayRoutePropagationEnable, - Read: resourceOutscaleOAPIVpnGatewayRoutePropagationRead, - Delete: resourceOutscaleOAPIVpnGatewayRoutePropagationDisable, + Create: ResourceOutscaleVpnGatewayRoutePropagationEnable, + Read: ResourceOutscaleVpnGatewayRoutePropagationRead, + Delete: ResourceOutscaleVpnGatewayRoutePropagationDisable, Schema: map[string]*schema.Schema{ "virtual_gateway_id": { @@ -42,7 +42,7 @@ func resourceOutscaleOAPIVirtualGatewayRoutePropagation() *schema.Resource { } } -func resourceOutscaleOAPIVpnGatewayRoutePropagationEnable(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVpnGatewayRoutePropagationEnable(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI gwID := d.Get("virtual_gateway_id").(string) @@ -74,7 +74,7 @@ func resourceOutscaleOAPIVpnGatewayRoutePropagationEnable(d *schema.ResourceData return nil } -func resourceOutscaleOAPIVpnGatewayRoutePropagationDisable(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVpnGatewayRoutePropagationDisable(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI gwID := d.Get("virtual_gateway_id").(string) @@ -105,7 +105,7 @@ func resourceOutscaleOAPIVpnGatewayRoutePropagationDisable(d *schema.ResourceDat return nil } -func resourceOutscaleOAPIVpnGatewayRoutePropagationRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVpnGatewayRoutePropagationRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI gwID := d.Get("virtual_gateway_id").(string) diff --git a/outscale/resource_outscale_virtual_gateway_route_propagation_test.go b/outscale/resource_outscale_virtual_gateway_route_propagation_test.go index 861bd6f71..bf3a06869 100644 --- a/outscale/resource_outscale_virtual_gateway_route_propagation_test.go +++ b/outscale/resource_outscale_virtual_gateway_route_propagation_test.go @@ -25,9 +25,9 @@ func TestAccNet_WithVirtualRoutePropagation_basic(t *testing.T) { CheckDestroy: testAccCheckOAPIVirtualRoutePropagationDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIVpnRoutePropagationConfig(rBgpAsn), + Config: testAccOutscaleVpnRoutePropagationConfig(rBgpAsn), Check: resource.ComposeTestCheckFunc( - testAccOutscaleOAPIVpnRoutePropagation( + testAccOutscaleVpnRoutePropagation( "outscale_virtual_gateway_route_propagation.outscale_virtual_gateway_route_propagation", ), ), @@ -82,7 +82,7 @@ func testAccCheckOAPIVirtualRoutePropagationDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIVpnRoutePropagation(routeProp string) resource.TestCheckFunc { +func testAccOutscaleVpnRoutePropagation(routeProp string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[routeProp] if !ok { @@ -97,7 +97,7 @@ func testAccOutscaleOAPIVpnRoutePropagation(routeProp string) resource.TestCheck } } -func testAccOutscaleOAPIVpnRoutePropagationConfig(rBgpAsn int) string { +func testAccOutscaleVpnRoutePropagationConfig(rBgpAsn int) string { return fmt.Sprintf(` resource "outscale_virtual_gateway" "outscale_virtual_gateway" { connection_type = "ipsec.1" diff --git a/outscale/resource_outscale_virtual_gateway_test.go b/outscale/resource_outscale_virtual_gateway_test.go index bc028730b..965ed4585 100644 --- a/outscale/resource_outscale_virtual_gateway_test.go +++ b/outscale/resource_outscale_virtual_gateway_test.go @@ -118,7 +118,7 @@ func TestAccNet_ImportVirtualGateway_Basic(t *testing.T) { }) } -func testAccOutscaleOAPIVirtualGatewayDisappears(gateway *oscgo.VirtualGateway) resource.TestCheckFunc { +func testAccOutscaleVirtualGatewayDisappears(gateway *oscgo.VirtualGateway) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI var err error diff --git a/outscale/resource_outscale_vm.go b/outscale/resource_outscale_vm.go index e5809e369..ea253bfcc 100644 --- a/outscale/resource_outscale_vm.go +++ b/outscale/resource_outscale_vm.go @@ -17,7 +17,7 @@ import ( "github.com/spf13/cast" ) -func resourceOutscaleOApiVM() *schema.Resource { +func ResourceOutscaleVM() *schema.Resource { return &schema.Resource{ Create: resourceOAPIVMCreate, Read: resourceOAPIVMRead, diff --git a/outscale/resource_outscale_vm_test.go b/outscale/resource_outscale_vm_test.go index 429d0ec5e..18d29ede9 100644 --- a/outscale/resource_outscale_vm_test.go +++ b/outscale/resource_outscale_vm_test.go @@ -29,13 +29,13 @@ func TestAccVM_Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigBasic(omi, "tinav4.c2r2p2", region, keypair), + Config: testAccCheckOutscaleVMConfigBasic(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists(resourceName, &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists(resourceName, &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr(resourceName, "image_id", omi), resource.TestCheckResourceAttr(resourceName, "vm_type", "tinav4.c2r2p2"), @@ -56,13 +56,13 @@ func TestAccVM_Behavior_Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMBehaviorConfigBasic(omi, "tinav4.c2r2p2", region, keypair, "high", "stop"), + Config: testAccCheckOutscaleVMBehaviorConfigBasic(omi, "tinav4.c2r2p2", region, keypair, "high", "stop"), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basicr1", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.basicr1", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.basicr1", "image_id", omi), resource.TestCheckResourceAttr( @@ -70,10 +70,10 @@ func TestAccVM_Behavior_Basic(t *testing.T) { ), }, { - Config: testAccCheckOutscaleOAPIVMBehaviorConfigBasic(omi, "tinav4.c2r2p2", region, keypair, "high", "restart"), + Config: testAccCheckOutscaleVMBehaviorConfigBasic(omi, "tinav4.c2r2p2", region, keypair, "high", "restart"), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basicr1", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.basicr1", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.basicr1", "image_id", omi), resource.TestCheckResourceAttr( @@ -96,12 +96,12 @@ func TestAccVM_importBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigImport(omi, "tinav4.c2r2p2", region, keypair), + Config: testAccCheckOutscaleVMConfigImport(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists(resourceName, &server), + testAccCheckOutscaleVMExists(resourceName, &server), resource.TestCheckResourceAttr(resourceName, "image_id", omi), resource.TestCheckResourceAttr(resourceName, "vm_type", "tinav4.c2r2p2"), resource.TestCheckResourceAttr(resourceName, "keypair_name", keypair), @@ -139,13 +139,13 @@ func TestAccNet_VM_withNicAttached(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), + Config: testAccCheckOutscaleVMConfigBasicWithNicAttached(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists(resourceName, &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists(resourceName, &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr(resourceName, "image_id", omi), resource.TestCheckResourceAttr(resourceName, "vm_type", "tinav4.c2r2p2"), ), @@ -164,13 +164,13 @@ func TestAccVM_withTags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccVmsConfigUpdateOAPIVMTags(omi, "tinav4.c2r2p2", utils.GetRegion(), tagsValue, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.basic", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.basic", "image_id", omi), resource.TestCheckResourceAttr( @@ -189,13 +189,13 @@ func TestAccNet_VM_withNics(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, "tinav4.c2r2p2", keypair, utils.GetRegion()), + Config: testAccCheckOutscaleVMConfigBasicWithNics(omi, "tinav4.c2r2p2", keypair, utils.GetRegion()), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.basic", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.basic", "image_id", omi), resource.TestCheckResourceAttr( @@ -218,13 +218,13 @@ func TestAccVM_UpdateKeypair(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &before), - testAccCheckOutscaleOAPIVMAttributes(t, &before, omi), + testAccCheckOutscaleVMExists("outscale_vm.basic", &before), + testAccCheckOutscaleVMAttributes(t, &before, omi), resource.TestCheckResourceAttr("outscale_vm.basic", "image_id", omi), resource.TestCheckResourceAttr("outscale_vm.basic", "vm_type", "tinav4.c2r2p2"), ), @@ -249,13 +249,13 @@ func TestAccNet_VM_WithSubnet(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigWithSubnet(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), + Config: testAccCheckOutscaleVMConfigWithSubnet(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.basic", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.basic", "image_id", omi), resource.TestCheckResourceAttr( @@ -274,7 +274,7 @@ func TestAccVM_UpdateDeletionProtection(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, keypair, true), @@ -302,7 +302,7 @@ func TestAccVM_UpdateTags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccVmsConfigUpdateOAPIVMTags(omi, "tinav4.c2r2p2", utils.GetRegion(), tagsValue, keypair), @@ -325,13 +325,13 @@ func TestAccNet_WithVM_PublicIp_Link(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigWithNet(omi, vmType, utils.GetRegion(), keypair), + Config: testAccCheckOutscaleVMConfigWithNet(omi, vmType, utils.GetRegion(), keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.outscale_vmnet", &server), - testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), + testAccCheckOutscaleVMExists("outscale_vm.outscale_vmnet", &server), + testAccCheckOutscaleVMAttributes(t, &server, omi), resource.TestCheckResourceAttr( "outscale_vm.outscale_vmnet", "image_id", omi), resource.TestCheckResourceAttr( @@ -351,12 +351,12 @@ func TestAccVM_multiBlockDeviceMapping(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckValues(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, + CheckDestroy: testAccCheckOutscaleVMDestroy, Steps: []resource.TestStep{ { Config: testAccCheckOutscaleVMWithMultiBlockDeviceMapping(utils.GetRegion(), omi, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.outscale_vm", &server), + testAccCheckOutscaleVMExists("outscale_vm.outscale_vm", &server), resource.TestCheckResourceAttr("outscale_vm.outscale_vm", "image_id", omi), resource.TestCheckResourceAttr("outscale_vm.outscale_vm", "vm_type", "tinav4.c2r2p2"), ), @@ -524,18 +524,18 @@ func testAccCheckOAPIVMNotRecreated(t *testing.T, before, after *oscgo.Vm) resou } } -func testAccCheckOutscaleOAPIVMDestroy(s *terraform.State) error { - return testAccCheckOutscaleOAPIVMDestroyWithProvider(s, testAccProvider) +func testAccCheckOutscaleVMDestroy(s *terraform.State) error { + return testAccCheckOutscaleVMDestroyWithProvider(s, testAccProvider) } //TODO: check if it is needed -// func testAccCheckOutscaleOAPIVMDestroyWithProviders(providers *[]*schema.Provider) resource.TestCheckFunc { +// func testAccCheckOutscaleVMDestroyWithProviders(providers *[]*schema.Provider) resource.TestCheckFunc { // return func(s *terraform.State) error { // for _, provider := range *providers { // if provider.Meta() == nil { // continue // } -// if err := testAccCheckOutscaleOAPIVMDestroyWithProvider(s, provider); err != nil { +// if err := testAccCheckOutscaleVMDestroyWithProvider(s, provider); err != nil { // return err // } // } @@ -543,7 +543,7 @@ func testAccCheckOutscaleOAPIVMDestroy(s *terraform.State) error { // } // } -func testAccCheckOutscaleOAPIVMDestroyWithProvider(s *terraform.State, provider *schema.Provider) error { +func testAccCheckOutscaleVMDestroyWithProvider(s *terraform.State, provider *schema.Provider) error { conn := provider.Meta().(*OutscaleClient) for _, rs := range s.RootModule().Resources { @@ -587,12 +587,12 @@ func testAccCheckOutscaleOAPIVMDestroyWithProvider(s *terraform.State, provider return nil } -func testAccCheckOutscaleOAPIVMExists(n string, i *oscgo.Vm) resource.TestCheckFunc { +func testAccCheckOutscaleVMExists(n string, i *oscgo.Vm) resource.TestCheckFunc { providers := []*schema.Provider{testAccProvider} - return testAccCheckOutscaleOAPIVMExistsWithProviders(n, i, &providers) + return testAccCheckOutscaleVMExistsWithProviders(n, i, &providers) } -func testAccCheckOutscaleOAPIVMExistsWithProviders(n string, i *oscgo.Vm, providers *[]*schema.Provider) resource.TestCheckFunc { +func testAccCheckOutscaleVMExistsWithProviders(n string, i *oscgo.Vm, providers *[]*schema.Provider) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -640,14 +640,14 @@ func testAccCheckOutscaleOAPIVMExistsWithProviders(n string, i *oscgo.Vm, provid } } -func testAccCheckOutscaleOAPIVMAttributes(t *testing.T, server *oscgo.Vm, omi string) resource.TestCheckFunc { +func testAccCheckOutscaleVMAttributes(t *testing.T, server *oscgo.Vm, omi string) resource.TestCheckFunc { return func(s *terraform.State) error { assertEqual(t, omi, server.GetImageId(), "Bad image_id.") return nil } } -func testAccCheckOutscaleOAPIVMConfigBasic(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigBasic(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_basicVvm" { description = "testAcc Terraform security group" @@ -666,7 +666,7 @@ func testAccCheckOutscaleOAPIVMConfigBasic(omi, vmType, region, keypair string) }`, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigImport(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigImport(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_import_vm" { description = "testAcc Terraform security group" @@ -686,7 +686,7 @@ func testAccCheckOutscaleOAPIVMConfigImport(omi, vmType, region, keypair string) }`, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigBasicWithNicAttached(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -743,7 +743,7 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, vmType, region, k }`, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair, region string) string { +func testAccCheckOutscaleVMConfigBasicWithNics(omi, vmType, keypair, region string) string { return fmt.Sprintf(`resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" } @@ -856,7 +856,7 @@ func testAccVmsConfigUpdateOAPIVMTags(omi, vmType, region, value, keypair string `, omi, vmType, region, value, keypair) } -func testAccCheckOutscaleOAPIVMConfigWithSubnet(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigWithSubnet(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -891,7 +891,7 @@ func testAccCheckOutscaleOAPIVMConfigWithSubnet(omi, vmType, region, keypair str `, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigWithBlockDeviceMappings(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigWithBlockDeviceMappings(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_volume" "external1" { subregion_name = "%[3]sa" @@ -931,7 +931,7 @@ func testAccCheckOutscaleOAPIVMConfigWithBlockDeviceMappings(omi, vmType, region `, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigWithNet(omi, vmType, region, keypair string) string { +func testAccCheckOutscaleVMConfigWithNet(omi, vmType, region, keypair string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -1014,7 +1014,7 @@ func assertEqual(t *testing.T, a interface{}, b interface{}, message string) { } } -func testAccCheckOutscaleOAPIVMBehaviorConfigBasic(omi, vmType, region, keypair, perfomance, vmBehavior string) string { +func testAccCheckOutscaleVMBehaviorConfigBasic(omi, vmType, region, keypair, perfomance, vmBehavior string) string { return fmt.Sprintf(` resource "outscale_security_group" "sg_behavior_vm" { description = "testAcc Terraform security group" diff --git a/outscale/resource_outscale_volume.go b/outscale/resource_outscale_volume.go index 811c0317a..365079849 100644 --- a/outscale/resource_outscale_volume.go +++ b/outscale/resource_outscale_volume.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceOutscaleOAPIVolume() *schema.Resource { +func ResourceOutscaleVolume() *schema.Resource { return &schema.Resource{ Create: resourceOAPIVolumeCreate, Read: resourceOAPIVolumeRead, diff --git a/outscale/resource_outscale_volume_test.go b/outscale/resource_outscale_volume_test.go index 81b89f15b..d174a512b 100644 --- a/outscale/resource_outscale_volume_test.go +++ b/outscale/resource_outscale_volume_test.go @@ -24,7 +24,7 @@ func TestAccOthers_Volume_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIVolumeConfig(utils.GetRegion()), + Config: testAccOutscaleVolumeConfig(utils.GetRegion()), Check: resource.ComposeTestCheckFunc( testAccCheckOAPIVolumeExists("outscale_volume.test", &v), ), @@ -52,14 +52,14 @@ func TestAccOthers_Volume_updateSize(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIVolumeConfig(region), + Config: testAccOutscaleVolumeConfig(region), Check: resource.ComposeTestCheckFunc( testAccCheckOAPIVolumeExists("outscale_volume.test", &v), resource.TestCheckResourceAttr("outscale_volume.test", "size", "1"), ), }, { - Config: testOutscaleOAPIVolumeConfigUpdateSize(region), + Config: testOutscaleVolumeConfigUpdateSize(region), Check: resource.ComposeTestCheckFunc( testAccCheckOAPIVolumeExists("outscale_volume.test", &v), resource.TestCheckResourceAttr("outscale_volume.test", "size", "10"), @@ -153,7 +153,7 @@ func testAccCheckOAPIVolumeExists(n string, v *oscgo.Volume) resource.TestCheckF } } -func testAccOutscaleOAPIVolumeConfig(region string) string { +func testAccOutscaleVolumeConfig(region string) string { return fmt.Sprintf(` resource "outscale_volume" "test" { subregion_name = "%sa" @@ -168,7 +168,7 @@ func testAccOutscaleOAPIVolumeConfig(region string) string { `, region) } -func testOutscaleOAPIVolumeConfigUpdateSize(region string) string { +func testOutscaleVolumeConfigUpdateSize(region string) string { return fmt.Sprintf(` resource "outscale_volume" "test" { subregion_name = "%sa" diff --git a/outscale/resource_outscale_volumes_link.go b/outscale/resource_outscale_volumes_link.go index 573fbb3d6..265dd2350 100644 --- a/outscale/resource_outscale_volumes_link.go +++ b/outscale/resource_outscale_volumes_link.go @@ -13,7 +13,7 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleOAPIVolumeLink() *schema.Resource { +func ResourceOutscaleVolumeLink() *schema.Resource { return &schema.Resource{ Create: resourceOAPIVolumeLinkCreate, Read: resourceOAPIVolumeLinkRead, diff --git a/outscale/resource_outscale_volumes_link_test.go b/outscale/resource_outscale_volumes_link_test.go index c9a7843cd..1714944e5 100644 --- a/outscale/resource_outscale_volumes_link_test.go +++ b/outscale/resource_outscale_volumes_link_test.go @@ -33,7 +33,7 @@ func TestAccVM_WithVolumeAttachment_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "outscale_volumes_link.ebs_att", "device_name", "/dev/sdh"), - testAccCheckOutscaleOAPIVMExists("outscale_vm.web", &i), + testAccCheckOutscaleVMExists("outscale_vm.web", &i), testAccCheckOAPIVolumeAttachmentExists( "outscale_volumes_link.ebs_att", &i, &v), ), diff --git a/outscale/resource_outscale_vpn_connection.go b/outscale/resource_outscale_vpn_connection.go index d27497783..ed90789b1 100644 --- a/outscale/resource_outscale_vpn_connection.go +++ b/outscale/resource_outscale_vpn_connection.go @@ -14,12 +14,12 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" ) -func resourceOutscaleVPNConnection() *schema.Resource { +func ResourceOutscaleVPNConnection() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleVPNConnectionCreate, - Read: resourceOutscaleVPNConnectionRead, - Update: resourceOutscaleVPNConnectionUpdate, - Delete: resourceOutscaleVPNConnectionDelete, + Create: ResourceOutscaleVPNConnectionCreate, + Read: ResourceOutscaleVPNConnectionRead, + Update: ResourceOutscaleVPNConnectionUpdate, + Delete: ResourceOutscaleVPNConnectionDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -120,7 +120,7 @@ func resourceOutscaleVPNConnection() *schema.Resource { } } -func resourceOutscaleVPNConnectionCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.CreateVpnConnectionRequest{ @@ -155,10 +155,10 @@ func resourceOutscaleVPNConnectionCreate(d *schema.ResourceData, meta interface{ d.SetId(*resp.GetVpnConnection().VpnConnectionId) - return resourceOutscaleVPNConnectionRead(d, meta) + return ResourceOutscaleVPNConnectionRead(d, meta) } -func resourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vpnConnectionID := d.Id() @@ -217,16 +217,16 @@ func resourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) return nil } -func resourceOutscaleVPNConnectionUpdate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI if err := setOSCAPITags(conn, d); err != nil { return err } - return resourceOutscaleVPNConnectionRead(d, meta) + return ResourceOutscaleVPNConnectionRead(d, meta) } -func resourceOutscaleVPNConnectionDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI vpnConnectionID := d.Id() diff --git a/outscale/resource_outscale_vpn_connection_route.go b/outscale/resource_outscale_vpn_connection_route.go index df7f95235..9ce2c78d6 100644 --- a/outscale/resource_outscale_vpn_connection_route.go +++ b/outscale/resource_outscale_vpn_connection_route.go @@ -15,13 +15,13 @@ import ( "github.com/outscale/terraform-provider-outscale/utils" ) -func resourceOutscaleVPNConnectionRoute() *schema.Resource { +func ResourceOutscaleVPNConnectionRoute() *schema.Resource { return &schema.Resource{ - Create: resourceOutscaleVPNConnectionRouteCreate, - Read: resourceOutscaleVPNConnectionRouteRead, - Delete: resourceOutscaleVPNConnectionRouteDelete, + Create: ResourceOutscaleVPNConnectionRouteCreate, + Read: ResourceOutscaleVPNConnectionRouteRead, + Delete: ResourceOutscaleVPNConnectionRouteDelete, Importer: &schema.ResourceImporter{ - State: resourceOutscaleOAPIVPNConnectionRouteImportState, + State: ResourceOutscaleVPNConnectionRouteImportState, }, Schema: map[string]*schema.Schema{ @@ -43,7 +43,7 @@ func resourceOutscaleVPNConnectionRoute() *schema.Resource { } } -func resourceOutscaleVPNConnectionRouteCreate(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionRouteCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI destinationIPRange := d.Get("destination_ip_range").(string) @@ -66,13 +66,13 @@ func resourceOutscaleVPNConnectionRouteCreate(d *schema.ResourceData, meta inter d.SetId(fmt.Sprintf("%s:%s", destinationIPRange, vpnConnectionID)) - return resourceOutscaleVPNConnectionRouteRead(d, meta) + return ResourceOutscaleVPNConnectionRouteRead(d, meta) } -func resourceOutscaleVPNConnectionRouteRead(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - destinationIPRange, vpnConnectionID := resourceOutscaleVPNConnectionRouteParseID(d.Id()) + destinationIPRange, vpnConnectionID := ResourceOutscaleVPNConnectionRouteParseID(d.Id()) stateConf := &resource.StateChangeConf{ Pending: []string{"pending"}, @@ -95,10 +95,10 @@ func resourceOutscaleVPNConnectionRouteRead(d *schema.ResourceData, meta interfa return nil } -func resourceOutscaleVPNConnectionRouteDelete(d *schema.ResourceData, meta interface{}) error { +func ResourceOutscaleVPNConnectionRouteDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - destinationIPRange, vpnConnectionID := resourceOutscaleVPNConnectionRouteParseID(d.Id()) + destinationIPRange, vpnConnectionID := ResourceOutscaleVPNConnectionRouteParseID(d.Id()) req := oscgo.DeleteVpnConnectionRouteRequest{ DestinationIpRange: destinationIPRange, @@ -173,12 +173,12 @@ func vpnConnectionRouteRefreshFunc(conn *oscgo.APIClient, destinationIPRange, vp } } -func resourceOutscaleVPNConnectionRouteParseID(ID string) (string, string) { +func ResourceOutscaleVPNConnectionRouteParseID(ID string) (string, string) { parts := strings.SplitN(ID, ":", 2) return parts[0], parts[1] } -func resourceOutscaleOAPIVPNConnectionRouteImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func ResourceOutscaleVPNConnectionRouteImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { conn := meta.(*OutscaleClient).OSCAPI parts := strings.SplitN(d.Id(), "_", 2) diff --git a/outscale/resource_outscale_vpn_connection_route_test.go b/outscale/resource_outscale_vpn_connection_route_test.go index 659808b5c..e9734bf0b 100644 --- a/outscale/resource_outscale_vpn_connection_route_test.go +++ b/outscale/resource_outscale_vpn_connection_route_test.go @@ -62,7 +62,7 @@ func TestAccOthers_ImportVPNConnectionRoute_basic(t *testing.T) { { ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName), + ImportStateIdFunc: testAccCheckOutscaleRouteImportStateIDFunc(resourceName), ImportStateVerify: true, ImportStateVerifyIgnore: []string{"request_id"}, }, @@ -86,7 +86,7 @@ func testAccOutscaleVPNConnectionRouteExists(resourceName string) resource.TestC return fmt.Errorf("No VPN Connection Route ID is set") } - destinationIPRange, vpnConnectionID := resourceOutscaleVPNConnectionRouteParseID(rs.Primary.ID) + destinationIPRange, vpnConnectionID := ResourceOutscaleVPNConnectionRouteParseID(rs.Primary.ID) filter := oscgo.ReadVpnConnectionsRequest{ Filters: &oscgo.FiltersVpnConnection{ @@ -128,7 +128,7 @@ func testAccOutscaleVPNConnectionRouteDestroy(s *terraform.State) error { continue } - destinationIPRange, vpnConnectionID := resourceOutscaleVPNConnectionRouteParseID(rs.Primary.ID) + destinationIPRange, vpnConnectionID := ResourceOutscaleVPNConnectionRouteParseID(rs.Primary.ID) filter := oscgo.ReadVpnConnectionsRequest{ Filters: &oscgo.FiltersVpnConnection{