From 09ddd780420faee2198f3df67a1a223a1daf8d15 Mon Sep 17 00:00:00 2001 From: Thiery Ouattara Date: Fri, 6 Jan 2023 12:54:07 +0000 Subject: [PATCH 01/82] Migration to terraform-plugin-sdk-v2 --- go.mod | 25 +- go.sum | 1203 +++++++++++------ main.go | 2 +- outscale/config.go | 2 +- outscale/data_source_outscale_access_key.go | 8 +- .../data_source_outscale_access_key_test.go | 2 +- outscale/data_source_outscale_access_keys.go | 8 +- .../data_source_outscale_access_keys_test.go | 2 +- outscale/data_source_outscale_account.go | 4 +- outscale/data_source_outscale_account_test.go | 2 +- outscale/data_source_outscale_accounts.go | 4 +- .../data_source_outscale_accounts_test.go | 2 +- .../data_source_outscale_api_access_policy.go | 4 +- ..._source_outscale_api_access_policy_test.go | 2 +- .../data_source_outscale_api_access_rule.go | 4 +- ...ta_source_outscale_api_access_rule_test.go | 5 +- .../data_source_outscale_api_access_rules.go | 4 +- ...a_source_outscale_api_access_rules_test.go | 5 +- outscale/data_source_outscale_ca.go | 4 +- outscale/data_source_outscale_ca_test.go | 4 +- outscale/data_source_outscale_cas.go | 4 +- outscale/data_source_outscale_cas_test.go | 4 +- .../data_source_outscale_client_gateway.go | 4 +- ...ata_source_outscale_client_gateway_test.go | 4 +- .../data_source_outscale_client_gateways.go | 6 +- ...ta_source_outscale_client_gateways_test.go | 2 +- outscale/data_source_outscale_dhcp_option.go | 5 +- .../data_source_outscale_dhcp_option_test.go | 4 +- outscale/data_source_outscale_dhcp_options.go | 6 +- .../data_source_outscale_dhcp_options_test.go | 4 +- outscale/data_source_outscale_flexible_gpu.go | 4 +- ...ta_source_outscale_flexible_gpu_catalog.go | 6 +- ...urce_outscale_flexible_gpu_catalog_test.go | 2 +- .../data_source_outscale_flexible_gpu_test.go | 2 +- .../data_source_outscale_flexible_gpus.go | 6 +- ...data_source_outscale_flexible_gpus_test.go | 2 +- outscale/data_source_outscale_image.go | 6 +- .../data_source_outscale_image_export_task.go | 6 +- ..._source_outscale_image_export_task_test.go | 6 +- ...data_source_outscale_image_export_tasks.go | 6 +- ...source_outscale_image_export_tasks_test.go | 4 +- outscale/data_source_outscale_image_test.go | 6 +- outscale/data_source_outscale_images.go | 4 +- outscale/data_source_outscale_images_test.go | 6 +- .../data_source_outscale_internet_service.go | 4 +- ...a_source_outscale_internet_service_test.go | 2 +- .../data_source_outscale_internet_services.go | 6 +- ..._source_outscale_internet_services_test.go | 2 +- outscale/data_source_outscale_keypair.go | 6 +- outscale/data_source_outscale_keypair_test.go | 4 +- outscale/data_source_outscale_keypairs.go | 6 +- .../data_source_outscale_keypairs_test.go | 4 +- .../data_source_outscale_load_balancer.go | 32 +- ...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 | 6 +- ...data_source_outscale_load_balancer_test.go | 20 +- ...source_outscale_load_balancer_vm_health.go | 6 +- .../data_source_outscale_load_balancer_vms.go | 2 +- .../data_source_outscale_load_balancers.go | 29 +- ...ata_source_outscale_load_balancers_test.go | 2 +- outscale/data_source_outscale_nat_service.go | 6 +- .../data_source_outscale_nat_service_test.go | 4 +- outscale/data_source_outscale_nat_services.go | 6 +- .../data_source_outscale_nat_services_test.go | 2 +- outscale/data_source_outscale_net.go | 6 +- .../data_source_outscale_net_access_point.go | 4 +- ...urce_outscale_net_access_point_services.go | 6 +- ...outscale_net_access_point_services_test.go | 2 +- ...a_source_outscale_net_access_point_test.go | 2 +- .../data_source_outscale_net_access_points.go | 6 +- ..._source_outscale_net_access_points_test.go | 2 +- .../data_source_outscale_net_attributes.go | 4 +- ...ata_source_outscale_net_attributes_test.go | 4 +- outscale/data_source_outscale_net_peering.go | 41 +- .../data_source_outscale_net_peering_test.go | 10 +- outscale/data_source_outscale_net_peerings.go | 70 +- .../data_source_outscale_net_peerings_test.go | 7 +- outscale/data_source_outscale_net_test.go | 4 +- outscale/data_source_outscale_nets.go | 6 +- outscale/data_source_outscale_nets_test.go | 2 +- outscale/data_source_outscale_nic.go | 80 +- outscale/data_source_outscale_nic_test.go | 21 +- outscale/data_source_outscale_nics.go | 20 +- outscale/data_source_outscale_nics_test.go | 10 +- outscale/data_source_outscale_product_type.go | 6 +- .../data_source_outscale_product_type_test.go | 2 +- .../data_source_outscale_product_types.go | 6 +- ...data_source_outscale_product_types_test.go | 2 +- .../data_source_outscale_public_catalog.go | 4 +- ...ata_source_outscale_public_catalog_test.go | 2 +- outscale/data_source_outscale_public_ip.go | 4 +- .../data_source_outscale_public_ip_test.go | 4 +- outscale/data_source_outscale_public_ips.go | 6 +- .../data_source_outscale_public_ips_test.go | 2 +- outscale/data_source_outscale_quota.go | 6 +- outscale/data_source_outscale_quota_test.go | 2 +- outscale/data_source_outscale_quotas.go | 6 +- outscale/data_source_outscale_quotas_test.go | 2 +- outscale/data_source_outscale_regions.go | 4 +- outscale/data_source_outscale_regions_test.go | 4 +- outscale/data_source_outscale_route_table.go | 4 +- .../data_source_outscale_route_table_test.go | 21 +- outscale/data_source_outscale_route_tables.go | 5 +- .../data_source_outscale_route_tables_test.go | 2 +- .../data_source_outscale_security_group.go | 4 +- ...ata_source_outscale_security_group_test.go | 6 +- .../data_source_outscale_security_groups.go | 4 +- ...ta_source_outscale_security_groups_test.go | 4 +- ...data_source_outscale_server_certificate.go | 5 +- ...source_outscale_server_certificate_test.go | 4 +- ...ata_source_outscale_server_certificates.go | 4 +- ...ource_outscale_server_certificates_test.go | 4 +- outscale/data_source_outscale_snapshot.go | 5 +- ...ta_source_outscale_snapshot_export_task.go | 4 +- ...urce_outscale_snapshot_export_task_test.go | 6 +- ...a_source_outscale_snapshot_export_tasks.go | 6 +- ...rce_outscale_snapshot_export_tasks_test.go | 4 +- .../data_source_outscale_snapshot_test.go | 4 +- outscale/data_source_outscale_snapshots.go | 6 +- .../data_source_outscale_snapshots_test.go | 2 +- outscale/data_source_outscale_subnet.go | 4 +- outscale/data_source_outscale_subnet_test.go | 4 +- outscale/data_source_outscale_subnets.go | 6 +- outscale/data_source_outscale_subnets_test.go | 2 +- outscale/data_source_outscale_subregions.go | 5 +- .../data_source_outscale_subregions_test.go | 4 +- outscale/data_source_outscale_tag.go | 6 +- outscale/data_source_outscale_tag_test.go | 2 +- outscale/data_source_outscale_tags.go | 6 +- outscale/data_source_outscale_tags_test.go | 2 +- .../data_source_outscale_virtual_gateway.go | 4 +- ...ta_source_outscale_virtual_gateway_test.go | 4 +- .../data_source_outscale_virtual_gateways.go | 5 +- ...a_source_outscale_virtual_gateways_test.go | 4 +- outscale/data_source_outscale_vm.go | 72 +- outscale/data_source_outscale_vm_state.go | 6 +- .../data_source_outscale_vm_state_test.go | 4 +- outscale/data_source_outscale_vm_states.go | 6 +- .../data_source_outscale_vm_states_test.go | 2 +- outscale/data_source_outscale_vm_test.go | 2 +- outscale/data_source_outscale_vm_types.go | 4 +- .../data_source_outscale_vm_types_test.go | 2 +- outscale/data_source_outscale_vms.go | 4 +- outscale/data_source_outscale_vms_test.go | 2 +- outscale/data_source_outscale_volume.go | 4 +- outscale/data_source_outscale_volume_test.go | 4 +- outscale/data_source_outscale_volumes.go | 4 +- outscale/data_source_outscale_volumes_test.go | 2 +- .../data_source_outscale_vpn_connection.go | 4 +- ...ata_source_outscale_vpn_connection_test.go | 3 +- .../data_source_outscale_vpn_connections.go | 4 +- ...ta_source_outscale_vpn_connections_test.go | 2 +- outscale/dictionary.go | 2 +- .../import_outscale_net_attributes_test.go | 2 +- outscale/instance_set_set.go | 41 +- outscale/oapi_tags.go | 4 +- outscale/provider.go | 5 +- outscale/provider_test.go | 14 +- outscale/resource_outscale_access_key.go | 6 +- outscale/resource_outscale_access_key_test.go | 4 +- .../resource_outscale_api_access_policy.go | 4 +- outscale/resource_outscale_api_access_rule.go | 4 +- .../resource_outscale_api_access_rule_test.go | 5 +- outscale/resource_outscale_ca.go | 4 +- outscale/resource_outscale_ca_test.go | 5 +- outscale/resource_outscale_client_gateway.go | 9 +- .../resource_outscale_client_gateway_test.go | 6 +- outscale/resource_outscale_dhcp_option.go | 11 +- .../resource_outscale_dhcp_option_test.go | 6 +- outscale/resource_outscale_flexible_gpu.go | 4 +- .../resource_outscale_flexible_gpu_link.go | 4 +- ...esource_outscale_flexible_gpu_link_test.go | 2 +- .../resource_outscale_flexible_gpu_test.go | 2 +- outscale/resource_outscale_image.go | 9 +- .../resource_outscale_image_export_task.go | 10 +- ...esource_outscale_image_export_task_test.go | 7 +- ...source_outscale_image_launch_permission.go | 7 +- ...e_outscale_image_launch_permission_test.go | 12 +- outscale/resource_outscale_image_test.go | 6 +- .../resource_outscale_internet_service.go | 10 +- ...resource_outscale_internet_service_link.go | 4 +- ...rce_outscale_internet_service_link_test.go | 4 +- ...resource_outscale_internet_service_test.go | 4 +- outscale/resource_outscale_keypair.go | 4 +- outscale/resource_outscale_keypair_test.go | 6 +- outscale/resource_outscale_load_balancer.go | 113 +- ...ource_outscale_load_balancer_attributes.go | 27 +- ..._outscale_load_balancer_attributes_test.go | 6 +- ...ce_outscale_load_balancer_listener_rule.go | 4 +- .../resource_outscale_load_balancer_policy.go | 27 +- ...urce_outscale_load_balancer_policy_test.go | 6 +- .../resource_outscale_load_balancer_test.go | 4 +- .../resource_outscale_load_balancer_vms.go | 4 +- ...esource_outscale_load_balancer_vms_test.go | 14 +- outscale/resource_outscale_nat_service.go | 10 +- .../resource_outscale_nat_service_test.go | 26 +- outscale/resource_outscale_net.go | 10 +- .../resource_outscale_net_access_point.go | 11 +- ...resource_outscale_net_access_point_test.go | 2 +- outscale/resource_outscale_net_attributes.go | 4 +- .../resource_outscale_net_attributes_test.go | 7 +- outscale/resource_outscale_net_peering.go | 47 +- ...source_outscale_net_peering_acceptation.go | 6 +- ...e_outscale_net_peering_acceptation_test.go | 4 +- .../resource_outscale_net_peering_test.go | 4 +- outscale/resource_outscale_net_test.go | 16 +- outscale/resource_outscale_nic.go | 105 +- outscale/resource_outscale_nic_link.go | 6 +- outscale/resource_outscale_nic_link_test.go | 7 +- outscale/resource_outscale_nic_private_ip.go | 4 +- .../resource_outscale_nic_private_ip_test.go | 2 +- outscale/resource_outscale_nic_test.go | 4 +- outscale/resource_outscale_public_ip.go | 10 +- outscale/resource_outscale_public_ip_link.go | 4 +- .../resource_outscale_public_ip_link_test.go | 4 +- outscale/resource_outscale_public_ip_test.go | 20 +- outscale/resource_outscale_route.go | 10 +- outscale/resource_outscale_route_table.go | 11 +- .../resource_outscale_route_table_link.go | 4 +- ...resource_outscale_route_table_link_test.go | 4 +- .../resource_outscale_route_table_test.go | 4 +- outscale/resource_outscale_route_test.go | 4 +- outscale/resource_outscale_security_group.go | 14 +- .../resource_outscale_security_group_rule.go | 6 +- ...ource_outscale_security_group_rule_test.go | 6 +- .../resource_outscale_security_group_test.go | 6 +- .../resource_outscale_server_certificate.go | 4 +- ...source_outscale_server_certificate_test.go | 7 +- outscale/resource_outscale_snapshot.go | 12 +- .../resource_outscale_snapshot_attributes.go | 4 +- ...ource_outscale_snapshot_attributes_test.go | 2 +- .../resource_outscale_snapshot_export_task.go | 10 +- ...urce_outscale_snapshot_export_task_test.go | 6 +- outscale/resource_outscale_snapshot_test.go | 4 +- outscale/resource_outscale_subnet.go | 4 +- outscale/resource_outscale_subnet_test.go | 4 +- outscale/resource_outscale_tags.go | 4 +- outscale/resource_outscale_tags_test.go | 6 +- outscale/resource_outscale_virtual_gateway.go | 39 +- .../resource_outscale_virtual_gateway_link.go | 4 +- ...urce_outscale_virtual_gateway_link_test.go | 51 +- ...scale_virtual_gateway_route_propagation.go | 5 +- ..._virtual_gateway_route_propagation_test.go | 4 +- .../resource_outscale_virtual_gateway_test.go | 5 +- outscale/resource_outscale_vm.go | 27 +- outscale/resource_outscale_vm_test.go | 115 +- outscale/resource_outscale_volume.go | 12 +- outscale/resource_outscale_volume_test.go | 4 +- outscale/resource_outscale_volumes_link.go | 5 +- .../resource_outscale_volumes_link_test.go | 4 +- outscale/resource_outscale_vpn_connection.go | 11 +- .../resource_outscale_vpn_connection_route.go | 7 +- ...urce_outscale_vpn_connection_route_test.go | 4 +- .../resource_outscale_vpn_connection_test.go | 36 +- outscale/sweeper_test.go | 2 +- utils/utils.go | 37 +- 258 files changed, 1820 insertions(+), 1667 deletions(-) diff --git a/go.mod b/go.mod index 748edc698..a96f8e7c7 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,25 @@ module github.com/terraform-providers/terraform-provider-outscale go 1.12 require ( - github.com/aws/aws-sdk-go v1.44.103 + github.com/agext/levenshtein v1.2.3 // indirect + github.com/aws/aws-sdk-go v1.44.187 github.com/davecgh/go-spew v1.1.1 + github.com/fatih/color v1.14.1 // indirect github.com/go-test/deep v1.0.6 - github.com/hashicorp/errwrap v1.0.0 - github.com/hashicorp/terraform v0.14.0 - github.com/hashicorp/terraform-plugin-sdk v1.17.2 + github.com/hashicorp/errwrap v1.1.0 + github.com/hashicorp/go-hclog v1.4.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 + github.com/hashicorp/terraform-svchost v0.0.1 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/nav-inc/datetime v0.1.3 - github.com/openlyinc/pointy v1.1.2 - github.com/outscale/osc-sdk-go/v2 v2.12.0 - github.com/spf13/cast v1.3.1 + github.com/oklog/run v1.1.0 // indirect + github.com/openlyinc/pointy v1.2.0 + github.com/outscale/osc-sdk-go/v2 v2.15.0 + github.com/spf13/cast v1.5.0 + github.com/vmihailenco/tagparser v0.1.2 // indirect + golang.org/x/crypto v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa // indirect + google.golang.org/grpc v1.52.3 // indirect ) diff --git a/go.sum b/go.sum index 9a23db34f..40b9e1788 100644 --- a/go.sum +++ b/go.sum @@ -12,74 +12,389 @@ cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bP cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= +cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= +cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= +cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= +cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= +cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= +cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= +cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= +cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= +cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= +cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= +cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= +cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= +cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= +cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= +cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= +cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI= +cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= +cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE= +cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= +cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= +cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= +cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= +cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= +cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= +cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= +cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= +cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= +cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk= +cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= +cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA= +cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= +cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= +cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= +cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= +cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= +cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= +cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= +cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= +cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= +cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= +cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= +cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= +cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0= +cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= +cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= +cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A= +cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= +cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= +cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4= +cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= +cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= +cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0= +cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= +cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= +cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= +cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= +cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= +cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= +cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw= +cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= +cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI= +cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= +cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= +cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= +cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= +cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= +cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= +cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= +cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= +cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= +cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= +cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= +cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= +cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= +cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= +cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= +cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= +cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= +cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= +cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= +cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= +cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= +cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= +cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= +cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= +cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= +cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= +cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= +cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= +cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= +cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= +cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= +cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= +cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= +cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= +cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= +cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= +cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8= +cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= +cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= +cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0= +cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= +cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= +cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= +cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= +cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= +cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= +cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= +cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= +cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= +cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= +cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= +cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= +cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= +cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= +cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= +cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0= +cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= +cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= +cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= +cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= +cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= +cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= +cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= +cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= +cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk= +cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= +cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= +cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U= +cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= +cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo= +cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= +cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= +cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= +cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= +cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= +cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= +cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= +cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= +cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= +cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= +cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= +cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= +cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= +cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= +cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y= +cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= +cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg= +cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= +cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= +cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= +cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= +cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= +cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= +cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= +cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= +cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= +cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= +cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= +cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= +cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.0/go.mod h1:JljT387FplPzBA31vUcvsetLKF3pec5bdAxjVU4kI2s= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= -github.com/Azure/go-autorest/autorest/validation v0.3.0/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/ChrisTrenkamp/goxpath v0.0.0-20190607011252-c5096ec8773d/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= -github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= +github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= +github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= -github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible/go.mod h1:LDQHRZylxvcg8H7wBIDfvO5g/cy4/sz1iucBlc2l3Jw= -github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= @@ -87,108 +402,76 @@ github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFU github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13/go.mod h1:7kfpUbyCdGJ9fDRCp3fopPQi5+cKNHgTE4ZuNrO71Cw= -github.com/apparentlymart/go-versions v1.0.1/go.mod h1:YF5j7IQtrOAOnsGkniupEA5bfCjzd7i14yu0shZavyM= -github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.31.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.44.103 h1:tbhBHKgiZSIUkG8FcHy3wYKpPVvp65Wn7ZiX0B8phpY= github.com/aws/aws-sdk-go v1.44.103/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= -github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/aws/aws-sdk-go v1.44.187 h1:D5CsRomPnlwDHJCanL2mtaLIcbhjiWxNh5j8zvaWdJA= +github.com/aws/aws-sdk-go v1.44.187/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= -github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y= -github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.1.0 h1:4pl5BV4o7ZG/lterP4S6WzJ6xr49Ba5ET9ygheTYahk= -github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M= -github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc= -github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw= +github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= +github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8= +github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= +github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= +github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.6 h1:UHSEyLZUwX9Qoi99vVwvewiMC8mM2bf7XEM2nqvzEn8= github.com/go-test/deep v1.0.6/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= -github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -196,9 +479,9 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -212,9 +495,13 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -225,16 +512,18 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -242,96 +531,89 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/gophercloud/gophercloud v0.6.1-0.20191122030953-d8ac278c1c9d/go.mod h1:ozGNgr9KYOVATV5jsgHl/ceCDXGuguqOZAzoQ/2vcNM= -github.com/gophercloud/gophercloud v0.10.1-0.20200424014253-c3bfe50899e5/go.mod h1:gmC5oQqMDOMO1t1gq5DquX/yAU808e/4mzjjDA76+Ss= -github.com/gophercloud/utils v0.0.0-20200423144003-7c72efc7435d/go.mod h1:ehWUbLQJPqS0Ep+CxeD559hsm9pthPXadJNKwZkp43w= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/aws-sdk-go-base v0.6.0/go.mod h1:2fRjWDv3jJBeN6mVWFHV6hFTNeFBx2gpDLQaZNxUVAY= -github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.5.1/go.mod h1:a7z7NPPfNQpJWcn4rSWFtdrSldqLdLPEF3d8nFMsSLM= -github.com/hashicorp/go-getter v1.5.3 h1:NF5+zOlQegim+w/EUhSLh6QhXHmZMEeHLQzllkQ3ROU= -github.com/hashicorp/go-getter v1.5.3/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw= -github.com/hashicorp/go-msgpack v0.5.4/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.3.0 h1:4d/wJojzvHV1I4i/rrjVaeuyxWrLzDE1mDCyDy8fXS8= -github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0= -github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= -github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-slug v0.4.1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8= -github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-tfe v0.8.1/go.mod h1:XAV72S4O1iP8BDaqiaPLmL2B4EE6almocnOn8E8stHc= +github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= +github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= +github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= +github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.4.6/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= +github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= -github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+DbLISwf2B8WXEolNRA8BGCwI9jws= -github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= -github.com/hashicorp/hcl/v2 v2.7.2/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= -github.com/hashicorp/hcl/v2 v2.8.2 h1:wmFle3D1vu0okesm8BTLVDyJ6/OL9DCLUwn0b2OptiY= -github.com/hashicorp/hcl/v2 v2.8.2/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= +github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= +github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= +github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8= +github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= -github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= -github.com/hashicorp/terraform v0.14.0 h1:s0OivKdekGqireI8vzOXkXUHb0QxNfG8rnGuPS+cQMU= -github.com/hashicorp/terraform v0.14.0/go.mod h1:K/qLM9bt3zVQPWrOn7IWiHbmNms5bn2O4UWycd2kMjk= -github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 h1:Pc5TCv9mbxFN6UVX0LH6CpQrdTM5YjbVI2w15237Pjk= -github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A= -github.com/hashicorp/terraform-exec v0.13.3 h1:R6L2mNpDGSEqtLrSONN8Xth0xYwNrnEVzDz6LF/oJPk= -github.com/hashicorp/terraform-exec v0.13.3/go.mod h1:SSg6lbUsVB3DmFyCPjBPklqf6EYGX0TlQ6QTxOlikDU= -github.com/hashicorp/terraform-json v0.10.0 h1:9syPD/Y5t+3uFjG8AiWVPu1bklJD8QB8iTCaJASc8oQ= -github.com/hashicorp/terraform-json v0.10.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= -github.com/hashicorp/terraform-plugin-sdk v1.17.2 h1:V7DUR3yBWFrVB9z3ddpY7kiYVSsq4NYR67NiTs93NQo= -github.com/hashicorp/terraform-plugin-sdk v1.17.2/go.mod h1:wkvldbraEMkz23NxkkAsFS88A1R9eUiooiaUZyS6TLw= -github.com/hashicorp/terraform-plugin-test/v2 v2.2.1 h1:d3Rzmi5bnRzcAZon91FY4TDCMUYdU8c5vpPpf2Tz+c8= -github.com/hashicorp/terraform-plugin-test/v2 v2.2.1/go.mod h1:eZ9JL3O69Cb71Skn6OhHyj17sLmHRb+H6VrDcJjKrYU= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= +github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU= +github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= +github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= +github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= +github.com/hashicorp/terraform-plugin-go v0.14.1/go.mod h1:Bc/K6K26BQ2FHqIELPbpKtt2CzzbQou+0UQF3/0NsCQ= +github.com/hashicorp/terraform-plugin-go v0.14.3 h1:nlnJ1GXKdMwsC8g1Nh05tK2wsC3+3BL/DBBxFEki+j0= +github.com/hashicorp/terraform-plugin-go v0.14.3/go.mod h1:7ees7DMZ263q8wQ6E4RdIdR6nHHJtrdt4ogX5lPkX1A= +github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= +github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 h1:zHcMbxY0+rFO9gY99elV/XC/UnQVg7FhRCbj1i5b7vM= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1/go.mod h1:+tNlb0wkfdsDJ7JEiERLz4HzM19HyiuIoGzTsM7rPpw= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= +github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U= +github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= +github.com/hashicorp/terraform-svchost v0.0.1 h1:Zj6fR5wnpOHnJUmLyWozjMeDaVuE+cstMPj41/eKmSQ= +github.com/hashicorp/terraform-svchost v0.0.1/go.mod h1:ut8JaH0vumgdCfJaihdcZULqkAwHdQNwNH7taIDdsZM= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -339,35 +621,20 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= -github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= -github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -375,191 +642,127 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= -github.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk= -github.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y= -github.com/likexian/gokit v0.20.15/go.mod h1:kn+nTv3tqh6yhor9BC4Lfiu58SmH8NmQ2PmEl+uM6nU= -github.com/likexian/simplejson-go v0.0.0-20190409170913-40473a74d76d/go.mod h1:Typ1BfnATYtZ/+/shXfFYLrovhFyuKvzwrdOnIDHlmg= -github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U4O1vIJvIKwbMZKUJ62lppfdvkCdVd2nfMimHK81eec= -github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8= -github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20200615185753-c42b5136ff88/go.mod h1:a2HXwefeat3evJHxFXSayvRHpYEPJYtErl4uIzfaUqY= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw= -github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= -github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= +github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb/go.mod h1:OaY7UOoTkkrX3wRwjpYRKafIkkyeD0UtweSHAWWiqQM= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.0.4 h1:ZU1VNC02qyufSZsjjs7+khruk2fKvbQ3TwRV/IBCeFA= -github.com/mitchellh/go-testing-interface v1.0.4/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/panicwrap v1.0.0/go.mod h1:pKvZHwWrZowLUzftuFq7coarnxbBXU4aQh3N0BJOeeA= -github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= -github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/nav-inc/datetime v0.1.3 h1:PaybPUsScX+Cd3TEa1tYpfwU61deCEhMTlCO2hONm1c= github.com/nav-inc/datetime v0.1.3/go.mod h1:gKGf5G+cW7qkTo5TC/sieNyz6lYdrA9cf1PNV+pXIOE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= +github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openlyinc/pointy v1.1.2 h1:LywVV2BWC5Sp5v7FoP4bUD+2Yn5k0VNeRbU5vq9jUMY= -github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM= -github.com/outscale/osc-sdk-go/v2 v2.12.0 h1:N++txOT8CDR6+W6/Qc2L0kDHwdUZq62vbDVhkE8dOJo= -github.com/outscale/osc-sdk-go/v2 v2.12.0/go.mod h1:kzhtUErCzKYl87bZ+kDMphDafmnwbsyFJY9iHF7NgNE= -github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0= +github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0= +github.com/outscale/osc-sdk-go/v2 v2.15.0 h1:7WYoG1I/9X/PXTCUY5g9BvPGhXjGEA61DCBCM7nCMjU= +github.com/outscale/osc-sdk-go/v2 v2.15.0/go.mod h1:kzhtUErCzKYl87bZ+kDMphDafmnwbsyFJY9iHF7NgNE= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI= -github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw= -github.com/tencentcloud/tencentcloud-sdk-go v3.0.82+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= -github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c/go.mod h1:wk2XFUg6egk4tSDNZtXeKfe2G6690UVyt163PuUxBZk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tombuildsstuff/giovanni v0.12.0/go.mod h1:qJ5dpiYWkRsuOSXO8wHbee7+wElkLNfWVolcf59N84E= -github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= -github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= +github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= +github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc= +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.7.0/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o= -github.com/zclconf/go-cty v1.8.2 h1:u+xZfBKgpycDnTNjPhGiTEYZS5qS/Sb5MqSfm7vzcjg= -github.com/zclconf/go-cty v1.8.2/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= +github.com/zclconf/go-cty v1.12.1 h1:PcupnljUm9EIvbgSHQnHhUr3fO6oFmkOrvs2BAFNXXY= +github.com/zclconf/go-cty v1.12.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -github.com/zclconf/go-cty-yaml v1.0.2 h1:dNyg4QLTrv2IfJpm7Wtxi55ed5gLGOlPrZ6kMd51hY0= -github.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -581,8 +784,9 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -590,19 +794,16 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -612,9 +813,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -630,18 +829,59 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= +golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -651,32 +891,30 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -692,30 +930,74 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -735,7 +1017,6 @@ golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191203134012-c197fd4bf371/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -753,17 +1034,30 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb h1:KVWk3RW1AZlxWum4tYqegLgwJHb5oouozcGM8HfNQaw= -golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -780,15 +1074,49 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.34.0 h1:k40adF3uR+6x/+hO5Dh4ZFUqFp67vxvbpafFiJxl10A= -google.golang.org/api v0.34.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= +google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -813,14 +1141,93 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d h1:92D1fum1bJLKSdr11OJ+54YeCMCGYIygTA7R/YZxH5M= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= +google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa h1:qQPhfbPO23fwm/9lQr91L1u62Zo6cm+zI+slZT+uf+o= +google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -835,8 +1242,33 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -846,34 +1278,31 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -881,20 +1310,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A= -k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719/go.mod h1:I4A+glKBHiTgiEjQiCCQfCAIcIMFGt291SmsvcrFzJA= -k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4= -k8s.io/client-go v10.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= -k8s.io/utils v0.0.0-20200411171748-3d5a2fe318e4/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/main.go b/main.go index 99563f883..71d8137e2 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/hashicorp/terraform-plugin-sdk/plugin" + "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" "github.com/terraform-providers/terraform-provider-outscale/outscale" ) diff --git a/outscale/config.go b/outscale/config.go index 7676415a5..663772659 100644 --- a/outscale/config.go +++ b/outscale/config.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/hashicorp/terraform-plugin-sdk/helper/logging" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/version" ) diff --git a/outscale/data_source_outscale_access_key.go b/outscale/data_source_outscale_access_key.go index 12ec55f53..78a5066f4 100644 --- a/outscale/data_source_outscale_access_key.go +++ b/outscale/data_source_outscale_access_key.go @@ -7,11 +7,11 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func dataSourceOutscaleAccessKey() *schema.Resource { diff --git a/outscale/data_source_outscale_access_key_test.go b/outscale/data_source_outscale_access_key_test.go index 981ad247a..82915a281 100644 --- a/outscale/data_source_outscale_access_key_test.go +++ b/outscale/data_source_outscale_access_key_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleDataSourceAccessKey_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_access_keys.go b/outscale/data_source_outscale_access_keys.go index 6bf443c50..c94c324a8 100644 --- a/outscale/data_source_outscale_access_keys.go +++ b/outscale/data_source_outscale_access_keys.go @@ -6,11 +6,11 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func dataSourceOutscaleAccessKeys() *schema.Resource { diff --git a/outscale/data_source_outscale_access_keys_test.go b/outscale/data_source_outscale_access_keys_test.go index 170987e65..2ee4fefe1 100644 --- a/outscale/data_source_outscale_access_keys_test.go +++ b/outscale/data_source_outscale_access_keys_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleDataSourceAccessKeys_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_account.go b/outscale/data_source_outscale_account.go index a55ac81c9..2083d0043 100644 --- a/outscale/data_source_outscale_account.go +++ b/outscale/data_source_outscale_account.go @@ -7,8 +7,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_account_test.go b/outscale/data_source_outscale_account_test.go index c8e00de76..76f214469 100644 --- a/outscale/data_source_outscale_account_test.go +++ b/outscale/data_source_outscale_account_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAccount_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_accounts.go b/outscale/data_source_outscale_accounts.go index c0dd4d607..12be14402 100644 --- a/outscale/data_source_outscale_accounts.go +++ b/outscale/data_source_outscale_accounts.go @@ -7,8 +7,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_accounts_test.go b/outscale/data_source_outscale_accounts_test.go index fb0280344..63323dc6b 100644 --- a/outscale/data_source_outscale_accounts_test.go +++ b/outscale/data_source_outscale_accounts_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAccounts_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_api_access_policy.go b/outscale/data_source_outscale_api_access_policy.go index 0e7fbc7f5..e5682f303 100644 --- a/outscale/data_source_outscale_api_access_policy.go +++ b/outscale/data_source_outscale_api_access_policy.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_api_access_policy_test.go b/outscale/data_source_outscale_api_access_policy_test.go index 226d76e52..2df13984d 100644 --- a/outscale/data_source_outscale_api_access_policy_test.go +++ b/outscale/data_source_outscale_api_access_policy_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIApiAccessPolicy_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_api_access_rule.go b/outscale/data_source_outscale_api_access_rule.go index e49609863..64a96bd2a 100644 --- a/outscale/data_source_outscale_api_access_rule.go +++ b/outscale/data_source_outscale_api_access_rule.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_api_access_rule_test.go b/outscale/data_source_outscale_api_access_rule_test.go index 31c92ac21..493118479 100644 --- a/outscale/data_source_outscale_api_access_rule_test.go +++ b/outscale/data_source_outscale_api_access_rule_test.go @@ -6,11 +6,10 @@ import ( "testing" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccDataOutscaleOAPIApiAccessRule_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_api_access_rules.go b/outscale/data_source_outscale_api_access_rules.go index 315803fd3..eb9f3a020 100644 --- a/outscale/data_source_outscale_api_access_rules.go +++ b/outscale/data_source_outscale_api_access_rules.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_api_access_rules_test.go b/outscale/data_source_outscale_api_access_rules_test.go index ad43ba1be..4776168b5 100644 --- a/outscale/data_source_outscale_api_access_rules_test.go +++ b/outscale/data_source_outscale_api_access_rules_test.go @@ -6,11 +6,10 @@ import ( "testing" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccDataOutscaleOAPIApiAccessRules_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_ca.go b/outscale/data_source_outscale_ca.go index 8ae3f8da1..204db2d38 100644 --- a/outscale/data_source_outscale_ca.go +++ b/outscale/data_source_outscale_ca.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_ca_test.go b/outscale/data_source_outscale_ca_test.go index 96b39a53c..6f7b40182 100644 --- a/outscale/data_source_outscale_ca_test.go +++ b/outscale/data_source_outscale_ca_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_cas.go b/outscale/data_source_outscale_cas.go index 405cb13aa..f26599a69 100644 --- a/outscale/data_source_outscale_cas.go +++ b/outscale/data_source_outscale_cas.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_cas_test.go b/outscale/data_source_outscale_cas_test.go index 316f7f987..74b60a61f 100644 --- a/outscale/data_source_outscale_cas_test.go +++ b/outscale/data_source_outscale_cas_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_client_gateway.go b/outscale/data_source_outscale_client_gateway.go index 11be0d1fe..447fa587f 100644 --- a/outscale/data_source_outscale_client_gateway.go +++ b/outscale/data_source_outscale_client_gateway.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_client_gateway_test.go b/outscale/data_source_outscale_client_gateway_test.go index c4801504f..d4b1d80e1 100644 --- a/outscale/data_source_outscale_client_gateway_test.go +++ b/outscale/data_source_outscale_client_gateway_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_client_gateways.go b/outscale/data_source_outscale_client_gateways.go index c0899986e..8931956db 100644 --- a/outscale/data_source_outscale_client_gateways.go +++ b/outscale/data_source_outscale_client_gateways.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleClientGateways() *schema.Resource { diff --git a/outscale/data_source_outscale_client_gateways_test.go b/outscale/data_source_outscale_client_gateways_test.go index 59175acb2..605450b57 100644 --- a/outscale/data_source_outscale_client_gateways_test.go +++ b/outscale/data_source_outscale_client_gateways_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleClientGatewaysDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_dhcp_option.go b/outscale/data_source_outscale_dhcp_option.go index 78c167a1a..242f8dfeb 100644 --- a/outscale/data_source_outscale_dhcp_option.go +++ b/outscale/data_source_outscale_dhcp_option.go @@ -6,11 +6,10 @@ import ( "log" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_dhcp_option_test.go b/outscale/data_source_outscale_dhcp_option_test.go index 996de273c..2d9e20d93 100644 --- a/outscale/data_source_outscale_dhcp_option_test.go +++ b/outscale/data_source_outscale_dhcp_option_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleDHCPOption_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_dhcp_options.go b/outscale/data_source_outscale_dhcp_options.go index 72292a8fb..bf6805fab 100644 --- a/outscale/data_source_outscale_dhcp_options.go +++ b/outscale/data_source_outscale_dhcp_options.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleDHCPOptions() *schema.Resource { diff --git a/outscale/data_source_outscale_dhcp_options_test.go b/outscale/data_source_outscale_dhcp_options_test.go index c90d9022c..929e14264 100644 --- a/outscale/data_source_outscale_dhcp_options_test.go +++ b/outscale/data_source_outscale_dhcp_options_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleDHCPOptionsDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_flexible_gpu.go b/outscale/data_source_outscale_flexible_gpu.go index 165d2f3ad..70892b46f 100644 --- a/outscale/data_source_outscale_flexible_gpu.go +++ b/outscale/data_source_outscale_flexible_gpu.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_flexible_gpu_catalog.go b/outscale/data_source_outscale_flexible_gpu_catalog.go index ef6361089..d1692ccc7 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog.go @@ -5,10 +5,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIFlexibleGpuCatalog() *schema.Resource { diff --git a/outscale/data_source_outscale_flexible_gpu_catalog_test.go b/outscale/data_source_outscale_flexible_gpu_catalog_test.go index bd6a138ee..3dbd40487 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog_test.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIFlexibleGpuCatalog_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_flexible_gpu_test.go b/outscale/data_source_outscale_flexible_gpu_test.go index 9ed6ee97d..0c1390104 100644 --- a/outscale/data_source_outscale_flexible_gpu_test.go +++ b/outscale/data_source_outscale_flexible_gpu_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIFlexibleGpu_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_flexible_gpus.go b/outscale/data_source_outscale_flexible_gpus.go index b19e22058..fd183c948 100644 --- a/outscale/data_source_outscale_flexible_gpus.go +++ b/outscale/data_source_outscale_flexible_gpus.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIFlexibleGpus() *schema.Resource { diff --git a/outscale/data_source_outscale_flexible_gpus_test.go b/outscale/data_source_outscale_flexible_gpus_test.go index 9cd09dcc6..a325db959 100644 --- a/outscale/data_source_outscale_flexible_gpus_test.go +++ b/outscale/data_source_outscale_flexible_gpus_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIFlexibleGpus_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_image.go b/outscale/data_source_outscale_image.go index a035b7f74..20d3c70b5 100644 --- a/outscale/data_source_outscale_image.go +++ b/outscale/data_source_outscale_image.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIImage() *schema.Resource { diff --git a/outscale/data_source_outscale_image_export_task.go b/outscale/data_source_outscale_image_export_task.go index a7ba40ac9..717405b27 100644 --- a/outscale/data_source_outscale_image_export_task.go +++ b/outscale/data_source_outscale_image_export_task.go @@ -8,10 +8,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIImageExportTask() *schema.Resource { diff --git a/outscale/data_source_outscale_image_export_task_test.go b/outscale/data_source_outscale_image_export_task_test.go index 2c56b61fc..a5205286f 100644 --- a/outscale/data_source_outscale_image_export_task_test.go +++ b/outscale/data_source_outscale_image_export_task_test.go @@ -5,10 +5,10 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIImageExportTaskDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_image_export_tasks.go b/outscale/data_source_outscale_image_export_tasks.go index f97c13836..9f0ba2de2 100644 --- a/outscale/data_source_outscale_image_export_tasks.go +++ b/outscale/data_source_outscale_image_export_tasks.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIImageExportTasks() *schema.Resource { diff --git a/outscale/data_source_outscale_image_export_tasks_test.go b/outscale/data_source_outscale_image_export_tasks_test.go index baee706e0..1e9bbd081 100644 --- a/outscale/data_source_outscale_image_export_tasks_test.go +++ b/outscale/data_source_outscale_image_export_tasks_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIImageExportTasksDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_image_test.go b/outscale/data_source_outscale_image_test.go index 6d14b2437..5d542f09d 100644 --- a/outscale/data_source_outscale_image_test.go +++ b/outscale/data_source_outscale_image_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIImageDataSource_Instance(t *testing.T) { diff --git a/outscale/data_source_outscale_images.go b/outscale/data_source_outscale_images.go index 895311f84..f2afc57ab 100644 --- a/outscale/data_source_outscale_images.go +++ b/outscale/data_source_outscale_images.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_images_test.go b/outscale/data_source_outscale_images_test.go index ef9fb081f..9f3c34a95 100644 --- a/outscale/data_source_outscale_images_test.go +++ b/outscale/data_source_outscale_images_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIImagesDataSource_Instance(t *testing.T) { diff --git a/outscale/data_source_outscale_internet_service.go b/outscale/data_source_outscale_internet_service.go index 0da67cbc7..8c5f0e64a 100644 --- a/outscale/data_source_outscale_internet_service.go +++ b/outscale/data_source_outscale_internet_service.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOAPIInternetService() *schema.Resource { diff --git a/outscale/data_source_outscale_internet_service_test.go b/outscale/data_source_outscale_internet_service_test.go index e06aa905b..08423cebc 100644 --- a/outscale/data_source_outscale_internet_service_test.go +++ b/outscale/data_source_outscale_internet_service_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIInternetServiceDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_internet_services.go b/outscale/data_source_outscale_internet_services.go index d50b3e692..e5de60f6d 100644 --- a/outscale/data_source_outscale_internet_services.go +++ b/outscale/data_source_outscale_internet_services.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOAPIInternetServices() *schema.Resource { diff --git a/outscale/data_source_outscale_internet_services_test.go b/outscale/data_source_outscale_internet_services_test.go index 0f77a91cf..37ca191dc 100644 --- a/outscale/data_source_outscale_internet_services_test.go +++ b/outscale/data_source_outscale_internet_services_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIInternetServicesDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_keypair.go b/outscale/data_source_outscale_keypair.go index 33e1d1e48..0cd0d5ff4 100644 --- a/outscale/data_source_outscale_keypair.go +++ b/outscale/data_source_outscale_keypair.go @@ -8,10 +8,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) error { diff --git a/outscale/data_source_outscale_keypair_test.go b/outscale/data_source_outscale_keypair_test.go index 73bec91e6..eb7c0f409 100644 --- a/outscale/data_source_outscale_keypair_test.go +++ b/outscale/data_source_outscale_keypair_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_keypairs.go b/outscale/data_source_outscale_keypairs.go index 5130319ce..275d35aad 100644 --- a/outscale/data_source_outscale_keypairs.go +++ b/outscale/data_source_outscale_keypairs.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{}) error { diff --git a/outscale/data_source_outscale_keypairs_test.go b/outscale/data_source_outscale_keypairs_test.go index 4a9c7c385..1d0457bda 100644 --- a/outscale/data_source_outscale_keypairs_test.go +++ b/outscale/data_source_outscale_keypairs_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_load_balancer.go b/outscale/data_source_outscale_load_balancer.go index 0f3ee1b9a..4fee3c09c 100644 --- a/outscale/data_source_outscale_load_balancer.go +++ b/outscale/data_source_outscale_load_balancer.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -51,7 +51,7 @@ func attrLBchema() map[string]*schema.Schema { Optional: true, }, "access_log": { - Type: schema.TypeMap, + Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Resource{ @@ -76,29 +76,37 @@ func attrLBchema() map[string]*schema.Schema { }, }, "health_check": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "healthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "unhealthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, - "checked_vm": { + "path": { Type: schema.TypeString, Computed: true, }, "check_interval": { + Type: schema.TypeInt, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "protocol": { Type: schema.TypeString, Computed: true, }, "timeout": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, }, @@ -337,16 +345,16 @@ func dataSourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interfa } else { d.Set("security_groups", make([]map[string]interface{}, 0)) } - ssg := make(map[string]string) + if lb.SourceSecurityGroup != nil { - ssg["security_group_account_id"] = *lb.SourceSecurityGroup.SecurityGroupAccountId - ssg["security_group_name"] = *lb.SourceSecurityGroup.SecurityGroupName + d.Set("source_security_group", flattenSource_sg(lb.SourceSecurityGroup)) + } else { + d.Set("source_security_group", make([]map[string]interface{}, 0)) } d.Set("public_ip", lb.PublicIp) d.Set("secured_cookies", lb.SecuredCookies) d.Set("net_id", lb.NetId) - d.Set("source_security_group", ssg) d.Set("subnets", utils.StringSlicePtrToInterfaceSlice(lb.Subnets)) d.SetId(*lb.LoadBalancerName) diff --git a/outscale/data_source_outscale_load_balancer_listener_rule.go b/outscale/data_source_outscale_load_balancer_listener_rule.go index 317c6de0a..72e79f2a8 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rule.go +++ b/outscale/data_source_outscale_load_balancer_listener_rule.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func attrLBListenerRule() map[string]*schema.Schema { diff --git a/outscale/data_source_outscale_load_balancer_listener_rules.go b/outscale/data_source_outscale_load_balancer_listener_rules.go index 8facece4f..d14ce14bd 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rules.go +++ b/outscale/data_source_outscale_load_balancer_listener_rules.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func attrLBListenerRules() map[string]*schema.Schema { diff --git a/outscale/data_source_outscale_load_balancer_tags.go b/outscale/data_source_outscale_load_balancer_tags.go index 39513bb3b..bdac20873 100644 --- a/outscale/data_source_outscale_load_balancer_tags.go +++ b/outscale/data_source_outscale_load_balancer_tags.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPILBUTags() *schema.Resource { diff --git a/outscale/data_source_outscale_load_balancer_tags_test.go b/outscale/data_source_outscale_load_balancer_tags_test.go index a80544afb..83b7a8242 100644 --- a/outscale/data_source_outscale_load_balancer_tags_test.go +++ b/outscale/data_source_outscale_load_balancer_tags_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIDSLoadBalancerTags_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_load_balancer_test.go b/outscale/data_source_outscale_load_balancer_test.go index 73b5c7d9c..ebfcf19f4 100644 --- a/outscale/data_source_outscale_load_balancer_test.go +++ b/outscale/data_source_outscale_load_balancer_test.go @@ -7,7 +7,7 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIDSLBU_basic(t *testing.T) { @@ -27,11 +27,11 @@ func TestAccOutscaleOAPIDSLBU_basic(t *testing.T) { { Config: testAccDSOutscaleOAPILBUConfig(zone), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.bar", &conf), + testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.dataLb", &conf), resource.TestCheckResourceAttr( - "data.outscale_load_balancer.test", "subregion_names.#", "1"), + "data.outscale_load_balancer.dataTest", "subregion_names.#", "1"), resource.TestCheckResourceAttr( - "data.outscale_load_balancer.test", "subregion_names.0", zone), + "data.outscale_load_balancer.dataTest", "subregion_names.0", zone), )}, }, }) @@ -39,25 +39,25 @@ func TestAccOutscaleOAPIDSLBU_basic(t *testing.T) { func testAccDSOutscaleOAPILBUConfig(zone string) string { return fmt.Sprintf(` - resource "outscale_load_balancer" "bar" { + resource "outscale_load_balancer" "dataLb" { subregion_names = ["%s"] - load_balancer_name = "foobar-terraform-elb" + load_balancer_name = "data-terraform-elb" listeners { backend_port = 8000 backend_protocol = "HTTP" - load_balancer_port = 80 + load_balancer_port = 80 load_balancer_protocol = "HTTP" } tags { - key = "name" + key = "name" value = "baz" } } - data "outscale_load_balancer" "test" { - load_balancer_name = outscale_load_balancer.bar.id + data "outscale_load_balancer" "dataTest" { + load_balancer_name = outscale_load_balancer.dataLb.id } `, zone) } diff --git a/outscale/data_source_outscale_load_balancer_vm_health.go b/outscale/data_source_outscale_load_balancer_vm_health.go index e471abe7c..591affde8 100644 --- a/outscale/data_source_outscale_load_balancer_vm_health.go +++ b/outscale/data_source_outscale_load_balancer_vm_health.go @@ -9,10 +9,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleLoadBalancerVmsHeals() *schema.Resource { diff --git a/outscale/data_source_outscale_load_balancer_vms.go b/outscale/data_source_outscale_load_balancer_vms.go index 333ce6b6e..647f340d3 100644 --- a/outscale/data_source_outscale_load_balancer_vms.go +++ b/outscale/data_source_outscale_load_balancer_vms.go @@ -1,7 +1,7 @@ package outscale import ( - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_load_balancers.go b/outscale/data_source_outscale_load_balancers.go index 898dfb588..5a5b34540 100644 --- a/outscale/data_source_outscale_load_balancers.go +++ b/outscale/data_source_outscale_load_balancers.go @@ -1,8 +1,8 @@ package outscale import ( - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -32,7 +32,7 @@ func attrLBSchema() map[string]*schema.Schema { Computed: true, }, "access_log": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -56,24 +56,24 @@ func attrLBSchema() map[string]*schema.Schema { }, }, "health_check": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "healthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "unhealthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, - "checked_vm": { + "path": { Type: schema.TypeString, Computed: true, }, "check_interval": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "port": { @@ -85,7 +85,7 @@ func attrLBSchema() map[string]*schema.Schema { Computed: true, }, "timeout": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, }, @@ -149,7 +149,7 @@ func attrLBSchema() map[string]*schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, }, "source_security_group": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -267,13 +267,14 @@ func dataSourceOutscaleOAPILoadBalancersRead(d *schema.ResourceData, meta interf l["load_balancer_type"] = v.LoadBalancerType l["security_groups"] = utils.StringSlicePtrToInterfaceSlice(v.SecurityGroups) - ssg := make(map[string]string) + ssg := make([]map[string]interface{}, 0) if v.SourceSecurityGroup != nil { - ssg["security_group_account_id"] = *v.SourceSecurityGroup.SecurityGroupAccountId - ssg["security_group_name"] = *v.SourceSecurityGroup.SecurityGroupName + l["source_security_group"] = flattenSource_sg(v.SourceSecurityGroup) + } else { + l["source_security_group"] = ssg + } - l["source_security_group"] = ssg l["subnet_id"] = utils.StringSlicePtrToInterfaceSlice(v.Subnets) l["public_ip"] = v.PublicIp l["secured_cookies"] = v.SecuredCookies diff --git a/outscale/data_source_outscale_load_balancers_test.go b/outscale/data_source_outscale_load_balancers_test.go index 958eeafdc..2b9ca6abf 100644 --- a/outscale/data_source_outscale_load_balancers_test.go +++ b/outscale/data_source_outscale_load_balancers_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_nat_service.go b/outscale/data_source_outscale_nat_service.go index 8a1031b52..27ee999d7 100644 --- a/outscale/data_source_outscale_nat_service.go +++ b/outscale/data_source_outscale_nat_service.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPINatService() *schema.Resource { diff --git a/outscale/data_source_outscale_nat_service_test.go b/outscale/data_source_outscale_nat_service_test.go index f07f24add..722ec520f 100644 --- a/outscale/data_source_outscale_nat_service_test.go +++ b/outscale/data_source_outscale_nat_service_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPINatServiceDataSource_Instance(t *testing.T) { diff --git a/outscale/data_source_outscale_nat_services.go b/outscale/data_source_outscale_nat_services.go index e6f840b3a..fcefe4fdc 100644 --- a/outscale/data_source_outscale_nat_services.go +++ b/outscale/data_source_outscale_nat_services.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPINatServices() *schema.Resource { diff --git a/outscale/data_source_outscale_nat_services_test.go b/outscale/data_source_outscale_nat_services_test.go index b14a6813b..7f5490c8f 100644 --- a/outscale/data_source_outscale_nat_services_test.go +++ b/outscale/data_source_outscale_nat_services_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPINatServicesDataSource_Instance(t *testing.T) { diff --git a/outscale/data_source_outscale_net.go b/outscale/data_source_outscale_net.go index 3711da381..b00d486e5 100644 --- a/outscale/data_source_outscale_net.go +++ b/outscale/data_source_outscale_net.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVpc() *schema.Resource { diff --git a/outscale/data_source_outscale_net_access_point.go b/outscale/data_source_outscale_net_access_point.go index 39c3ff11f..fb5dd815f 100644 --- a/outscale/data_source_outscale_net_access_point.go +++ b/outscale/data_source_outscale_net_access_point.go @@ -7,8 +7,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_net_access_point_services.go b/outscale/data_source_outscale_net_access_point_services.go index f782e4114..006768976 100644 --- a/outscale/data_source_outscale_net_access_point_services.go +++ b/outscale/data_source_outscale_net_access_point_services.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPINetAccessPointServices() *schema.Resource { 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 a98790727..f75f4d153 100644 --- a/outscale/data_source_outscale_net_access_point_services_test.go +++ b/outscale/data_source_outscale_net_access_point_services_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPINetAccessPointServices_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_net_access_point_test.go b/outscale/data_source_outscale_net_access_point_test.go index 94e64510d..c716cf3ef 100644 --- a/outscale/data_source_outscale_net_access_point_test.go +++ b/outscale/data_source_outscale_net_access_point_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPINetAccessPoint_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_net_access_points.go b/outscale/data_source_outscale_net_access_points.go index ac47695c8..b8e7d466e 100644 --- a/outscale/data_source_outscale_net_access_points.go +++ b/outscale/data_source_outscale_net_access_points.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func napSchema() map[string]*schema.Schema { diff --git a/outscale/data_source_outscale_net_access_points_test.go b/outscale/data_source_outscale_net_access_points_test.go index 71e166f3c..e2e2bf5f8 100644 --- a/outscale/data_source_outscale_net_access_points_test.go +++ b/outscale/data_source_outscale_net_access_points_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPINetAccessPoints_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_net_attributes.go b/outscale/data_source_outscale_net_attributes.go index 9e77ec12a..98dde5073 100644 --- a/outscale/data_source_outscale_net_attributes.go +++ b/outscale/data_source_outscale_net_attributes.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVpcAttr() *schema.Resource { diff --git a/outscale/data_source_outscale_net_attributes_test.go b/outscale/data_source_outscale_net_attributes_test.go index db3204bf6..a84568991 100644 --- a/outscale/data_source_outscale_net_attributes_test.go +++ b/outscale/data_source_outscale_net_attributes_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIDSLinAttr_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_net_peering.go b/outscale/data_source_outscale_net_peering.go index 26f1c588d..1ffcb21e9 100644 --- a/outscale/data_source_outscale_net_peering.go +++ b/outscale/data_source_outscale_net_peering.go @@ -8,12 +8,11 @@ import ( "reflect" "time" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { @@ -29,7 +28,7 @@ func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { }, "source_net": vpcOAPIPeeringConnectionOptionsSchema(), "state": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -113,33 +112,21 @@ func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta log.Printf("[DEBUG] Net Peering Connection Source %s, Accepter %s", netPeering.SourceNet.GetAccountId(), netPeering.AccepterNet.GetAccountId()) - accepter := make(map[string]interface{}) - requester := make(map[string]interface{}) - stat := make(map[string]interface{}) - if !reflect.DeepEqual(netPeering.GetAccepterNet(), oscgo.AccepterNet{}) { - accepter["ip_range"] = netPeering.AccepterNet.GetIpRange() - accepter["account_id"] = netPeering.AccepterNet.GetAccountId() - accepter["net_id"] = netPeering.AccepterNet.GetNetId() + if err := d.Set("accepter_net", getOAPINetPeeringAccepterNet(*netPeering.AccepterNet)); err != nil { + return err + } } + if !reflect.DeepEqual(netPeering.SourceNet, oscgo.SourceNet{}) { - requester["ip_range"] = netPeering.SourceNet.GetIpRange() - requester["account_id"] = netPeering.SourceNet.GetAccountId() - requester["net_id"] = netPeering.SourceNet.GetNetId() + if err := d.Set("source_net", getOAPINetPeeringSourceNet(*netPeering.SourceNet)); err != nil { + return err + } } if netPeering.State.GetName() != "" { - stat["name"] = netPeering.State.GetName() - stat["message"] = netPeering.State.GetMessage() - } - - if err := d.Set("accepter_net", accepter); err != nil { - return err - } - if err := d.Set("source_net", requester); err != nil { - return err - } - if err := d.Set("state", stat); err != nil { - return err + if err := d.Set("state", getOAPINetPeeringState(netPeering.GetState())); err != nil { + return err + } } if err := d.Set("net_peering_id", netPeering.GetNetPeeringId()); err != nil { return err diff --git a/outscale/data_source_outscale_net_peering_test.go b/outscale/data_source_outscale_net_peering_test.go index 76388baeb..2ccdfd23a 100644 --- a/outscale/data_source_outscale_net_peering_test.go +++ b/outscale/data_source_outscale_net_peering_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPILinPeeringConnection_basic(t *testing.T) { @@ -68,14 +68,14 @@ const testAccDataSourceOutscaleOAPILinPeeringConnectionConfig = ` } resource "outscale_net_peering" "net_peering" { - accepter_net_id = "${outscale_net.net.net_id}" - source_net_id = "${outscale_net.net2.net_id}" + accepter_net_id = outscale_net.net.net_id + source_net_id = outscale_net.net2.net_id } data "outscale_net_peering" "net_peering_data" { filter { name = "net_peering_ids" - values = ["${outscale_net_peering.net_peering.net_peering_id}"] + values = [outscale_net_peering.net_peering.net_peering_id] } } ` diff --git a/outscale/data_source_outscale_net_peerings.go b/outscale/data_source_outscale_net_peerings.go index f4803e3ed..8da1774b1 100644 --- a/outscale/data_source_outscale_net_peerings.go +++ b/outscale/data_source_outscale_net_peerings.go @@ -4,13 +4,14 @@ import ( "context" "fmt" "log" + "reflect" "time" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { @@ -31,11 +32,11 @@ func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { }, "source_net": vpcOAPIPeeringConnectionOptionsSchema(), "state": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "code": { + "name": { Type: schema.TypeString, Computed: true, }, @@ -85,56 +86,67 @@ func dataSourceOutscaleOAPILinPeeringsConnectionRead(d *schema.ResourceData, met if err != nil { return fmt.Errorf("Error reading the Net Peerings %s", err) } + peerings := resp.GetNetPeerings() - if resp.GetNetPeerings() == nil || len(resp.GetNetPeerings()) == 0 { + if peerings == nil || len(peerings) == 0 { return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") } - - peerings := resp.GetNetPeerings() - return resourceDataAttrSetter(d, func(set AttributeSetter) error { d.SetId(resource.UniqueId()) - if err := set("net_peerings", getOAPINetPeerings(peerings)); err != nil { - log.Printf("[DEBUG] Net Peerings ERR %+v", err) + if err := set("net_peerings", setNetPeeringsAttributtes(peerings)); err != nil { return err } return nil }) } -func getOAPINetPeerings(peerings []oscgo.NetPeering) (res []map[string]interface{}) { +func setNetPeeringsAttributtes(peerings []oscgo.NetPeering) (res []map[string]interface{}) { + for _, p := range peerings { - res = append(res, map[string]interface{}{ - "accepter_net": getOAPINetPeeringAccepterNet(p.GetAccepterNet()), + netP := map[string]interface{}{ "net_peering_id": p.GetNetPeeringId(), - "source_net": getOAPINetPeeringSourceNet(p.GetSourceNet()), - "state": getOAPINetPeeringState(p.GetState()), - //"tags": getOapiTagSet(p.Tags), - }) + } + if p.HasAccepterNet() { + if !reflect.DeepEqual(p.GetAccepterNet(), oscgo.AccepterNet{}) { + netP["accepter_net"] = getOAPINetPeeringAccepterNet(p.GetAccepterNet()) + } + } + if p.HasSourceNet() { + if !reflect.DeepEqual(p.GetSourceNet(), oscgo.SourceNet{}) { + netP["source_net"] = getOAPINetPeeringSourceNet(p.GetSourceNet()) + } + } + if p.HasState() { + netP["state"] = getOAPINetPeeringState(p.GetState()) + } + if p.HasTags() { + netP["tags"] = getOapiTagSet(p.Tags) + } + res = append(res, netP) } - return res + return } -func getOAPINetPeeringAccepterNet(a oscgo.AccepterNet) map[string]interface{} { - return map[string]interface{}{ +func getOAPINetPeeringAccepterNet(a oscgo.AccepterNet) []map[string]interface{} { + return []map[string]interface{}{{ "ip_range": a.GetIpRange(), "account_id": a.GetAccountId(), "net_id": a.GetNetId(), - } + }} } -func getOAPINetPeeringSourceNet(a oscgo.SourceNet) map[string]interface{} { - return map[string]interface{}{ +func getOAPINetPeeringSourceNet(a oscgo.SourceNet) []map[string]interface{} { + return []map[string]interface{}{{ "ip_range": a.GetIpRange(), "account_id": a.GetAccountId(), "net_id": a.GetNetId(), - } + }} } -func getOAPINetPeeringState(a oscgo.NetPeeringState) map[string]interface{} { - return map[string]interface{}{ - "name": a.Name, - "message": a.Message, - } +func getOAPINetPeeringState(a oscgo.NetPeeringState) []map[string]interface{} { + return []map[string]interface{}{{ + "name": a.GetName(), + "message": a.GetMessage(), + }} } diff --git a/outscale/data_source_outscale_net_peerings_test.go b/outscale/data_source_outscale_net_peerings_test.go index a01e34f98..3dd12410d 100644 --- a/outscale/data_source_outscale_net_peerings_test.go +++ b/outscale/data_source_outscale_net_peerings_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPILinPeeringsConnection_basic(t *testing.T) { @@ -42,6 +42,11 @@ const testAccDataSourceOutscaleOAPILinPeeringsConnectionConfig = ` resource "outscale_net_peering" "outscale_net_peering" { accepter_net_id = "${outscale_net.outscale_net.net_id}" source_net_id = "${outscale_net.outscale_net2.net_id}" + tags { + key = "okht" + value = "testacc-peerings-ds" + } + } resource "outscale_net_peering" "outscale_net_peering2" { diff --git a/outscale/data_source_outscale_net_test.go b/outscale/data_source_outscale_net_test.go index 5273083fb..187a74398 100644 --- a/outscale/data_source_outscale_net_test.go +++ b/outscale/data_source_outscale_net_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_nets.go b/outscale/data_source_outscale_nets.go index f9d25c6f4..eb83186d7 100644 --- a/outscale/data_source_outscale_nets.go +++ b/outscale/data_source_outscale_nets.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVpcs() *schema.Resource { diff --git a/outscale/data_source_outscale_nets_test.go b/outscale/data_source_outscale_nets_test.go index d726a6b12..3dce335d9 100644 --- a/outscale/data_source_outscale_nets_test.go +++ b/outscale/data_source_outscale_nets_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_nic.go b/outscale/data_source_outscale_nic.go index 7ac511e96..7f38280e1 100644 --- a/outscale/data_source_outscale_nic.go +++ b/outscale/data_source_outscale_nic.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -27,7 +27,6 @@ func dataSourceOutscaleOAPINic() *schema.Resource { // Argument "nic_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, @@ -51,7 +50,7 @@ func dataSourceOutscaleOAPINic() *schema.Resource { }, // Attributes "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -75,7 +74,7 @@ func dataSourceOutscaleOAPINic() *schema.Resource { }, }, "link_nic": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -146,7 +145,7 @@ func dataSourceOutscaleOAPINic() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -217,21 +216,13 @@ func dataSourceOutscaleOAPINic() *schema.Resource { func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - nicID, okID := d.GetOk("nic_id") filters, okFilters := d.GetOk("filter") - if okID && okFilters { - return errors.New("nic_id and filter set") + if !okFilters { + return errors.New("filters must be assigned") } dnri := oscgo.ReadNicsRequest{} - - if okID { - dnri.Filters = &oscgo.FiltersNic{ - NicIds: &[]string{nicID.(string)}, - } - } - if okFilters { dnri.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) } @@ -250,7 +241,6 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err }) if err != nil { - return fmt.Errorf("Error describing Network Interfaces : %s", err) } @@ -262,7 +252,6 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err } return fmt.Errorf("Error retrieving ENI: %s", err) } - if err := utils.IsResponseEmptyOrMutiple(len(resp.GetNics()), "Nic"); err != nil { return err } @@ -281,33 +270,16 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err if err := d.Set("subnet_id", eni.GetSubnetId()); err != nil { return err } - - b := make(map[string]interface{}) - - link := eni.GetLinkPublicIp() - b["public_ip_id"] = link.GetPublicIpId() - b["link_public_ip_id"] = link.GetLinkPublicIpId() - b["public_ip_account_id"] = link.GetPublicIpAccountId() - b["public_dns_name"] = link.GetPublicDnsName() - b["public_ip"] = link.GetPublicIp() - - if err := d.Set("link_public_ip", b); err != nil { - return err + if linkIp, ok := eni.GetLinkPublicIpOk(); ok { + if err := d.Set("link_public_ip", flattenLinkPublicIp(linkIp)); err != nil { + return err + } } - bb := make(map[string]interface{}) - - linkNic := eni.GetLinkNic() - - bb["link_nic_id"] = linkNic.GetLinkNicId() - bb["delete_on_vm_deletion"] = fmt.Sprintf("%t", linkNic.GetDeleteOnVmDeletion()) - bb["device_number"] = fmt.Sprintf("%d", linkNic.GetDeviceNumber()) - bb["vm_id"] = linkNic.GetVmId() - bb["vm_account_id"] = linkNic.GetVmAccountId() - bb["state"] = linkNic.GetState() - - if err := d.Set("link_nic", bb); err != nil { - return err + if linkNic, ok := eni.GetLinkNicOk(); ok { + if err := d.Set("link_nic", flattenLinkNic(linkNic)); err != nil { + return err + } } if err := d.Set("subregion_name", eni.GetSubregionName()); err != nil { @@ -321,7 +293,6 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err b["security_group_name"] = v.GetSecurityGroupName() x[k] = b } - if err := d.Set("security_groups", x); err != nil { return err } @@ -343,23 +314,22 @@ func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) err if eni.PrivateIps != nil { for k, v := range eni.GetPrivateIps() { b := make(map[string]interface{}) - - d := make(map[string]interface{}) - assoc := v.GetLinkPublicIp() - d["public_ip_id"] = assoc.GetPublicIpId() - d["link_public_ip_id"] = assoc.GetLinkPublicIpId() - d["public_ip_account_id"] = assoc.GetPublicIpAccountId() - d["public_dns_name"] = assoc.GetPublicDnsName() - d["public_ip"] = assoc.GetPublicIp() - - b["link_public_ip"] = d + if assoc, ok := v.GetLinkPublicIpOk(); ok { + d := make(map[string]interface{}) + d["public_ip_id"] = assoc.GetPublicIpId() + d["link_public_ip_id"] = assoc.GetLinkPublicIpId() + d["public_ip_account_id"] = assoc.GetPublicIpAccountId() + d["public_dns_name"] = assoc.GetPublicDnsName() + d["public_ip"] = assoc.GetPublicIp() + b["link_public_ip"] = d + } b["private_dns_name"] = v.GetPrivateDnsName() b["private_ip"] = v.GetPrivateIp() b["is_primary"] = v.GetIsPrimary() - y[k] = b } } + if err := d.Set("private_ips", y); err != nil { return err } diff --git a/outscale/data_source_outscale_nic_test.go b/outscale/data_source_outscale_nic_test.go index 541d815e9..570abaa1a 100644 --- a/outscale/data_source_outscale_nic_test.go +++ b/outscale/data_source_outscale_nic_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIENIDataSource_basic(t *testing.T) { @@ -150,11 +150,11 @@ func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { resource "outscale_subnet" "outscale_subnet" { subregion_name = "%sa" ip_range = "10.0.0.0/16" - net_id = "${outscale_net.outscale_net.id}" + net_id = outscale_net.outscale_net.id } resource "outscale_nic" "outscale_nic" { - subnet_id = "${outscale_subnet.outscale_subnet.id}" + subnet_id = outscale_subnet.outscale_subnet.id tags { value = "tf-value" key = "tf-key" @@ -162,7 +162,10 @@ func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { } data "outscale_nic" "outscale_nic" { - nic_id = "${outscale_nic.outscale_nic.id}" + filter { + name = "nic_ids" + values = [outscale_nic.outscale_nic.nic_id] + } } `, subregion) } @@ -180,11 +183,11 @@ const testAccOutscaleOAPIENIDataSourceConfigFilter = ` resource "outscale_subnet" "outscale_subnet" { subregion_name = "eu-west-2a" ip_range = "10.0.0.0/16" - net_id = "${outscale_net.outscale_net.id}" + net_id = outscale_net.outscale_net.id } resource "outscale_nic" "outscale_nic" { - subnet_id = "${outscale_subnet.outscale_subnet.id}" + subnet_id = outscale_subnet.outscale_subnet.id tags { value = "tf-value" key = "tf-key" @@ -194,7 +197,7 @@ const testAccOutscaleOAPIENIDataSourceConfigFilter = ` data "outscale_nic" "outscale_nic" { filter { name = "nic_ids" - values = ["${outscale_nic.outscale_nic.nic_id}"] + values = [outscale_nic.outscale_nic.nic_id] } - } + } ` diff --git a/outscale/data_source_outscale_nics.go b/outscale/data_source_outscale_nics.go index 96c6a9f9d..36fcef8d7 100644 --- a/outscale/data_source_outscale_nics.go +++ b/outscale/data_source_outscale_nics.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) // Creates a network interface in the specified subnet @@ -42,7 +42,7 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { Computed: true, }, "link_nic": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -74,7 +74,7 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { }, }, "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -127,7 +127,7 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { Computed: true, }, "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -195,18 +195,15 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { }, "tags": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, - Optional: true, Computed: true, }, "value": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -226,9 +223,6 @@ func dataSourceOutscaleOAPINicsRead(d *schema.ResourceData, meta interface{}) er conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("filters, or owner must be assigned, or nic_id must be provided") - } params := oscgo.ReadNicsRequest{} if filtersOk { @@ -258,7 +252,6 @@ func dataSourceOutscaleOAPINicsRead(d *schema.ResourceData, meta interface{}) er if len(resp.GetNics()) == 0 { return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") } - nics := resp.GetNics() return resourceDataAttrSetter(d, func(set AttributeSetter) error { @@ -267,7 +260,6 @@ func dataSourceOutscaleOAPINicsRead(d *schema.ResourceData, meta interface{}) er if err := set("nics", getOAPIVMNetworkInterfaceSet(nics)); err != nil { return err } - return nil }) } diff --git a/outscale/data_source_outscale_nics_test.go b/outscale/data_source_outscale_nics_test.go index cf9ba01a5..f95286bae 100644 --- a/outscale/data_source_outscale_nics_test.go +++ b/outscale/data_source_outscale_nics_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPINicsDataSource(t *testing.T) { @@ -39,18 +39,20 @@ func testAccCheckOutscaleOAPINicsDataSourceConfig(subregion string) string { resource "outscale_subnet" "outscale_subnet" { subregion_name = "%sa" ip_range = "10.0.0.0/16" - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id } resource "outscale_nic" "outscale_nic" { - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" + subnet_id = outscale_subnet.outscale_subnet.subnet_id + depends_on = [outscale_subnet.outscale_subnet] } data "outscale_nics" "outscale_nics" { filter { name = "nic_ids" - values = ["${outscale_nic.outscale_nic.id}"] + values = [outscale_nic.outscale_nic.id] } + depends_on = [outscale_nic.outscale_nic] } `, subregion) } diff --git a/outscale/data_source_outscale_product_type.go b/outscale/data_source_outscale_product_type.go index c426c17ae..b759f0fd5 100644 --- a/outscale/data_source_outscale_product_type.go +++ b/outscale/data_source_outscale_product_type.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIProductType() *schema.Resource { diff --git a/outscale/data_source_outscale_product_type_test.go b/outscale/data_source_outscale_product_type_test.go index 8154d15cf..c1d508e76 100644 --- a/outscale/data_source_outscale_product_type_test.go +++ b/outscale/data_source_outscale_product_type_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIProductType(t *testing.T) { diff --git a/outscale/data_source_outscale_product_types.go b/outscale/data_source_outscale_product_types.go index 0fa9c353f..2d0184a54 100644 --- a/outscale/data_source_outscale_product_types.go +++ b/outscale/data_source_outscale_product_types.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIProductTypes() *schema.Resource { diff --git a/outscale/data_source_outscale_product_types_test.go b/outscale/data_source_outscale_product_types_test.go index 3c521fb5e..2572e876e 100644 --- a/outscale/data_source_outscale_product_types_test.go +++ b/outscale/data_source_outscale_product_types_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIProductTypes(t *testing.T) { diff --git a/outscale/data_source_outscale_public_catalog.go b/outscale/data_source_outscale_public_catalog.go index cd2fdd8b5..16d054a44 100644 --- a/outscale/data_source_outscale_public_catalog.go +++ b/outscale/data_source_outscale_public_catalog.go @@ -6,8 +6,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_public_catalog_test.go b/outscale/data_source_outscale_public_catalog_test.go index 2e9501c0c..4a69a930f 100644 --- a/outscale/data_source_outscale_public_catalog_test.go +++ b/outscale/data_source_outscale_public_catalog_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIPublicCatalog_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_public_ip.go b/outscale/data_source_outscale_public_ip.go index 1d1f3f6f3..d3ab81989 100644 --- a/outscale/data_source_outscale_public_ip.go +++ b/outscale/data_source_outscale_public_ip.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_public_ip_test.go b/outscale/data_source_outscale_public_ip_test.go index b25290137..bcf4c8d0e 100644 --- a/outscale/data_source_outscale_public_ip_test.go +++ b/outscale/data_source_outscale_public_ip_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPIPublicIP(t *testing.T) { diff --git a/outscale/data_source_outscale_public_ips.go b/outscale/data_source_outscale_public_ips.go index 966a69f08..dfe52c969 100644 --- a/outscale/data_source_outscale_public_ips.go +++ b/outscale/data_source_outscale_public_ips.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIPublicIPS() *schema.Resource { diff --git a/outscale/data_source_outscale_public_ips_test.go b/outscale/data_source_outscale_public_ips_test.go index 10662682e..438057354 100644 --- a/outscale/data_source_outscale_public_ips_test.go +++ b/outscale/data_source_outscale_public_ips_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIPublicIPS(t *testing.T) { diff --git a/outscale/data_source_outscale_quota.go b/outscale/data_source_outscale_quota.go index 86b947cf9..2711b3e52 100644 --- a/outscale/data_source_outscale_quota.go +++ b/outscale/data_source_outscale_quota.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIQuota() *schema.Resource { diff --git a/outscale/data_source_outscale_quota_test.go b/outscale/data_source_outscale_quota_test.go index 92ff5c236..7246924b8 100644 --- a/outscale/data_source_outscale_quota_test.go +++ b/outscale/data_source_outscale_quota_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIQuota(t *testing.T) { diff --git a/outscale/data_source_outscale_quotas.go b/outscale/data_source_outscale_quotas.go index b9254c41d..6ca16a2a2 100644 --- a/outscale/data_source_outscale_quotas.go +++ b/outscale/data_source_outscale_quotas.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIQuotas() *schema.Resource { diff --git a/outscale/data_source_outscale_quotas_test.go b/outscale/data_source_outscale_quotas_test.go index 7062de18b..00cb5704d 100644 --- a/outscale/data_source_outscale_quotas_test.go +++ b/outscale/data_source_outscale_quotas_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourcesOutscaleOAPIQuotas(t *testing.T) { diff --git a/outscale/data_source_outscale_regions.go b/outscale/data_source_outscale_regions.go index 1eb351cff..b449a692e 100644 --- a/outscale/data_source_outscale_regions.go +++ b/outscale/data_source_outscale_regions.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_regions_test.go b/outscale/data_source_outscale_regions_test.go index 485bef254..53ccd7cc4 100644 --- a/outscale/data_source_outscale_regions_test.go +++ b/outscale/data_source_outscale_regions_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIRegionsDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_route_table.go b/outscale/data_source_outscale_route_table.go index 983ecc4cd..baeba7056 100644 --- a/outscale/data_source_outscale_route_table.go +++ b/outscale/data_source_outscale_route_table.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIRouteTable() *schema.Resource { diff --git a/outscale/data_source_outscale_route_table_test.go b/outscale/data_source_outscale_route_table_test.go index 8919f3184..f0606ce8c 100644 --- a/outscale/data_source_outscale_route_table_test.go +++ b/outscale/data_source_outscale_route_table_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPIRouteTable_basic(t *testing.T) { @@ -19,7 +19,6 @@ func TestAccDataSourceOutscaleOAPIRouteTable_basic(t *testing.T) { testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_filter"), testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_id"), ), - ExpectNonEmptyPlan: true, }, }, }) @@ -96,7 +95,7 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` resource "outscale_subnet" "test" { ip_range = "172.16.0.0/24" - net_id = "${outscale_net.test.id}" + net_id = outscale_net.test.id #tag { # Name = "terraform-testacc-data-source" @@ -104,7 +103,7 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` } resource "outscale_route_table" "test" { - net_id = "${outscale_net.test.id}" + net_id = outscale_net.test.id tags { key = "Name" @@ -113,21 +112,21 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` } resource "outscale_route_table_link" "a" { - subnet_id = "${outscale_subnet.test.id}" - route_table_id = "${outscale_route_table.test.id}" + subnet_id = outscale_subnet.test.id + route_table_id = outscale_route_table.test.id } data "outscale_route_table" "by_filter" { filter { name = "route_table_ids" - values = ["${outscale_route_table.test.id}"] + values = [outscale_route_table.test.id] } - depends_on = ["outscale_route_table_link.a"] + depends_on = [outscale_route_table_link.a] } data "outscale_route_table" "by_id" { - route_table_id = "${outscale_route_table.test.id}" - depends_on = ["outscale_route_table_link.a"] + route_table_id = outscale_route_table.test.id + depends_on = [outscale_route_table_link.a] } ` diff --git a/outscale/data_source_outscale_route_tables.go b/outscale/data_source_outscale_route_tables.go index b3060cb0e..cb70c94fb 100644 --- a/outscale/data_source_outscale_route_tables.go +++ b/outscale/data_source_outscale_route_tables.go @@ -5,10 +5,11 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIRouteTables() *schema.Resource { diff --git a/outscale/data_source_outscale_route_tables_test.go b/outscale/data_source_outscale_route_tables_test.go index fa526e3ea..c48444646 100644 --- a/outscale/data_source_outscale_route_tables_test.go +++ b/outscale/data_source_outscale_route_tables_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIRouteTables_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_security_group.go b/outscale/data_source_outscale_security_group.go index c1ad10d72..0ebde0a43 100644 --- a/outscale/data_source_outscale_security_group.go +++ b/outscale/data_source_outscale_security_group.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_security_group_test.go b/outscale/data_source_outscale_security_group_test.go index bb11876cf..2998474ea 100644 --- a/outscale/data_source_outscale_security_group_test.go +++ b/outscale/data_source_outscale_security_group_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPISecurityGroup_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_security_groups.go b/outscale/data_source_outscale_security_groups.go index 5bace37c9..1a398e4c2 100644 --- a/outscale/data_source_outscale_security_groups.go +++ b/outscale/data_source_outscale_security_groups.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_security_groups_test.go b/outscale/data_source_outscale_security_groups_test.go index 0d5f911bb..0496733bd 100644 --- a/outscale/data_source_outscale_security_groups_test.go +++ b/outscale/data_source_outscale_security_groups_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPISecurityGroups_vpc(t *testing.T) { diff --git a/outscale/data_source_outscale_server_certificate.go b/outscale/data_source_outscale_server_certificate.go index 205aaeaf6..34de402a1 100644 --- a/outscale/data_source_outscale_server_certificate.go +++ b/outscale/data_source_outscale_server_certificate.go @@ -6,10 +6,11 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOAPIServerCertificate() *schema.Resource { diff --git a/outscale/data_source_outscale_server_certificate_test.go b/outscale/data_source_outscale_server_certificate_test.go index bf68db7a0..1ff4be750 100644 --- a/outscale/data_source_outscale_server_certificate_test.go +++ b/outscale/data_source_outscale_server_certificate_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIServerCertificateDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_server_certificates.go b/outscale/data_source_outscale_server_certificates.go index 4f17f8d84..47f1f7594 100644 --- a/outscale/data_source_outscale_server_certificates.go +++ b/outscale/data_source_outscale_server_certificates.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_server_certificates_test.go b/outscale/data_source_outscale_server_certificates_test.go index 87d4afc47..af0fddf6e 100644 --- a/outscale/data_source_outscale_server_certificates_test.go +++ b/outscale/data_source_outscale_server_certificates_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIServerCertificatesDatasource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_snapshot.go b/outscale/data_source_outscale_snapshot.go index 9a2336d62..99f50f683 100644 --- a/outscale/data_source_outscale_snapshot.go +++ b/outscale/data_source_outscale_snapshot.go @@ -7,9 +7,10 @@ import ( "strconv" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_snapshot_export_task.go b/outscale/data_source_outscale_snapshot_export_task.go index 77bfc3984..cfa586f64 100644 --- a/outscale/data_source_outscale_snapshot_export_task.go +++ b/outscale/data_source_outscale_snapshot_export_task.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_snapshot_export_task_test.go b/outscale/data_source_outscale_snapshot_export_task_test.go index d1bfcd7ff..93630d3e1 100644 --- a/outscale/data_source_outscale_snapshot_export_task_test.go +++ b/outscale/data_source_outscale_snapshot_export_task_test.go @@ -4,10 +4,10 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPISnapshotExportTaskDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_snapshot_export_tasks.go b/outscale/data_source_outscale_snapshot_export_tasks.go index 900512e46..39bcdc7a1 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks.go +++ b/outscale/data_source_outscale_snapshot_export_tasks.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPISnapshotExportTasks() *schema.Resource { diff --git a/outscale/data_source_outscale_snapshot_export_tasks_test.go b/outscale/data_source_outscale_snapshot_export_tasks_test.go index 10e2553b5..ca3b8d3c2 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks_test.go +++ b/outscale/data_source_outscale_snapshot_export_tasks_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPISnapshotExportTasksDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_snapshot_test.go b/outscale/data_source_outscale_snapshot_test.go index e00e1f673..4e668155a 100644 --- a/outscale/data_source_outscale_snapshot_test.go +++ b/outscale/data_source_outscale_snapshot_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPISnapshotDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_snapshots.go b/outscale/data_source_outscale_snapshots.go index f17c8856b..d08b9af57 100644 --- a/outscale/data_source_outscale_snapshots.go +++ b/outscale/data_source_outscale_snapshots.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPISnapshots() *schema.Resource { diff --git a/outscale/data_source_outscale_snapshots_test.go b/outscale/data_source_outscale_snapshots_test.go index 43c968107..e7d3e7504 100644 --- a/outscale/data_source_outscale_snapshots_test.go +++ b/outscale/data_source_outscale_snapshots_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPISnapshotsDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_subnet.go b/outscale/data_source_outscale_subnet.go index 93081eed0..90b86ed58 100644 --- a/outscale/data_source_outscale_subnet.go +++ b/outscale/data_source_outscale_subnet.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_subnet_test.go b/outscale/data_source_outscale_subnet_test.go index c75165d77..754ada1c9 100644 --- a/outscale/data_source_outscale_subnet_test.go +++ b/outscale/data_source_outscale_subnet_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPISubnet(t *testing.T) { diff --git a/outscale/data_source_outscale_subnets.go b/outscale/data_source_outscale_subnets.go index ae74cf9ba..da058afd7 100644 --- a/outscale/data_source_outscale_subnets.go +++ b/outscale/data_source_outscale_subnets.go @@ -6,10 +6,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPISubnets() *schema.Resource { diff --git a/outscale/data_source_outscale_subnets_test.go b/outscale/data_source_outscale_subnets_test.go index 6b686d957..9ae22955e 100644 --- a/outscale/data_source_outscale_subnets_test.go +++ b/outscale/data_source_outscale_subnets_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_subregions.go b/outscale/data_source_outscale_subregions.go index 8fd8fd607..c9d4c2a9c 100644 --- a/outscale/data_source_outscale_subregions.go +++ b/outscale/data_source_outscale_subregions.go @@ -5,11 +5,10 @@ import ( "log" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_subregions_test.go b/outscale/data_source_outscale_subregions_test.go index 53f22e455..f4b72cf15 100644 --- a/outscale/data_source_outscale_subregions_test.go +++ b/outscale/data_source_outscale_subregions_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPISubregionsDataSource_Basic(t *testing.T) { diff --git a/outscale/data_source_outscale_tag.go b/outscale/data_source_outscale_tag.go index 6485dc0a2..d795a4012 100644 --- a/outscale/data_source_outscale_tag.go +++ b/outscale/data_source_outscale_tag.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPITag() *schema.Resource { diff --git a/outscale/data_source_outscale_tag_test.go b/outscale/data_source_outscale_tag_test.go index 875f13e46..9a3fcfe2d 100644 --- a/outscale/data_source_outscale_tag_test.go +++ b/outscale/data_source_outscale_tag_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPITagDataSource(t *testing.T) { diff --git a/outscale/data_source_outscale_tags.go b/outscale/data_source_outscale_tags.go index c476daa45..e85915801 100644 --- a/outscale/data_source_outscale_tags.go +++ b/outscale/data_source_outscale_tags.go @@ -5,10 +5,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPITags() *schema.Resource { diff --git a/outscale/data_source_outscale_tags_test.go b/outscale/data_source_outscale_tags_test.go index 559d63855..2f378531e 100644 --- a/outscale/data_source_outscale_tags_test.go +++ b/outscale/data_source_outscale_tags_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPITagsDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_virtual_gateway.go b/outscale/data_source_outscale_virtual_gateway.go index 315fab12a..c9bda9ede 100644 --- a/outscale/data_source_outscale_virtual_gateway.go +++ b/outscale/data_source_outscale_virtual_gateway.go @@ -10,8 +10,8 @@ import ( "github.com/terraform-providers/terraform-provider-outscale/utils" "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { diff --git a/outscale/data_source_outscale_virtual_gateway_test.go b/outscale/data_source_outscale_virtual_gateway_test.go index b075ed0eb..6396d1ae5 100644 --- a/outscale/data_source_outscale_virtual_gateway_test.go +++ b/outscale/data_source_outscale_virtual_gateway_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIVirtualGateway_unattached(t *testing.T) { diff --git a/outscale/data_source_outscale_virtual_gateways.go b/outscale/data_source_outscale_virtual_gateways.go index d656fb874..f79f8cc0d 100644 --- a/outscale/data_source_outscale_virtual_gateways.go +++ b/outscale/data_source_outscale_virtual_gateways.go @@ -5,11 +5,10 @@ import ( "fmt" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { diff --git a/outscale/data_source_outscale_virtual_gateways_test.go b/outscale/data_source_outscale_virtual_gateways_test.go index f86d1bfdb..adee51913 100644 --- a/outscale/data_source_outscale_virtual_gateways_test.go +++ b/outscale/data_source_outscale_virtual_gateways_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIVpnGateways_unattached(t *testing.T) { diff --git a/outscale/data_source_outscale_vm.go b/outscale/data_source_outscale_vm.go index 4c6964187..6942f7ced 100644 --- a/outscale/data_source_outscale_vm.go +++ b/outscale/data_source_outscale_vm.go @@ -8,8 +8,8 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -92,9 +92,9 @@ func oapiVMDescriptionAttributes(set AttributeSetter, vm *oscgo.Vm) error { return err } if err := set("block_device_mappings_created", getOscAPIVMBlockDeviceMapping(vm.GetBlockDeviceMappings())); err != nil { - log.Printf("[DEBUG] BLOCKING DEVICE MAPPING ERR %+v", err) return err } + if err := set("bsu_optimized", vm.GetBsuOptimized()); err != nil { return err } @@ -195,21 +195,18 @@ func oapiVMDescriptionAttributes(set AttributeSetter, vm *oscgo.Vm) error { return set("vm_type", vm.GetVmType()) } -func getOscAPIVMBlockDeviceMapping(blockDeviceMappings []oscgo.BlockDeviceMappingCreated) []map[string]interface{} { - blockDeviceMapping := make([]map[string]interface{}, len(blockDeviceMappings)) - - for k, v := range blockDeviceMappings { - blockDeviceMapping[k] = map[string]interface{}{ - "device_name": aws.StringValue(v.DeviceName), - "bsu": map[string]interface{}{ - "delete_on_vm_deletion": fmt.Sprintf("%t", aws.BoolValue(v.GetBsu().DeleteOnVmDeletion)), - "volume_id": aws.StringValue(v.GetBsu().VolumeId), - "state": aws.StringValue(v.GetBsu().State), - "link_date": aws.StringValue(v.GetBsu().LinkDate), - }, +func getOscAPIVMBlockDeviceMapping(blkMappings []oscgo.BlockDeviceMappingCreated) []map[string]interface{} { + res := []map[string]interface{}{} + for _, v := range blkMappings { + blk := map[string]interface{}{ + "device_name": v.GetDeviceName(), } + if bsu, ok := v.GetBsuOk(); ok { + blk["bsu"] = getOAPIBsuSet(*bsu) + } + res = append(res, blk) } - return blockDeviceMapping + return res } func getOAPIVMSecurityGroups(groupSet []oscgo.SecurityGroupLight) []map[string]interface{} { @@ -279,13 +276,11 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "block_device_mappings_created": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bsu": { - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -298,11 +293,11 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { Computed: true, }, "state": { - Type: schema.TypeInt, + Type: schema.TypeString, Computed: true, }, "volume_id": { - Type: schema.TypeFloat, + Type: schema.TypeString, Computed: true, }, }, @@ -317,7 +312,6 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "bsu_optimized": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "client_token": { @@ -330,7 +324,6 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "deletion_protection": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "hypervisor": { @@ -339,28 +332,24 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "image_id": { Type: schema.TypeString, - ForceNew: true, - Optional: true, Computed: true, }, "is_source_dest_checked": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "keypair_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "security_group_ids": { Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "security_group_names": { Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "launch_number": { @@ -377,39 +366,32 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "nics": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "delete_on_vm_deletion": { Type: schema.TypeBool, Computed: true, - Optional: true, }, "description": { Type: schema.TypeString, Computed: true, - Optional: true, }, "device_number": { Type: schema.TypeInt, Computed: true, - Optional: true, }, "nic_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "private_ips": { Type: schema.TypeSet, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "is_primary": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "link_public_ip": { @@ -438,7 +420,6 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "private_ip": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -446,12 +427,10 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "secondary_private_ip_count": { Type: schema.TypeInt, - Optional: true, Computed: true, }, "security_group_ids": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -468,12 +447,10 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { "subnet_id": { Type: schema.TypeString, Computed: true, - Optional: true, }, "link_nic": { - Type: schema.TypeList, + Type: schema.TypeSet, Computed: true, - MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "delete_on_vm_deletion": { @@ -530,7 +507,6 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "security_groups_names": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -567,12 +543,10 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "placement_subregion_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "placement_tenancy": { Type: schema.TypeString, - Optional: true, Computed: true, }, "private_dns_name": { @@ -634,8 +608,6 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "subnet_id": { Type: schema.TypeString, - ForceNew: true, - Optional: true, Computed: true, }, "tags": { @@ -656,22 +628,18 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "user_data": { Type: schema.TypeString, - Optional: true, Computed: true, }, "vm_id": { Type: schema.TypeString, Computed: true, - Optional: true, }, "vm_initiated_shutdown_behavior": { Type: schema.TypeString, - Optional: true, Computed: true, }, "vm_type": { Type: schema.TypeString, - Optional: true, Computed: true, }, "request_id": { @@ -680,7 +648,7 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "private_ips": { Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, } diff --git a/outscale/data_source_outscale_vm_state.go b/outscale/data_source_outscale_vm_state.go index 8cef654f9..9d50cf35e 100644 --- a/outscale/data_source_outscale_vm_state.go +++ b/outscale/data_source_outscale_vm_state.go @@ -8,10 +8,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVMState() *schema.Resource { diff --git a/outscale/data_source_outscale_vm_state_test.go b/outscale/data_source_outscale_vm_state_test.go index 68b93e5b4..7478e03c0 100644 --- a/outscale/data_source_outscale_vm_state_test.go +++ b/outscale/data_source_outscale_vm_state_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceOutscaleOAPIVmState(t *testing.T) { diff --git a/outscale/data_source_outscale_vm_states.go b/outscale/data_source_outscale_vm_states.go index d80e37104..afc779aab 100644 --- a/outscale/data_source_outscale_vm_states.go +++ b/outscale/data_source_outscale_vm_states.go @@ -7,10 +7,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleOAPIVMStates() *schema.Resource { diff --git a/outscale/data_source_outscale_vm_states_test.go b/outscale/data_source_outscale_vm_states_test.go index dd81749cd..751d6ba86 100644 --- a/outscale/data_source_outscale_vm_states_test.go +++ b/outscale/data_source_outscale_vm_states_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIVMStates(t *testing.T) { diff --git a/outscale/data_source_outscale_vm_test.go b/outscale/data_source_outscale_vm_test.go index 1486409bf..468dfd50d 100644 --- a/outscale/data_source_outscale_vm_test.go +++ b/outscale/data_source_outscale_vm_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIVMDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_vm_types.go b/outscale/data_source_outscale_vm_types.go index 1a29b27e3..73cd4f046 100644 --- a/outscale/data_source_outscale_vm_types.go +++ b/outscale/data_source_outscale_vm_types.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" diff --git a/outscale/data_source_outscale_vm_types_test.go b/outscale/data_source_outscale_vm_types_test.go index a48784442..41fbbd3fa 100644 --- a/outscale/data_source_outscale_vm_types_test.go +++ b/outscale/data_source_outscale_vm_types_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceOutscaleOAPIVMTypes_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_vms.go b/outscale/data_source_outscale_vms.go index 4cefb246d..cd1ec795d 100644 --- a/outscale/data_source_outscale_vms.go +++ b/outscale/data_source_outscale_vms.go @@ -7,8 +7,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_vms_test.go b/outscale/data_source_outscale_vms_test.go index 821808c34..151c397dc 100644 --- a/outscale/data_source_outscale_vms_test.go +++ b/outscale/data_source_outscale_vms_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIVMSDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_volume.go b/outscale/data_source_outscale_volume.go index 68d5e78da..bfcc16806 100644 --- a/outscale/data_source_outscale_volume.go +++ b/outscale/data_source_outscale_volume.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/cast" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_volume_test.go b/outscale/data_source_outscale_volume_test.go index 316d2e1a1..66d7949eb 100644 --- a/outscale/data_source_outscale_volume_test.go +++ b/outscale/data_source_outscale_volume_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVolumeDataSource_basic(t *testing.T) { diff --git a/outscale/data_source_outscale_volumes.go b/outscale/data_source_outscale_volumes.go index b94e1dfb2..87ab838af 100644 --- a/outscale/data_source_outscale_volumes.go +++ b/outscale/data_source_outscale_volumes.go @@ -10,8 +10,8 @@ import ( "github.com/terraform-providers/terraform-provider-outscale/utils" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func datasourceOutscaleOAPIVolumes() *schema.Resource { diff --git a/outscale/data_source_outscale_volumes_test.go b/outscale/data_source_outscale_volumes_test.go index e0dd64975..afa98d601 100644 --- a/outscale/data_source_outscale_volumes_test.go +++ b/outscale/data_source_outscale_volumes_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIVolumesDataSource_multipleFilters(t *testing.T) { diff --git a/outscale/data_source_outscale_vpn_connection.go b/outscale/data_source_outscale_vpn_connection.go index 323da2f34..0124e191e 100644 --- a/outscale/data_source_outscale_vpn_connection.go +++ b/outscale/data_source_outscale_vpn_connection.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceOutscaleVPNConnection() *schema.Resource { diff --git a/outscale/data_source_outscale_vpn_connection_test.go b/outscale/data_source_outscale_vpn_connection_test.go index 66a425f6a..1203f9d38 100644 --- a/outscale/data_source_outscale_vpn_connection_test.go +++ b/outscale/data_source_outscale_vpn_connection_test.go @@ -4,8 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_vpn_connections.go b/outscale/data_source_outscale_vpn_connections.go index 4f3b3802a..4320adc61 100644 --- a/outscale/data_source_outscale_vpn_connections.go +++ b/outscale/data_source_outscale_vpn_connections.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/data_source_outscale_vpn_connections_test.go b/outscale/data_source_outscale_vpn_connections_test.go index 1d6b52d6c..cf9d67f47 100644 --- a/outscale/data_source_outscale_vpn_connections_test.go +++ b/outscale/data_source_outscale_vpn_connections_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/dictionary.go b/outscale/dictionary.go index ed26294ac..02aad5318 100644 --- a/outscale/dictionary.go +++ b/outscale/dictionary.go @@ -1,6 +1,6 @@ package outscale -import "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" // Dictionary for the Outscale APIs maps the apis to their respective functions type Dictionary map[string]ResourceMap diff --git a/outscale/import_outscale_net_attributes_test.go b/outscale/import_outscale_net_attributes_test.go index f6aca696f..4a0ed4274 100644 --- a/outscale/import_outscale_net_attributes_test.go +++ b/outscale/import_outscale_net_attributes_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleNetAttr_import(t *testing.T) { diff --git a/outscale/instance_set_set.go b/outscale/instance_set_set.go index 514c168e6..269399795 100644 --- a/outscale/instance_set_set.go +++ b/outscale/instance_set_set.go @@ -5,9 +5,9 @@ import ( "fmt" "strconv" - "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" + "github.com/terraform-providers/terraform-provider-outscale/utils" ) func getOAPISecurityGroups(groups []oscgo.SecurityGroupLight) (SecurityGroup []map[string]interface{}, SecurityGroupIds []string) { @@ -41,6 +41,15 @@ func getOAPILinkNic(l oscgo.LinkNic) map[string]interface{} { } } +func getOAPIBsuSet(bsu oscgo.BsuCreated) []map[string]interface{} { + return []map[string]interface{}{{ + "delete_on_vm_deletion": bsu.GetDeleteOnVmDeletion(), + "link_date": bsu.GetLinkDate(), + "state": bsu.GetState(), + "volume_id": bsu.GetVolumeId(), + }} +} + func getOAPILinkPublicIPLight(l oscgo.LinkPublicIpLightForVm) *schema.Set { res := &schema.Set{ F: func(v interface{}) int { @@ -48,7 +57,7 @@ func getOAPILinkPublicIPLight(l oscgo.LinkPublicIpLightForVm) *schema.Set { m := v.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", m["public_ip"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["public_ip_account_id"].(string))) - return hashcode.String(buf.String()) + return utils.String(buf.String()) }, } @@ -77,7 +86,7 @@ func getOAPIPrivateIPsLight(privateIPs []oscgo.PrivateIpLightForVm) *schema.Set m := v.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", m["private_ip"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["private_dns_name"].(string))) - return hashcode.String(buf.String()) + return utils.String(buf.String()) }, } @@ -99,12 +108,15 @@ func getOAPIPrivateIPsLight(privateIPs []oscgo.PrivateIpLightForVm) *schema.Set func getOAPIPrivateIPs(privateIPs []oscgo.PrivateIp) (res []map[string]interface{}) { for _, p := range privateIPs { - res = append(res, map[string]interface{}{ + r := map[string]interface{}{ "is_primary": p.GetIsPrimary(), - "link_public_ip": getOAPILinkPublicIP(p.GetLinkPublicIp()), "private_dns_name": p.GetPrivateDnsName(), "private_ip": p.GetPrivateIp(), - }) + } + if _, ok := p.GetLinkPublicIpOk(); ok { + r["link_public_ip"] = getOAPILinkPublicIP(p.GetLinkPublicIp()) + } + res = append(res, r) } return } @@ -150,14 +162,13 @@ func getOAPIVMNetworkInterfaceLightSet(nics []oscgo.NicLight) (res []map[string] } func getOAPIVMNetworkInterfaceSet(nics []oscgo.Nic) (res []map[string]interface{}) { + for _, nic := range nics { securityGroups, _ := getOAPISecurityGroups(*nic.SecurityGroups) - res = append(res, map[string]interface{}{ + r := map[string]interface{}{ "account_id": nic.GetAccountId(), "description": nic.GetDescription(), "is_source_dest_checked": nic.GetIsSourceDestChecked(), - "link_nic": getOAPILinkNic(nic.GetLinkNic()), - "link_public_ip": getOAPILinkPublicIP(nic.GetLinkPublicIp()), "mac_address": nic.GetMacAddress(), "net_id": nic.GetNetId(), "nic_id": nic.GetNicId(), @@ -168,7 +179,15 @@ func getOAPIVMNetworkInterfaceSet(nics []oscgo.Nic) (res []map[string]interface{ "subnet_id": nic.GetSubnetId(), "subregion_name": nic.GetSubregionName(), "tags": getOapiTagSet(nic.Tags), - }) + } + if _, ok := nic.GetLinkNicOk(); ok { + r["link_nic"] = getOAPILinkNic(nic.GetLinkNic()) + } + if _, ok := nic.GetLinkPublicIpOk(); ok { + r["link_public_ip"] = getOAPILinkPublicIP(nic.GetLinkPublicIp()) + } + res = append(res, r) } + return } diff --git a/outscale/oapi_tags.go b/outscale/oapi_tags.go index ae7530e0a..ebf38757b 100644 --- a/outscale/oapi_tags.go +++ b/outscale/oapi_tags.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/provider.go b/outscale/provider.go index 2f787529d..23d1b2baf 100644 --- a/outscale/provider.go +++ b/outscale/provider.go @@ -1,8 +1,7 @@ package outscale import ( - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) var endpointServiceNames []string @@ -14,7 +13,7 @@ func init() { } // Provider ... -func Provider() terraform.ResourceProvider { +func Provider() *schema.Provider { return &schema.Provider{ Schema: map[string]*schema.Schema{ "access_key_id": { diff --git a/outscale/provider_test.go b/outscale/provider_test.go index 0b60b43a5..bb90df7a3 100644 --- a/outscale/provider_test.go +++ b/outscale/provider_test.go @@ -4,32 +4,30 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -var testAccProviders map[string]terraform.ResourceProvider +var testAccProviders map[string]*schema.Provider var testAccProvider *schema.Provider func init() { - testAccProvider = Provider().(*schema.Provider) + testAccProvider = Provider() - testAccProviders = map[string]terraform.ResourceProvider{ + testAccProviders = map[string]*schema.Provider{ "outscale": testAccProvider, } } func TestProvider(t *testing.T) { - if err := Provider().(*schema.Provider).InternalValidate(); err != nil { + if err := Provider().InternalValidate(); err != nil { t.Fatalf("err: %s", err) } } func TestProvider_impl(t *testing.T) { - var _ terraform.ResourceProvider = Provider() + var _ *schema.Provider = Provider() } func testAccPreCheck(t *testing.T) { diff --git a/outscale/resource_outscale_access_key.go b/outscale/resource_outscale_access_key.go index 86c3b6d72..6b8aa598b 100644 --- a/outscale/resource_outscale_access_key.go +++ b/outscale/resource_outscale_access_key.go @@ -5,9 +5,9 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/nav-inc/datetime" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" diff --git a/outscale/resource_outscale_access_key_test.go b/outscale/resource_outscale_access_key_test.go index c8a177742..dc13c8b29 100644 --- a/outscale/resource_outscale_access_key_test.go +++ b/outscale/resource_outscale_access_key_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_api_access_policy.go b/outscale/resource_outscale_api_access_policy.go index a05df2bef..d36836ab4 100644 --- a/outscale/resource_outscale_api_access_policy.go +++ b/outscale/resource_outscale_api_access_policy.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_api_access_rule.go b/outscale/resource_outscale_api_access_rule.go index 7bfecf1b4..794fda7e3 100644 --- a/outscale/resource_outscale_api_access_rule.go +++ b/outscale/resource_outscale_api_access_rule.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" diff --git a/outscale/resource_outscale_api_access_rule_test.go b/outscale/resource_outscale_api_access_rule_test.go index be8f9fee8..01c84c47f 100644 --- a/outscale/resource_outscale_api_access_rule_test.go +++ b/outscale/resource_outscale_api_access_rule_test.go @@ -6,11 +6,10 @@ import ( "testing" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccOutscaleOAPIApiAccessRule_basic(t *testing.T) { diff --git a/outscale/resource_outscale_ca.go b/outscale/resource_outscale_ca.go index dbf61326b..d8b87e7fc 100644 --- a/outscale/resource_outscale_ca.go +++ b/outscale/resource_outscale_ca.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/openlyinc/pointy" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" diff --git a/outscale/resource_outscale_ca_test.go b/outscale/resource_outscale_ca_test.go index 6c70a3d79..8282c4be5 100644 --- a/outscale/resource_outscale_ca_test.go +++ b/outscale/resource_outscale_ca_test.go @@ -6,11 +6,10 @@ import ( "testing" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccOutscaleOAPICa_basic(t *testing.T) { diff --git a/outscale/resource_outscale_client_gateway.go b/outscale/resource_outscale_client_gateway.go index 7473f0a3f..bc5c703ac 100644 --- a/outscale/resource_outscale_client_gateway.go +++ b/outscale/resource_outscale_client_gateway.go @@ -9,8 +9,8 @@ import ( "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" ) @@ -145,15 +145,10 @@ func resourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) func resourceOutscaleClientGatewayUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleClientGatewayRead(d, meta) } diff --git a/outscale/resource_outscale_client_gateway_test.go b/outscale/resource_outscale_client_gateway_test.go index c0c96c29d..ac011b378 100644 --- a/outscale/resource_outscale_client_gateway_test.go +++ b/outscale/resource_outscale_client_gateway_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" diff --git a/outscale/resource_outscale_dhcp_option.go b/outscale/resource_outscale_dhcp_option.go index be57ce873..63cb467f0 100644 --- a/outscale/resource_outscale_dhcp_option.go +++ b/outscale/resource_outscale_dhcp_option.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleDHCPOption() *schema.Resource { @@ -159,16 +159,9 @@ func resourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) er func resourceOutscaleDHCPOptionUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) - return resourceOutscaleDHCPOptionRead(d, meta) } diff --git a/outscale/resource_outscale_dhcp_option_test.go b/outscale/resource_outscale_dhcp_option_test.go index 74f70dd53..683f34a19 100644 --- a/outscale/resource_outscale_dhcp_option_test.go +++ b/outscale/resource_outscale_dhcp_option_test.go @@ -11,9 +11,9 @@ import ( "github.com/openlyinc/pointy" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" ) diff --git a/outscale/resource_outscale_flexible_gpu.go b/outscale/resource_outscale_flexible_gpu.go index ebb5837a6..d546999c7 100644 --- a/outscale/resource_outscale_flexible_gpu.go +++ b/outscale/resource_outscale_flexible_gpu.go @@ -6,8 +6,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_flexible_gpu_link.go b/outscale/resource_outscale_flexible_gpu_link.go index 8c2addc12..f308bf7d6 100644 --- a/outscale/resource_outscale_flexible_gpu_link.go +++ b/outscale/resource_outscale_flexible_gpu_link.go @@ -7,8 +7,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_flexible_gpu_link_test.go b/outscale/resource_outscale_flexible_gpu_link_test.go index 03a572baf..9cace4091 100644 --- a/outscale/resource_outscale_flexible_gpu_link_test.go +++ b/outscale/resource_outscale_flexible_gpu_link_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIFlexibleGpuLink_basic(t *testing.T) { diff --git a/outscale/resource_outscale_flexible_gpu_test.go b/outscale/resource_outscale_flexible_gpu_test.go index 97fc01382..16f93cec1 100644 --- a/outscale/resource_outscale_flexible_gpu_test.go +++ b/outscale/resource_outscale_flexible_gpu_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPIFlexibleGpu_basic(t *testing.T) { diff --git a/outscale/resource_outscale_image.go b/outscale/resource_outscale_image.go index 11ec6ac3f..29e66fa86 100644 --- a/outscale/resource_outscale_image.go +++ b/outscale/resource_outscale_image.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) const ( @@ -412,14 +412,9 @@ func setResourcePermissions(por oscgo.PermissionsOnResource) []map[string]interf func resourceOAPIImageUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - - d.Partial(false) - return resourceOAPIImageRead(d, meta) } diff --git a/outscale/resource_outscale_image_export_task.go b/outscale/resource_outscale_image_export_task.go index 758177730..ff967a13e 100644 --- a/outscale/resource_outscale_image_export_task.go +++ b/outscale/resource_outscale_image_export_task.go @@ -13,8 +13,8 @@ import ( "github.com/openlyinc/pointy" oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIIMageExportTask() *schema.Resource { @@ -181,7 +181,6 @@ func resourceOAPIImageExportTaskCreate(d *schema.ResourceData, meta interface{}) if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } _, err = resourceOutscaleImageTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) if err != nil { @@ -279,14 +278,9 @@ func resourceOAPIImageExportTaskRead(d *schema.ResourceData, meta interface{}) e func resourceOAPIImageExportTaskUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - - d.Partial(false) - return resourceOAPIImageExportTaskRead(d, meta) } diff --git a/outscale/resource_outscale_image_export_task_test.go b/outscale/resource_outscale_image_export_task_test.go index 3a6dd48cf..978bfeb7d 100644 --- a/outscale/resource_outscale_image_export_task_test.go +++ b/outscale/resource_outscale_image_export_task_test.go @@ -5,10 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/acctest" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIImageExportTask_basic(t *testing.T) { diff --git a/outscale/resource_outscale_image_launch_permission.go b/outscale/resource_outscale_image_launch_permission.go index d790523b5..cefb39c52 100644 --- a/outscale/resource_outscale_image_launch_permission.go +++ b/outscale/resource_outscale_image_launch_permission.go @@ -13,8 +13,8 @@ import ( "github.com/spf13/cast" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIImageLaunchPermission() *schema.Resource { @@ -82,9 +82,8 @@ func resourceOutscaleOAPIImageLaunchPermission() *schema.Resource { Computed: true, }, "permissions_to_launch": { - Type: schema.TypeList, + Type: schema.TypeSet, Computed: true, - MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_permission": { diff --git a/outscale/resource_outscale_image_launch_permission_test.go b/outscale/resource_outscale_image_launch_permission_test.go index a87e65c2f..1c122efb4 100644 --- a/outscale/resource_outscale_image_launch_permission_test.go +++ b/outscale/resource_outscale_image_launch_permission_test.go @@ -7,14 +7,12 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/terraform-providers/terraform-provider-outscale/utils" - - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/aws/aws-sdk-go/aws" - r "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + r "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + oscgo "github.com/outscale/osc-sdk-go/v2" + "github.com/terraform-providers/terraform-provider-outscale/utils" ) func TestAccOutscaleOAPIImageLaunchPermission_Basic(t *testing.T) { diff --git a/outscale/resource_outscale_image_test.go b/outscale/resource_outscale_image_test.go index a34f45ccd..a2a181f52 100644 --- a/outscale/resource_outscale_image_test.go +++ b/outscale/resource_outscale_image_test.go @@ -10,9 +10,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIImage_basic(t *testing.T) { diff --git a/outscale/resource_outscale_internet_service.go b/outscale/resource_outscale_internet_service.go index 5d47703fb..cc9647767 100644 --- a/outscale/resource_outscale_internet_service.go +++ b/outscale/resource_outscale_internet_service.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -122,15 +122,9 @@ func resourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta interf func resourceOutscaleOAPIInternetServiceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPIInternetServiceRead(d, meta) } diff --git a/outscale/resource_outscale_internet_service_link.go b/outscale/resource_outscale_internet_service_link.go index 5ca119390..8eaa4061b 100644 --- a/outscale/resource_outscale_internet_service_link.go +++ b/outscale/resource_outscale_internet_service_link.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIInternetServiceLink() *schema.Resource { diff --git a/outscale/resource_outscale_internet_service_link_test.go b/outscale/resource_outscale_internet_service_link_test.go index 02d7bf1b6..20403a2b2 100644 --- a/outscale/resource_outscale_internet_service_link_test.go +++ b/outscale/resource_outscale_internet_service_link_test.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIInternetServiceLink_basic(t *testing.T) { diff --git a/outscale/resource_outscale_internet_service_test.go b/outscale/resource_outscale_internet_service_test.go index 7e0de3e2f..65d28901f 100644 --- a/outscale/resource_outscale_internet_service_test.go +++ b/outscale/resource_outscale_internet_service_test.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIInternetService_basic(t *testing.T) { diff --git a/outscale/resource_outscale_keypair.go b/outscale/resource_outscale_keypair.go index 42e2eef81..a6509e546 100644 --- a/outscale/resource_outscale_keypair.go +++ b/outscale/resource_outscale_keypair.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIKeyPair() *schema.Resource { diff --git a/outscale/resource_outscale_keypair_test.go b/outscale/resource_outscale_keypair_test.go index 10079d830..5ffc47bae 100644 --- a/outscale/resource_outscale_keypair_test.go +++ b/outscale/resource_outscale_keypair_test.go @@ -11,9 +11,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIKeyPair_basic(t *testing.T) { diff --git a/outscale/resource_outscale_load_balancer.go b/outscale/resource_outscale_load_balancer.go index afef61a81..aee3d1699 100644 --- a/outscale/resource_outscale_load_balancer.go +++ b/outscale/resource_outscale_load_balancer.go @@ -11,14 +11,14 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) func lb_sg_schema() *schema.Schema { return &schema.Schema{ - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -84,7 +84,7 @@ func resourceOutscaleOAPILoadBalancer() *schema.Resource { Computed: true, }, "access_log": { - Type: schema.TypeMap, + Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Resource{ @@ -109,16 +109,16 @@ func resourceOutscaleOAPILoadBalancer() *schema.Resource { }, }, "health_check": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "healthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "unhealthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "path": { @@ -126,11 +126,11 @@ func resourceOutscaleOAPILoadBalancer() *schema.Resource { Computed: true, }, "check_interval": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "port": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "protocol": { @@ -138,7 +138,7 @@ func resourceOutscaleOAPILoadBalancer() *schema.Resource { Computed: true, }, "timeout": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, }, @@ -567,14 +567,11 @@ func resourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interface } else { d.Set("security_groups", make([]map[string]interface{}, 0)) } - ssg := make(map[string]string) + if lb.SourceSecurityGroup != nil { - ssg["security_group_name"] = *lb.SourceSecurityGroup.SecurityGroupName - ssg["security_group_account_id"] = *lb.SourceSecurityGroup.SecurityGroupAccountId + d.Set("source_security_group", flattenSource_sg(lb.SourceSecurityGroup)) } - d.Set("source_security_group", ssg) d.Set("subnets", utils.StringSlicePtrToInterfaceSlice(lb.Subnets)) - d.Set("public_ip", lb.PublicIp) d.Set("secured_cookies", lb.SecuredCookies) @@ -586,7 +583,6 @@ func resourceOutscaleOAPILoadBalancerRead(d *schema.ResourceData, meta interface func resourceOutscaleOAPILoadBalancerUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI var err error - d.Partial(true) if d.HasChange("security_groups") { req := oscgo.UpdateLoadBalancerRequest{ @@ -876,27 +872,6 @@ func resourceOutscaleOAPILoadBalancerUpdate(d *schema.ResourceData, meta interfa } } - if d.HasChange("public_ip") { - req := oscgo.UpdateLoadBalancerRequest{ - LoadBalancerName: d.Id(), - } - req.SetPublicIp(d.Get("public_ip").(string)) - - var err error - err = resource.Retry(1*time.Minute, func() *resource.RetryError { - _, httpResp, err := conn.LoadBalancerApi.UpdateLoadBalancer( - context.Background()).UpdateLoadBalancerRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - return nil - }) - - if err != nil { - return fmt.Errorf("Failure updating PublicIp: %s", err) - } - } - if d.HasChange("secured_cookies") { req := oscgo.UpdateLoadBalancerRequest{ LoadBalancerName: d.Id(), @@ -918,8 +893,6 @@ func resourceOutscaleOAPILoadBalancerUpdate(d *schema.ResourceData, meta interfa } } - d.Partial(false) - return resourceOutscaleOAPILoadBalancerRead(d, meta) } @@ -972,39 +945,43 @@ func resourceOutscaleOAPILoadBalancerDelete(d *schema.ResourceData, meta interfa return nil } -func flattenOAPIHealthCheck(check *oscgo.HealthCheck) map[string]interface{} { - chk := make(map[string]interface{}) - - if check != nil { - h := utils.I32toa(check.HealthyThreshold) - i := utils.I32toa(check.CheckInterval) - pa := check.Path - po := utils.I32toa(check.Port) - pr := check.Protocol - ti := utils.I32toa(check.Timeout) - u := utils.I32toa(check.UnhealthyThreshold) - - chk["healthy_threshold"] = h - chk["check_interval"] = i - chk["path"] = pa - chk["port"] = po - chk["protocol"] = pr - chk["timeout"] = ti - chk["unhealthy_threshold"] = u +// Expands an array of String Instance IDs into a []Instances +func expandInstanceString(list []interface{}) []string { + result := make([]string, 0, len(list)) + for _, i := range list { + result = append(result, i.(string)) } + return result +} - return chk +func formatInt32(n int32) string { + return strconv.FormatInt(int64(n), 10) } -func flattenOAPIAccessLog(aclog *oscgo.AccessLog) map[string]interface{} { - accl := make(map[string]interface{}) +func flattenOAPIHealthCheck(check *oscgo.HealthCheck) []map[string]interface{} { + return []map[string]interface{}{{ + "healthy_threshold": check.GetHealthyThreshold(), + "unhealthy_threshold": check.GetUnhealthyThreshold(), + "path": check.GetPath(), + "check_interval": check.GetCheckInterval(), + "port": check.GetPort(), + "protocol": check.GetProtocol(), + "timeout": check.GetTimeout(), + }} +} - if aclog != nil { - accl["is_enabled"] = strconv.FormatBool(*aclog.IsEnabled) - accl["osu_bucket_name"] = aclog.OsuBucketName - accl["osu_bucket_prefix"] = aclog.OsuBucketPrefix - accl["publication_interval"] = strconv.Itoa(int(*aclog.PublicationInterval)) - } +func flattenOAPIAccessLog(aclog *oscgo.AccessLog) []map[string]interface{} { + return []map[string]interface{}{{ + "is_enabled": aclog.GetIsEnabled(), + "osu_bucket_name": aclog.GetOsuBucketName(), + "osu_bucket_prefix": aclog.GetOsuBucketPrefix(), + "publication_interval": aclog.GetPublicationInterval(), + }} +} - return accl +func flattenSource_sg(ssg *oscgo.SourceSecurityGroup) []map[string]interface{} { + return []map[string]interface{}{{ + "security_group_name": ssg.GetSecurityGroupName(), + "security_group_account_id": ssg.GetSecurityGroupAccountId(), + }} } diff --git a/outscale/resource_outscale_load_balancer_attributes.go b/outscale/resource_outscale_load_balancer_attributes.go index 6903edeb9..4d0128e21 100644 --- a/outscale/resource_outscale_load_balancer_attributes.go +++ b/outscale/resource_outscale_load_balancer_attributes.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { @@ -69,7 +69,8 @@ func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { Schema: map[string]*schema.Schema{ "healthy_threshold": { Type: schema.TypeInt, - Required: true, + Optional: true, + Computed: true, ForceNew: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { htVal := val.(int) @@ -81,7 +82,8 @@ func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { }, "unhealthy_threshold": { Type: schema.TypeInt, - Required: true, + Optional: true, + Computed: true, ForceNew: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { uhtVal := val.(int) @@ -121,7 +123,8 @@ func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { }, "check_interval": { Type: schema.TypeInt, - Required: true, + Optional: true, + Computed: true, ForceNew: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { ciVal := val.(int) @@ -133,7 +136,8 @@ func resourceOutscaleOAPILoadBalancerAttributes() *schema.Resource { }, "timeout": { Type: schema.TypeInt, - Required: true, + Optional: true, + Computed: true, ForceNew: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { tVal := val.(int) @@ -422,12 +426,11 @@ func resourceOutscaleOAPILoadBalancerAttributesRead(d *schema.ResourceData, meta d.Set("access_log", make([]interface{}, 0)) } - sgr := make(map[string]string) if lb.SourceSecurityGroup != nil { - sgr["security_group_name"] = *lb.SourceSecurityGroup.SecurityGroupName - sgr["security_group_account_id"] = *lb.SourceSecurityGroup.SecurityGroupAccountId + d.Set("source_security_group", flattenSource_sg(lb.SourceSecurityGroup)) + } else { + d.Set("security_groups", make([]map[string]interface{}, 0)) } - d.Set("source_security_group", sgr) if lb.SecurityGroups != nil { d.Set("security_groups", utils.StringSlicePtrToInterfaceSlice(lb.SecurityGroups)) @@ -484,9 +487,7 @@ func resourceOutscaleOAPILoadBalancerAttributesRead(d *schema.ResourceData, meta d.Set("load_balancer_sticky_cookie_policies", lbc) } - hls := make([]interface{}, 1) - hls[0] = flattenOAPIHealthCheck(lb.HealthCheck) - d.Set("health_check", hls) + d.Set("health_check", flattenOAPIHealthCheck(lb.HealthCheck)) d.Set("listeners", flattenOAPIListeners(lb.Listeners)) d.Set("dns_name", lb.DnsName) diff --git a/outscale/resource_outscale_load_balancer_attributes_test.go b/outscale/resource_outscale_load_balancer_attributes_test.go index d9e30292e..974c70b6d 100644 --- a/outscale/resource_outscale_load_balancer_attributes_test.go +++ b/outscale/resource_outscale_load_balancer_attributes_test.go @@ -5,10 +5,10 @@ import ( "testing" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILBUAttr_basic(t *testing.T) { diff --git a/outscale/resource_outscale_load_balancer_listener_rule.go b/outscale/resource_outscale_load_balancer_listener_rule.go index 94c15d13f..496a1bdd2 100644 --- a/outscale/resource_outscale_load_balancer_listener_rule.go +++ b/outscale/resource_outscale_load_balancer_listener_rule.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleLoadBalancerListenerRule() *schema.Resource { diff --git a/outscale/resource_outscale_load_balancer_policy.go b/outscale/resource_outscale_load_balancer_policy.go index 7a283b1d8..acf5702f8 100644 --- a/outscale/resource_outscale_load_balancer_policy.go +++ b/outscale/resource_outscale_load_balancer_policy.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { @@ -35,7 +35,8 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { }, }, "access_log": { - Type: schema.TypeMap, + Type: schema.TypeList, + Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -59,16 +60,16 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { }, }, "health_check": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "healthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "unhealthy_threshold": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "path": { @@ -76,11 +77,11 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { Computed: true, }, "check_interval": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "port": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "protocol": { @@ -88,7 +89,7 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { Computed: true, }, "timeout": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, }, @@ -130,7 +131,7 @@ func resourceOutscaleAppCookieStickinessPolicy() *schema.Resource { }, }, "source_security_group": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -340,12 +341,10 @@ func resourceOutscaleAppCookieStickinessPolicyCreate(d *schema.ResourceData, met } d.Set("load_balancer_sticky_cookie_policies", lbc) } - ssg := make(map[string]string) + if lb.SourceSecurityGroup != nil { - ssg["security_group_name"] = *lb.SourceSecurityGroup.SecurityGroupName - ssg["security_group_account_id"] = *lb.SourceSecurityGroup.SecurityGroupAccountId + d.Set("source_security_group", flattenSource_sg(lb.SourceSecurityGroup)) } - d.Set("source_security_group", ssg) d.Set("public_ip", lb.PublicIp) d.Set("secured_cookies", lb.SecuredCookies) d.Set("net_id", lb.NetId) diff --git a/outscale/resource_outscale_load_balancer_policy_test.go b/outscale/resource_outscale_load_balancer_policy_test.go index c283bfd3a..5bf8ebb57 100644 --- a/outscale/resource_outscale_load_balancer_policy_test.go +++ b/outscale/resource_outscale_load_balancer_policy_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleCookieStickinessPolicy_basic(t *testing.T) { diff --git a/outscale/resource_outscale_load_balancer_test.go b/outscale/resource_outscale_load_balancer_test.go index 64819b27c..3950cd8b6 100644 --- a/outscale/resource_outscale_load_balancer_test.go +++ b/outscale/resource_outscale_load_balancer_test.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILBUBasic(t *testing.T) { diff --git a/outscale/resource_outscale_load_balancer_vms.go b/outscale/resource_outscale_load_balancer_vms.go index a2b485387..7a48e49b3 100644 --- a/outscale/resource_outscale_load_balancer_vms.go +++ b/outscale/resource_outscale_load_balancer_vms.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPILBUAttachment() *schema.Resource { diff --git a/outscale/resource_outscale_load_balancer_vms_test.go b/outscale/resource_outscale_load_balancer_vms_test.go index d6c406f78..7fcd77859 100644 --- a/outscale/resource_outscale_load_balancer_vms_test.go +++ b/outscale/resource_outscale_load_balancer_vms_test.go @@ -5,8 +5,9 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" ) @@ -16,6 +17,7 @@ func TestAccOutscaleOAPILBUAttachment_basic(t *testing.T) { var conf oscgo.LoadBalancer omi := os.Getenv("OUTSCALE_IMAGEID") region := os.Getenv("OUTSCALE_REGION") + rand := acctest.RandIntRange(0, 50) testCheckInstanceAttached := func(count int) resource.TestCheckFunc { return func(*terraform.State) error { @@ -36,7 +38,7 @@ func TestAccOutscaleOAPILBUAttachment_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPILBUAttachmentConfig1(omi, region), + Config: testAccOutscaleOAPILBUAttachmentConfig1(rand, omi, region), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.bar", &conf), testCheckInstanceAttached(1), @@ -47,10 +49,10 @@ func TestAccOutscaleOAPILBUAttachment_basic(t *testing.T) { } // add one attachment -func testAccOutscaleOAPILBUAttachmentConfig1(omi, region string) string { +func testAccOutscaleOAPILBUAttachmentConfig1(num int, omi, region string) string { return fmt.Sprintf(` resource "outscale_load_balancer" "bar" { - load_balancer_name = "load-test12" + load_balancer_name = "load-test-%d" subregion_names = ["%sa"] listeners { backend_port = 8000 @@ -69,5 +71,5 @@ resource "outscale_load_balancer_vms" "foo1" { load_balancer_name = "${outscale_load_balancer.bar.id}" backend_vm_ids = ["${outscale_vm.foo1.id}"] } -`, region, omi) +`, num, region, omi) } diff --git a/outscale/resource_outscale_nat_service.go b/outscale/resource_outscale_nat_service.go index 762970c3e..49d631e84 100644 --- a/outscale/resource_outscale_nat_service.go +++ b/outscale/resource_outscale_nat_service.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPINatService() *schema.Resource { @@ -194,15 +194,9 @@ func resourceOAPINatServiceRead(d *schema.ResourceData, meta interface{}) error func resourceOutscaleOAPINatServiceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOAPINatServiceRead(d, meta) } diff --git a/outscale/resource_outscale_nat_service_test.go b/outscale/resource_outscale_nat_service_test.go index 718dc4f2a..270310a22 100644 --- a/outscale/resource_outscale_nat_service_test.go +++ b/outscale/resource_outscale_nat_service_test.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPINatService_basic(t *testing.T) { @@ -126,39 +126,39 @@ const testAccOAPINatGatewayConfig = ` } resource "outscale_subnet" "outscale_subnet" { - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id ip_range = "10.0.0.0/18" } resource "outscale_public_ip" "outscale_public_ip" {} resource "outscale_nat_service" "outscale_nat_service" { - depends_on = ["outscale_route.outscale_route"] - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - public_ip_id = "${outscale_public_ip.outscale_public_ip.public_ip_id}" + depends_on = [outscale_route.outscale_route] + subnet_id = outscale_subnet.outscale_subnet.subnet_id + public_ip_id = outscale_public_ip.outscale_public_ip.public_ip_id } resource "outscale_route_table" "outscale_route_table" { - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id } resource "outscale_route" "outscale_route" { depends_on = [outscale_route_table_link.outscale_route_table_link] destination_ip_range = "0.0.0.0/0" - gateway_id = "${outscale_internet_service_link.outscale_internet_service_link.internet_service_id}" - route_table_id = "${outscale_route_table.outscale_route_table.route_table_id}" + gateway_id = outscale_internet_service_link.outscale_internet_service_link.internet_service_id + route_table_id = outscale_route_table.outscale_route_table.route_table_id } resource "outscale_route_table_link" "outscale_route_table_link" { - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - route_table_id = "${outscale_route_table.outscale_route_table.id}" + subnet_id = outscale_subnet.outscale_subnet.subnet_id + route_table_id = outscale_route_table.outscale_route_table.id } resource "outscale_internet_service" "outscale_internet_service" {} resource "outscale_internet_service_link" "outscale_internet_service_link" { - net_id = "${outscale_net.outscale_net.net_id}" - internet_service_id = "${outscale_internet_service.outscale_internet_service.id}" + net_id = outscale_net.outscale_net.net_id + internet_service_id = outscale_internet_service.outscale_internet_service.id } ` diff --git a/outscale/resource_outscale_net.go b/outscale/resource_outscale_net.go index 411b01fe4..58f193699 100644 --- a/outscale/resource_outscale_net.go +++ b/outscale/resource_outscale_net.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPINet() *schema.Resource { @@ -136,15 +136,9 @@ func resourceOutscaleOAPINetRead(d *schema.ResourceData, meta interface{}) error func resourceOutscaleOAPINetUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPINetRead(d, meta) } diff --git a/outscale/resource_outscale_net_access_point.go b/outscale/resource_outscale_net_access_point.go index 852bf3612..4aafef869 100644 --- a/outscale/resource_outscale_net_access_point.go +++ b/outscale/resource_outscale_net_access_point.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -114,16 +114,9 @@ func resourceOutscaleNetAccessPointUpdate(d *schema.ResourceData, meta interface } if d.HasChange("tags") { - - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) } return resourceOutscaleNetAccessPointRead(d, meta) } diff --git a/outscale/resource_outscale_net_access_point_test.go b/outscale/resource_outscale_net_access_point_test.go index 1853117a9..842d8b6a1 100644 --- a/outscale/resource_outscale_net_access_point_test.go +++ b/outscale/resource_outscale_net_access_point_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPINetAccessPoint_basic(t *testing.T) { diff --git a/outscale/resource_outscale_net_attributes.go b/outscale/resource_outscale_net_attributes.go index ac81fc0b5..4b96eba2c 100644 --- a/outscale/resource_outscale_net_attributes.go +++ b/outscale/resource_outscale_net_attributes.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPILinAttributes() *schema.Resource { diff --git a/outscale/resource_outscale_net_attributes_test.go b/outscale/resource_outscale_net_attributes_test.go index 049b184f1..9ad0515df 100644 --- a/outscale/resource_outscale_net_attributes_test.go +++ b/outscale/resource_outscale_net_attributes_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPILinAttr_basic(t *testing.T) { @@ -70,8 +70,8 @@ const testAccOutscaleOAPILinAttrConfig = ` } resource "outscale_net_attributes" "outscale_net_attributes" { - net_id = "${outscale_net.vpc.id}" - dhcp_options_set_id = "${outscale_net.vpc2.dhcp_options_set_id}" + net_id = outscale_net.vpc.id + dhcp_options_set_id = outscale_net.vpc2.dhcp_options_set_id } ` @@ -97,7 +97,6 @@ func testAccOutscaleOAPILinAttrConfigwithoutDHCPID(vpc string) string { resource "outscale_net_attributes" "outscale_net_attributes" { net_id = %s - depends_on = ["outscale_net.vpc", "outscale_net.vpc2"] } `, vpc) diff --git a/outscale/resource_outscale_net_peering.go b/outscale/resource_outscale_net_peering.go index ffab0d9b9..f46955aa1 100644 --- a/outscale/resource_outscale_net_peering.go +++ b/outscale/resource_outscale_net_peering.go @@ -13,8 +13,8 @@ import ( "github.com/terraform-providers/terraform-provider-outscale/utils" "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPILinPeeringConnection() *schema.Resource { @@ -49,7 +49,7 @@ func resourceOutscaleOAPILinPeeringConnection() *schema.Resource { Computed: true, }, "state": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -187,23 +187,21 @@ func resourceOutscaleOAPILinPeeringRead(d *schema.ResourceData, meta interface{} log.Printf("[DEBUG] VPC PeerConn Source %s, Accepter %s", pc.SourceNet.GetAccountId(), pc.AccepterNet.GetAccountId()) - accepter := make(map[string]interface{}) - requester := make(map[string]interface{}) - stat := make(map[string]interface{}) - if !reflect.DeepEqual(pc.GetAccepterNet(), oscgo.AccepterNet{}) { - accepter["ip_range"] = pc.AccepterNet.GetIpRange() - accepter["account_id"] = pc.AccepterNet.GetAccountId() - accepter["net_id"] = pc.AccepterNet.GetNetId() + if err := d.Set("accepter_net", getOAPINetPeeringAccepterNet(pc.GetAccepterNet())); err != nil { + return err + } } - if !reflect.DeepEqual(pc.GetSourceNet(), oscgo.SourceNet{}) { - requester["ip_range"] = pc.SourceNet.GetIpRange() - requester["account_id"] = pc.SourceNet.GetAccountId() - requester["net_id"] = pc.SourceNet.GetNetId() + if !reflect.DeepEqual(pc.SourceNet, oscgo.SourceNet{}) { + if err := d.Set("source_net", getOAPINetPeeringSourceNet(pc.GetSourceNet())); err != nil { + return err + } } + if pc.State.GetName() != "" { - stat["name"] = pc.State.GetName() - stat["message"] = pc.State.GetMessage() + if err := d.Set("state", getOAPINetPeeringState(pc.GetState())); err != nil { + return err + } } if err := d.Set("accepter_net_id", pc.GetAccepterNet().NetId); err != nil { @@ -212,15 +210,6 @@ func resourceOutscaleOAPILinPeeringRead(d *schema.ResourceData, meta interface{} if err := d.Set("source_net_id", pc.GetSourceNet().NetId); err != nil { return err } - if err := d.Set("accepter_net", accepter); err != nil { - return err - } - if err := d.Set("source_net", requester); err != nil { - return err - } - if err := d.Set("state", stat); err != nil { - return err - } if err := d.Set("net_peering_id", pc.GetNetPeeringId()); err != nil { return err } @@ -234,15 +223,9 @@ func resourceOutscaleOAPILinPeeringRead(d *schema.ResourceData, meta interface{} func resourceOutscaleOAPINetPeeringUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPILinPeeringRead(d, meta) } @@ -312,7 +295,7 @@ func resourceOutscaleOAPILinPeeringConnectionStateRefreshFunc(conn *oscgo.APICli func vpcOAPIPeeringConnectionOptionsSchema() *schema.Schema { return &schema.Schema{ - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/outscale/resource_outscale_net_peering_acceptation.go b/outscale/resource_outscale_net_peering_acceptation.go index 94b86724e..1a8cd24df 100644 --- a/outscale/resource_outscale_net_peering_acceptation.go +++ b/outscale/resource_outscale_net_peering_acceptation.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPILinPeeringConnectionAccepter() *schema.Resource { @@ -29,7 +29,7 @@ func resourceOutscaleOAPILinPeeringConnectionAccepter() *schema.Resource { ForceNew: true, }, "state": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/outscale/resource_outscale_net_peering_acceptation_test.go b/outscale/resource_outscale_net_peering_acceptation_test.go index 90444e631..380b35532 100644 --- a/outscale/resource_outscale_net_peering_acceptation_test.go +++ b/outscale/resource_outscale_net_peering_acceptation_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILinPeeringConnectionAccepter_sameAccount(t *testing.T) { diff --git a/outscale/resource_outscale_net_peering_test.go b/outscale/resource_outscale_net_peering_test.go index dc33dd7d8..9582cd8f7 100644 --- a/outscale/resource_outscale_net_peering_test.go +++ b/outscale/resource_outscale_net_peering_test.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILinPeeringConnection_basic(t *testing.T) { diff --git a/outscale/resource_outscale_net_test.go b/outscale/resource_outscale_net_test.go index b6a091a9e..37e133ec5 100644 --- a/outscale/resource_outscale_net_test.go +++ b/outscale/resource_outscale_net_test.go @@ -9,14 +9,13 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILin_basic(t *testing.T) { t.Parallel() - var conf1 oscgo.Net - var conf2 oscgo.Net + var conf oscgo.Net resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -26,12 +25,9 @@ func TestAccOutscaleOAPILin_basic(t *testing.T) { { Config: testAccOutscaleOAPILinConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILinExists("outscale_net.vpc.0", &conf1), - testAccCheckOutscaleOAPILinExists("outscale_net.vpc.1", &conf2), + testAccCheckOutscaleOAPILinExists("outscale_net.vpc", &conf), resource.TestCheckResourceAttr( - "outscale_net.vpc.0", "ip_range", "10.0.0.0/16"), - resource.TestCheckResourceAttr( - "outscale_net.vpc.1", "ip_range", "10.0.0.0/16"), + "outscale_net.vpc", "ip_range", "10.0.0.0/16"), ), }, }, @@ -98,8 +94,6 @@ func testAccCheckOutscaleOAPILinExists(n string, res *oscgo.Net) resource.TestCh const testAccOutscaleOAPILinConfig = ` resource "outscale_net" "vpc" { ip_range = "10.0.0.0/16" - count = 2 - tags { key = "Name" value = "testacc-net-rs" diff --git a/outscale/resource_outscale_nic.go b/outscale/resource_outscale_nic.go index 104edb6ad..863528324 100644 --- a/outscale/resource_outscale_nic.go +++ b/outscale/resource_outscale_nic.go @@ -13,8 +13,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/openlyinc/pointy" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -61,7 +61,7 @@ func getOAPINicSchema() map[string]*schema.Schema { }, // Attributes "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -89,7 +89,7 @@ func getOAPINicSchema() map[string]*schema.Schema { }, }, "link_nic": { - Type: schema.TypeMap, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -159,14 +159,14 @@ func getOAPINicSchema() map[string]*schema.Schema { }, "private_ips": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "link_public_ip": { - Type: schema.TypeMap, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -257,7 +257,7 @@ func resourceOutscaleOAPINicCreate(d *schema.ResourceData, meta interface{}) err } if v, ok := d.GetOk("private_ips"); ok { - request.SetPrivateIps(expandPrivateIPLight(v.(*schema.Set).List())) + request.SetPrivateIps(expandPrivateIPLight(v.([]interface{}))) } log.Printf("[DEBUG] Creating network interface") @@ -283,7 +283,6 @@ func resourceOutscaleOAPINicCreate(d *schema.ResourceData, meta interface{}) err if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } if err := d.Set("tags", make([]map[string]interface{}, 0)); err != nil { @@ -312,7 +311,6 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error var resp oscgo.ReadNicsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(dnir).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) @@ -322,7 +320,6 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error }) if err != nil { - return fmt.Errorf("Error describing Network Interfaces : %s", err) } @@ -342,40 +339,19 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("description", eni.GetDescription()); err != nil { return err } - if err := d.Set("subnet_id", eni.GetSubnetId()); err != nil { return err } - - b := make(map[string]interface{}) - link := eni.GetLinkPublicIp() - b["public_ip_id"] = link.GetPublicIpId() - b["link_public_ip_id"] = link.GetLinkPublicIpId() - b["public_ip_account_id"] = link.GetPublicIpAccountId() - b["public_dns_name"] = link.GetPublicDnsName() - b["public_ip"] = link.GetPublicIp() - - if err := d.Set("link_public_ip", b); err != nil { - return err + if linkIp, ok := eni.GetLinkPublicIpOk(); ok { + if err := d.Set("link_public_ip", flattenLinkPublicIp(linkIp)); err != nil { + return err + } } - //aa := make([]map[string]interface{}, 1) - bb := make(map[string]interface{}) - att := eni.GetLinkNic() - bb["link_nic_id"] = att.GetLinkNicId() - bb["delete_on_vm_deletion"] = strconv.FormatBool(att.GetDeleteOnVmDeletion()) - bb["device_number"] = fmt.Sprintf("%d", att.GetDeviceNumber()) - bb["vm_id"] = att.GetVmId() - bb["vm_account_id"] = att.GetVmAccountId() - bb["state"] = att.GetState() - - //aa[0] = bb - // if err := d.Set("link_nic", aa); err != nil { - // return err - // } - - if err := d.Set("link_nic", bb); err != nil { - return err + if linkNic, ok := eni.GetLinkNicOk(); ok { + if err := d.Set("link_nic", flattenLinkNic(linkNic)); err != nil { + return err + } } if err := d.Set("subregion_name", eni.GetSubregionName()); err != nil { @@ -405,7 +381,6 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("private_dns_name", eni.GetPrivateDnsName()); err != nil { return err } - //d.Set("private_ip", eni.) y := make([]map[string]interface{}, len(eni.GetPrivateIps())) if eni.PrivateIps != nil { @@ -413,14 +388,14 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error b := make(map[string]interface{}) d := make(map[string]interface{}) - assoc := v.GetLinkPublicIp() - d["public_ip_id"] = assoc.GetPublicIpId() - d["link_public_ip_id"] = assoc.GetLinkPublicIpId() - d["public_ip_account_id"] = assoc.GetPublicIpAccountId() - d["public_dns_name"] = assoc.GetPublicDnsName() - d["public_ip"] = assoc.GetPublicIp() - - b["link_public_ip"] = d + if assoc, ok := v.GetLinkPublicIpOk(); ok { + d["public_ip_id"] = assoc.GetPublicIpId() + d["link_public_ip_id"] = assoc.GetLinkPublicIpId() + d["public_ip_account_id"] = assoc.GetPublicIpAccountId() + d["public_dns_name"] = assoc.GetPublicDnsName() + d["public_ip"] = assoc.GetPublicIp() + b["link_public_ip"] = d + } b["private_dns_name"] = v.GetPrivateDnsName() b["private_ip"] = v.GetPrivateIp() b["is_primary"] = v.GetIsPrimary() @@ -527,7 +502,6 @@ func resourceOutscaleOAPINicDetach(meta interface{}, nicID string) error { // Update OAPINic func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) var err error if d.HasChange("link_nic") { @@ -559,7 +533,6 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error Attaching Network Interface: %s", err) } } - d.SetPartial("link_nic") } if d.HasChange("private_ips") { @@ -603,7 +576,6 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Failure to assign Private IPs: %s", err) } } - d.SetPartial("private_ip") } if d.HasChange("private_ips_count") { @@ -628,7 +600,6 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err NicId: d.Id(), SecondaryPrivateIpCount: pointy.Int32(dif), } - // _, err := conn.VM.AssignPrivateIpAddresses(input) err := resource.Retry(5*time.Minute, func() *resource.RetryError { var err error @@ -660,7 +631,6 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Failure to unassign Private IPs: %s", err) } } - d.SetPartial("private_ips_count") } } @@ -682,8 +652,6 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err if err != nil { return fmt.Errorf("Failure updating ENI: %s", err) } - - d.SetPartial("security_groups") } if d.HasChange("description") { @@ -704,17 +672,11 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err if err != nil { return fmt.Errorf("Failure updating ENI: %s", err) } - d.SetPartial("description") } if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) - return resourceOutscaleOAPINicRead(d, meta) } @@ -741,3 +703,24 @@ func flattenPrivateIPLightToStringSlice(pIPs []interface{}) []string { } return privateIPs } + +func flattenLinkPublicIp(linkIp *oscgo.LinkPublicIp) []map[string]interface{} { + return []map[string]interface{}{{ + "public_ip_id": linkIp.GetPublicIpId(), + "link_public_ip_id": linkIp.GetLinkPublicIpId(), + "public_ip_account_id": linkIp.GetPublicIpAccountId(), + "public_dns_name": linkIp.GetPublicDnsName(), + "public_ip": linkIp.GetPublicIp(), + }} +} + +func flattenLinkNic(linkNic *oscgo.LinkNic) []map[string]interface{} { + return []map[string]interface{}{{ + "link_nic_id": linkNic.GetLinkNicId(), + "delete_on_vm_deletion": strconv.FormatBool(linkNic.GetDeleteOnVmDeletion()), + "device_number": linkNic.GetDeviceNumber(), + "vm_id": linkNic.GetVmId(), + "vm_account_id": linkNic.GetVmAccountId(), + "state": linkNic.GetState(), + }} +} diff --git a/outscale/resource_outscale_nic_link.go b/outscale/resource_outscale_nic_link.go index 8c05abd1e..d9b344655 100644 --- a/outscale/resource_outscale_nic_link.go +++ b/outscale/resource_outscale_nic_link.go @@ -12,8 +12,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPINetworkInterfaceAttachment() *schema.Resource { @@ -117,7 +117,7 @@ func resourceOutscaleOAPINetworkInterfaceAttachmentRead(d *schema.ResourceData, resp, err := stateConf.WaitForState() if err != nil { return fmt.Errorf( - "Error waiting for Volume to attach to Instance: %s, error: %s", nicID, err) + "Error waiting for NIC to attach to Instance: %s, error: %s", nicID, err) } r := resp.(oscgo.ReadNicsResponse) diff --git a/outscale/resource_outscale_nic_link_test.go b/outscale/resource_outscale_nic_link_test.go index 216f80cb4..fa996a15c 100644 --- a/outscale/resource_outscale_nic_link_test.go +++ b/outscale/resource_outscale_nic_link_test.go @@ -9,13 +9,12 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/terraform-providers/terraform-provider-outscale/utils" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccOutscaleNicLink_Basic(t *testing.T) { diff --git a/outscale/resource_outscale_nic_private_ip.go b/outscale/resource_outscale_nic_private_ip.go index 510cdd17f..6b482bbf0 100644 --- a/outscale/resource_outscale_nic_private_ip.go +++ b/outscale/resource_outscale_nic_private_ip.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPINetworkInterfacePrivateIP() *schema.Resource { diff --git a/outscale/resource_outscale_nic_private_ip_test.go b/outscale/resource_outscale_nic_private_ip_test.go index 42f25abf7..739be3de0 100644 --- a/outscale/resource_outscale_nic_private_ip_test.go +++ b/outscale/resource_outscale_nic_private_ip_test.go @@ -7,7 +7,7 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPINetworkInterfacePrivateIPBasic(t *testing.T) { diff --git a/outscale/resource_outscale_nic_test.go b/outscale/resource_outscale_nic_test.go index 468e75a39..869a3110c 100644 --- a/outscale/resource_outscale_nic_test.go +++ b/outscale/resource_outscale_nic_test.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIENI_basic(t *testing.T) { diff --git a/outscale/resource_outscale_public_ip.go b/outscale/resource_outscale_public_ip.go index b1ac7eeaf..bcc5184be 100644 --- a/outscale/resource_outscale_public_ip.go +++ b/outscale/resource_outscale_public_ip.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) @@ -181,16 +181,10 @@ func resourceOutscaleOAPIPublicIPUpdate(d *schema.ResourceData, meta interface{} } } - d.Partial(true) if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) - return resourceOutscaleOAPIPublicIPRead(d, meta) } diff --git a/outscale/resource_outscale_public_ip_link.go b/outscale/resource_outscale_public_ip_link.go index 1b3230ee4..ade6c5fb6 100644 --- a/outscale/resource_outscale_public_ip_link.go +++ b/outscale/resource_outscale_public_ip_link.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIPublicIPLink() *schema.Resource { diff --git a/outscale/resource_outscale_public_ip_link_test.go b/outscale/resource_outscale_public_ip_link_test.go index 6d450c3e7..1130f1687 100644 --- a/outscale/resource_outscale_public_ip_link_test.go +++ b/outscale/resource_outscale_public_ip_link_test.go @@ -13,8 +13,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIPublicIPLink_basic(t *testing.T) { diff --git a/outscale/resource_outscale_public_ip_test.go b/outscale/resource_outscale_public_ip_test.go index 86d36aa6b..eaa9972d2 100644 --- a/outscale/resource_outscale_public_ip_test.go +++ b/outscale/resource_outscale_public_ip_test.go @@ -3,15 +3,17 @@ package outscale import ( "context" "fmt" + "net/http" "os" "strings" "testing" "time" oscgo "github.com/outscale/osc-sdk-go/v2" + "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIPublicIP_basic(t *testing.T) { @@ -145,18 +147,22 @@ func testAccCheckOutscaleOAPIPublicIPDestroy(s *terraform.State) error { } var response oscgo.ReadPublicIpsResponse + var statusCode int err := resource.Retry(60*time.Second, func() *resource.RetryError { - var err error - response, _, err = conn.OSCAPI.PublicIpApi.ReadPublicIps(context.Background()).ReadPublicIpsRequest(req).Execute() - return resource.RetryableError(err) + rp, httpResp, err := conn.OSCAPI.PublicIpApi.ReadPublicIps(context.Background()).ReadPublicIpsRequest(req).Execute() + if err != nil { + return utils.CheckThrottling(httpResp, err) + } + response = rp + statusCode = httpResp.StatusCode + return nil }) if err != nil { // Verify the error is what we want - if e := fmt.Sprint(err); strings.Contains(e, "InvalidAllocationID.NotFound") || strings.Contains(e, "InvalidPublicIps.NotFound") { + if statusCode == http.StatusNotFound { return nil } - return err } diff --git a/outscale/resource_outscale_route.go b/outscale/resource_outscale_route.go index 45f82c04a..644f6597f 100644 --- a/outscale/resource_outscale_route.go +++ b/outscale/resource_outscale_route.go @@ -13,8 +13,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) var errOAPIRoute = errors.New("Error: more than 1 target specified. Only 1 of gateway_id, " + @@ -142,6 +142,7 @@ func resourceOutscaleOAPIRouteCreate(d *schema.ResourceData, meta interface{}) e _, httpResp, err := conn.RouteApi.CreateRoute(context.Background()).CreateRouteRequest(createOpts).Execute() if err != nil { if strings.Contains(fmt.Sprint(err), utils.InvalidState) { + log.Printf("[OKHT] === ERROR: %v ====\n", err) log.Printf("[DEBUG] Trying to create route again: %q", err) return resource.RetryableError(err) } @@ -168,7 +169,10 @@ func resourceOutscaleOAPIRouteCreate(d *schema.ResourceData, meta interface{}) e return resource.RetryableError(fmt.Errorf("still await route to be active")) } } - return resource.RetryableError(err) + if err != nil { + return resource.NonRetryableError(err) + } + return nil }) if err != nil { return fmt.Errorf("Error finding route after creating it: %s", err) diff --git a/outscale/resource_outscale_route_table.go b/outscale/resource_outscale_route_table.go index fde4a2ebe..8c3073f8a 100644 --- a/outscale/resource_outscale_route_table.go +++ b/outscale/resource_outscale_route_table.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIRouteTable() *schema.Resource { @@ -181,7 +181,6 @@ func resourceOutscaleOAPIRouteTableCreate(d *schema.ResourceData, meta interface if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } a := make([]interface{}, 0) @@ -234,15 +233,9 @@ func resourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface{} func resourceOutscaleOAPIRouteTableUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPIRouteTableRead(d, meta) } diff --git a/outscale/resource_outscale_route_table_link.go b/outscale/resource_outscale_route_table_link.go index b974155bb..cbc958ccc 100644 --- a/outscale/resource_outscale_route_table_link.go +++ b/outscale/resource_outscale_route_table_link.go @@ -12,8 +12,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) const ( diff --git a/outscale/resource_outscale_route_table_link_test.go b/outscale/resource_outscale_route_table_link_test.go index 4ad202b43..c70db393f 100644 --- a/outscale/resource_outscale_route_table_link_test.go +++ b/outscale/resource_outscale_route_table_link_test.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPILinkRouteTable_basic(t *testing.T) { diff --git a/outscale/resource_outscale_route_table_test.go b/outscale/resource_outscale_route_table_test.go index 1fd4ccdd7..73bdb7c64 100644 --- a/outscale/resource_outscale_route_table_test.go +++ b/outscale/resource_outscale_route_table_test.go @@ -12,8 +12,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIRouteTable_basic(t *testing.T) { diff --git a/outscale/resource_outscale_route_test.go b/outscale/resource_outscale_route_test.go index f82a24365..e19da4b8c 100644 --- a/outscale/resource_outscale_route_test.go +++ b/outscale/resource_outscale_route_test.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIRoute_noopdiff(t *testing.T) { diff --git a/outscale/resource_outscale_security_group.go b/outscale/resource_outscale_security_group.go index d13d58a56..1f6b687f1 100644 --- a/outscale/resource_outscale_security_group.go +++ b/outscale/resource_outscale_security_group.go @@ -8,10 +8,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPISecurityGroup() *schema.Resource { @@ -215,9 +215,7 @@ func resourceOutscaleOAPISecurityGroupCreate(d *schema.ResourceData, meta interf if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } - return resourceOutscaleOAPISecurityGroupRead(d, meta) } @@ -299,15 +297,9 @@ func SGOAPIStateRefreshFunc(conn *oscgo.APIClient, id string) resource.StateRefr func resourceOutscaleOAPISecurityGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPISecurityGroupRead(d, meta) } diff --git a/outscale/resource_outscale_security_group_rule.go b/outscale/resource_outscale_security_group_rule.go index 89b9da406..7c6de7e0c 100644 --- a/outscale/resource_outscale_security_group_rule.go +++ b/outscale/resource_outscale_security_group_rule.go @@ -13,9 +13,9 @@ import ( "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func resourceOutscaleOAPIOutboundRule() *schema.Resource { diff --git a/outscale/resource_outscale_security_group_rule_test.go b/outscale/resource_outscale_security_group_rule_test.go index a487bef76..713b84075 100644 --- a/outscale/resource_outscale_security_group_rule_test.go +++ b/outscale/resource_outscale_security_group_rule_test.go @@ -11,9 +11,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleSecurityGroupRule_basic(t *testing.T) { diff --git a/outscale/resource_outscale_security_group_test.go b/outscale/resource_outscale_security_group_test.go index dd4452549..c5a812f5f 100644 --- a/outscale/resource_outscale_security_group_test.go +++ b/outscale/resource_outscale_security_group_test.go @@ -6,9 +6,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPISecurityGroup(t *testing.T) { diff --git a/outscale/resource_outscale_server_certificate.go b/outscale/resource_outscale_server_certificate.go index 6be8fbed8..b9cd2a05a 100644 --- a/outscale/resource_outscale_server_certificate.go +++ b/outscale/resource_outscale_server_certificate.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/openlyinc/pointy" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" diff --git a/outscale/resource_outscale_server_certificate_test.go b/outscale/resource_outscale_server_certificate_test.go index ef17a7e99..b15190365 100644 --- a/outscale/resource_outscale_server_certificate_test.go +++ b/outscale/resource_outscale_server_certificate_test.go @@ -6,12 +6,11 @@ import ( "testing" "time" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccOutscaleOAPIServerCertificate_basic(t *testing.T) { diff --git a/outscale/resource_outscale_snapshot.go b/outscale/resource_outscale_snapshot.go index 310b3942a..ab0c84325 100644 --- a/outscale/resource_outscale_snapshot.go +++ b/outscale/resource_outscale_snapshot.go @@ -8,10 +8,10 @@ import ( "time" oscgo "github.com/outscale/osc-sdk-go/v2" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPISnapshot() *schema.Resource { @@ -262,15 +262,9 @@ func resourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{}) func resourceOutscaleOAPISnapshotUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) return resourceOutscaleOAPISnapshotRead(d, meta) } diff --git a/outscale/resource_outscale_snapshot_attributes.go b/outscale/resource_outscale_snapshot_attributes.go index d8cbfc38a..f29668fb3 100644 --- a/outscale/resource_outscale_snapshot_attributes.go +++ b/outscale/resource_outscale_snapshot_attributes.go @@ -8,8 +8,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourcedOutscaleOAPISnapshotAttributes() *schema.Resource { diff --git a/outscale/resource_outscale_snapshot_attributes_test.go b/outscale/resource_outscale_snapshot_attributes_test.go index 51cbcfa3b..11b5aac50 100644 --- a/outscale/resource_outscale_snapshot_attributes_test.go +++ b/outscale/resource_outscale_snapshot_attributes_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPISnapshotAttributes_Basic(t *testing.T) { diff --git a/outscale/resource_outscale_snapshot_export_task.go b/outscale/resource_outscale_snapshot_export_task.go index d503fb34d..7a38824ec 100644 --- a/outscale/resource_outscale_snapshot_export_task.go +++ b/outscale/resource_outscale_snapshot_export_task.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPISnapshotExportTask() *schema.Resource { @@ -173,7 +173,6 @@ func resourceOAPISnapshotExportTaskCreate(d *schema.ResourceData, meta interface if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } _, err = resourceOutscaleSnapshotTaskWaitForAvailable(id, conn, d.Timeout(schema.TimeoutCreate)) if err != nil { @@ -265,14 +264,9 @@ func resourceOAPISnapshotExportTaskRead(d *schema.ResourceData, meta interface{} func resourceOAPISnapshotExportTaskUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - - d.Partial(false) - return resourceOAPISnapshotExportTaskRead(d, meta) } diff --git a/outscale/resource_outscale_snapshot_export_task_test.go b/outscale/resource_outscale_snapshot_export_task_test.go index 30b712557..00a14cf23 100644 --- a/outscale/resource_outscale_snapshot_export_task_test.go +++ b/outscale/resource_outscale_snapshot_export_task_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPISnapshotExportTask_basic(t *testing.T) { diff --git a/outscale/resource_outscale_snapshot_test.go b/outscale/resource_outscale_snapshot_test.go index 585930aa0..4e59f236a 100644 --- a/outscale/resource_outscale_snapshot_test.go +++ b/outscale/resource_outscale_snapshot_test.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPISnapshot_basic(t *testing.T) { diff --git a/outscale/resource_outscale_subnet.go b/outscale/resource_outscale_subnet.go index 4fc1bec38..8530cb002 100644 --- a/outscale/resource_outscale_subnet.go +++ b/outscale/resource_outscale_subnet.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_subnet_test.go b/outscale/resource_outscale_subnet_test.go index e25d90250..b92de6608 100644 --- a/outscale/resource_outscale_subnet_test.go +++ b/outscale/resource_outscale_subnet_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) diff --git a/outscale/resource_outscale_tags.go b/outscale/resource_outscale_tags.go index 5016abdf7..e721b1dec 100644 --- a/outscale/resource_outscale_tags.go +++ b/outscale/resource_outscale_tags.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPITags() *schema.Resource { diff --git a/outscale/resource_outscale_tags_test.go b/outscale/resource_outscale_tags_test.go index 38fa71ada..3593c19fa 100644 --- a/outscale/resource_outscale_tags_test.go +++ b/outscale/resource_outscale_tags_test.go @@ -13,9 +13,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVM_tags(t *testing.T) { diff --git a/outscale/resource_outscale_virtual_gateway.go b/outscale/resource_outscale_virtual_gateway.go index 7fef40579..590eb8b57 100644 --- a/outscale/resource_outscale_virtual_gateway.go +++ b/outscale/resource_outscale_virtual_gateway.go @@ -7,12 +7,11 @@ import ( "net/http" "time" + "github.com/aws/aws-sdk-go/aws" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceOutscaleOAPIVirtualGateway() *schema.Resource { @@ -112,9 +111,7 @@ func resourceOutscaleOAPIVirtualGatewayCreate(d *schema.ResourceData, meta inter if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tag") } - return resourceOutscaleOAPIVirtualGatewayRead(d, meta) } @@ -154,26 +151,20 @@ func resourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interfa d.SetId("") return nil } - vpnLink := oapiVpnGatewayGetLink(virtualGateway) - if len(virtualGateway.GetNetToVirtualGatewayLinks()) == 0 || vpnLink.GetState() == "detached" { - d.Set("net_id", "") - } else { - d.Set("net_id", vpnLink.GetNetId()) - } - - vs := make([]map[string]interface{}, len(virtualGateway.GetNetToVirtualGatewayLinks())) - - for k, v := range virtualGateway.GetNetToVirtualGatewayLinks() { - vp := make(map[string]interface{}) - vp["state"] = v.GetState() - vp["net_id"] = v.GetNetId() - - vs[k] = vp + if virtualGateway.HasNetToVirtualGatewayLinks() { + vs := make([]map[string]interface{}, len(virtualGateway.GetNetToVirtualGatewayLinks())) + for k, v := range virtualGateway.GetNetToVirtualGatewayLinks() { + vp := make(map[string]interface{}) + vp["state"] = v.GetState() + vp["net_id"] = v.GetNetId() + vs[k] = vp + } + d.Set("net_to_virtual_gateway_links", vs) } d.Set("connection_type", virtualGateway.GetConnectionType()) d.Set("virtual_gateway_id", virtualGateway.GetVirtualGatewayId()) - d.Set("net_to_virtual_gateway_links", vs) + d.Set("state", virtualGateway.State) d.Set("tags", tagsOSCAPIToMap(virtualGateway.GetTags())) @@ -182,13 +173,9 @@ func resourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interfa func resourceOutscaleOAPIVirtualGatewayUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - d.Partial(false) - return nil } diff --git a/outscale/resource_outscale_virtual_gateway_link.go b/outscale/resource_outscale_virtual_gateway_link.go index 0a6f341d0..8dd24de5c 100644 --- a/outscale/resource_outscale_virtual_gateway_link.go +++ b/outscale/resource_outscale_virtual_gateway_link.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceOutscaleOAPIVirtualGatewayLink() *schema.Resource { diff --git a/outscale/resource_outscale_virtual_gateway_link_test.go b/outscale/resource_outscale_virtual_gateway_link_test.go index 8ef3cac48..3d17caa22 100644 --- a/outscale/resource_outscale_virtual_gateway_link_test.go +++ b/outscale/resource_outscale_virtual_gateway_link_test.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVpnGatewayAttachment_basic(t *testing.T) { @@ -23,6 +23,7 @@ func TestAccOutscaleOAPIVpnGatewayAttachment_basic(t *testing.T) { }, IDRefreshName: "outscale_virtual_gateway_link.test", Providers: testAccProviders, + CheckDestroy: testAccCheckOAPIVpnGatewayAttachmentDestroy, Steps: []resource.TestStep{ { Config: testAccOAPIVpnGatewayAttachmentConfig, @@ -33,6 +34,8 @@ func TestAccOutscaleOAPIVpnGatewayAttachment_basic(t *testing.T) { testAccCheckOAPIVirtualGatewayExists( "outscale_virtual_gateway.test", &vgw), + testAccCheckOAPIVpnGatewayAttachmentExists( + "outscale_virtual_gateway_link.test"), ), }, }, @@ -73,8 +76,8 @@ func testAccCheckVpnGatewayAttachmentImportStateIDFunc(resourceName string) reso func TestAccAWSOAPIVpnGatewayAttachment_deleted(t *testing.T) { t.Parallel() - var vgw oscgo.VirtualGateway var vpc oscgo.Net + var vgw oscgo.VirtualGateway testDeleted := func(n string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -104,8 +107,7 @@ func TestAccAWSOAPIVpnGatewayAttachment_deleted(t *testing.T) { "outscale_virtual_gateway.test", &vgw), testAccCheckOAPIVpnGatewayAttachmentExists( - "outscale_virtual_gateway_link.test", - &vgw), + "outscale_virtual_gateway_link.test"), ), }, { @@ -118,8 +120,9 @@ func TestAccAWSOAPIVpnGatewayAttachment_deleted(t *testing.T) { }) } -func testAccCheckOAPIVpnGatewayAttachmentExists(n string, vgw *oscgo.VirtualGateway) resource.TestCheckFunc { +func testAccCheckOAPIVpnGatewayAttachmentExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) @@ -129,23 +132,36 @@ func testAccCheckOAPIVpnGatewayAttachmentExists(n string, vgw *oscgo.VirtualGate return fmt.Errorf("No ID is set") } - vpcID := rs.Primary.Attributes["net_id"] - vgwID := rs.Primary.Attributes["virtual_gateway_id"] + var resp oscgo.ReadVirtualGatewaysResponse + var err error - if len(vgw.GetNetToVirtualGatewayLinks()) == 0 { - return fmt.Errorf("vpn gateway %q has no attachments", vgwID) + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + rp, httpResp, err := conn.VirtualGatewayApi.ReadVirtualGateways(context.Background()).ReadVirtualGatewaysRequest(oscgo.ReadVirtualGatewaysRequest{ + Filters: &oscgo.FiltersVirtualGateway{VirtualGatewayIds: &[]string{rs.Primary.ID}}, + }).Execute() + if err != nil { + return utils.CheckThrottling(httpResp, err) + } + resp = rp + return nil + }) + if err != nil { + return err } + if len(resp.GetVirtualGateways()) == 0 { + return fmt.Errorf("Virtual gateway has no attachments") + } + vgw := resp.GetVirtualGateways()[0] if vgw.GetNetToVirtualGatewayLinks()[0].GetState() != "attached" { - return fmt.Errorf("Expected VPN Gateway %q to be in attached state, but got: %q", - vgwID, vgw.GetNetToVirtualGatewayLinks()[0].GetState()) + return fmt.Errorf("Expected Virtual Gateway to be in attached state, but got: %q", + vgw.GetNetToVirtualGatewayLinks()[0].GetState()) } - if vgw.GetNetToVirtualGatewayLinks()[0].GetNetId() != vpcID { - return fmt.Errorf("Expected VPN Gateway %q to be attached to VPC %q, but got: %q", - vgwID, vpcID, vgw.GetNetToVirtualGatewayLinks()[0].GetNetId()) + if vgw.GetNetToVirtualGatewayLinks()[0].GetNetId() == "" { + return fmt.Errorf("Expected Virtual Gateway to be attached to VPC, but got: %q", + vgw.GetNetToVirtualGatewayLinks()[0].GetNetId()) } - return nil } } @@ -158,8 +174,7 @@ func testAccCheckOAPIVpnGatewayAttachmentDestroy(s *terraform.State) error { continue } - vgwID := rs.Primary.Attributes["vpn_gateway_id"] - + vgwID := rs.Primary.Attributes["virtual_gateway_id"] var resp oscgo.ReadVirtualGatewaysResponse var err error diff --git a/outscale/resource_outscale_virtual_gateway_route_propagation.go b/outscale/resource_outscale_virtual_gateway_route_propagation.go index 4ad80fb43..56170c568 100644 --- a/outscale/resource_outscale_virtual_gateway_route_propagation.go +++ b/outscale/resource_outscale_virtual_gateway_route_propagation.go @@ -6,11 +6,10 @@ import ( "log" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceOutscaleOAPIVirtualGatewayRoutePropagation() *schema.Resource { diff --git a/outscale/resource_outscale_virtual_gateway_route_propagation_test.go b/outscale/resource_outscale_virtual_gateway_route_propagation_test.go index 237067bfd..c471a3f57 100644 --- a/outscale/resource_outscale_virtual_gateway_route_propagation_test.go +++ b/outscale/resource_outscale_virtual_gateway_route_propagation_test.go @@ -9,8 +9,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVirtualRoutePropagation_basic(t *testing.T) { diff --git a/outscale/resource_outscale_virtual_gateway_test.go b/outscale/resource_outscale_virtual_gateway_test.go index 2bb59bdfe..299fa4eaf 100644 --- a/outscale/resource_outscale_virtual_gateway_test.go +++ b/outscale/resource_outscale_virtual_gateway_test.go @@ -8,11 +8,10 @@ import ( "testing" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccOutscaleOAPIVirtualGateway_basic(t *testing.T) { diff --git a/outscale/resource_outscale_vm.go b/outscale/resource_outscale_vm.go index 168245a4e..5ab9a9528 100644 --- a/outscale/resource_outscale_vm.go +++ b/outscale/resource_outscale_vm.go @@ -10,8 +10,8 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" @@ -41,7 +41,7 @@ func resourceOutscaleOApiVM() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bsu": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Computed: true, MaxItems: 1, @@ -50,6 +50,7 @@ func resourceOutscaleOApiVM() *schema.Resource { "delete_on_vm_deletion": { Type: schema.TypeBool, Optional: true, + Computed: true, }, "iops": { Type: schema.TypeInt, @@ -236,8 +237,7 @@ func resourceOutscaleOApiVM() *schema.Resource { ForceNew: true, }, "link_nic": { - Type: schema.TypeList, - MaxItems: 1, + Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -376,13 +376,11 @@ func resourceOutscaleOApiVM() *schema.Resource { }, "block_device_mappings_created": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bsu": { - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -395,11 +393,11 @@ func resourceOutscaleOApiVM() *schema.Resource { Computed: true, }, "state": { - Type: schema.TypeInt, + Type: schema.TypeString, Computed: true, }, "volume_id": { - Type: schema.TypeFloat, + Type: schema.TypeString, Computed: true, }, }, @@ -694,9 +692,6 @@ func getOAPIVMAdminPassword(VMID string, conn *oscgo.APIClient) (string, error) func resourceOAPIVMUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - d.Partial(true) - id := d.Get("vm_id").(string) nothingToDo := true @@ -872,10 +867,6 @@ func resourceOAPIVMUpdate(d *schema.ResourceData, meta interface{}) error { return err } - d.SetPartial("tags") - - d.Partial(false) - if onlyTags { goto out } @@ -1035,7 +1026,7 @@ func expandBlockDeviceOApiMappings(d *schema.ResourceData) ([]oscgo.BlockDeviceM blockDevice := oscgo.BlockDeviceMappingVmCreation{} value := v.(map[string]interface{}) - if bsu, ok := value["bsu"].([]interface{}); ok && len(bsu) > 0 { + if bsu := value["bsu"].(*schema.Set).List(); len(bsu) > 0 { expandBSU, err := expandBlockDeviceBSU(bsu[0].(map[string]interface{})) if err != nil { return nil, err diff --git a/outscale/resource_outscale_vm_test.go b/outscale/resource_outscale_vm_test.go index 7308bafd6..a7fa6520f 100644 --- a/outscale/resource_outscale_vm_test.go +++ b/outscale/resource_outscale_vm_test.go @@ -11,9 +11,9 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVM_Basic(t *testing.T) { @@ -207,41 +207,6 @@ func TestAccOutscaleOAPIVM_withNics(t *testing.T) { }) } -func TestAccOutscaleOAPIVM_Update(t *testing.T) { - region := os.Getenv("OUTSCALE_REGION") - omi := os.Getenv("OUTSCALE_IMAGEID") - keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") - - var before oscgo.Vm - var after oscgo.Vm - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, - Steps: []resource.TestStep{ - { - Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region, keypair, sgId), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &before), - testAccCheckOutscaleOAPIVMAttributes(t, &before, omi), - resource.TestCheckResourceAttr("outscale_vm.basic", "image_id", omi), - resource.TestCheckResourceAttr("outscale_vm.basic", "vm_type", "tinav4.c2r2p2"), - ), - }, - { - Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region, keypair, sgId), - Check: resource.ComposeTestCheckFunc( - testAccCheckOAPIVMExists("outscale_vm.basic", &after), - testAccCheckOAPIVMNotRecreated(t, &before, &after), - resource.TestCheckResourceAttr("outscale_vm.basic", "vm_type", "tinav4.c2r2p2"), - ), - }, - }, - }) -} - func TestAccOutscaleOAPIVM_WithSubnet(t *testing.T) { var server oscgo.Vm omi := os.Getenv("OUTSCALE_IMAGEID") @@ -305,15 +270,15 @@ func TestAccOutscaleOAPIVM_DeletionProtectionUpdate(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, "true", keypair), + Config: testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, keypair, true), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("outscale_vm.outscale_vm", "deletion_protection", "true"), + resource.TestCheckResourceAttr("outscale_vm.outscale_vm1", "deletion_protection", "true"), ), }, { - Config: testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, "false", keypair), + Config: testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, keypair, false), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("outscale_vm.outscale_vm", "deletion_protection", "false"), + resource.TestCheckResourceAttr("outscale_vm.outscale_vm1", "deletion_protection", "false"), ), }, }, @@ -438,15 +403,15 @@ func testAccCheckOutscaleVMWithMultiBlockDeviceMapping(region, omi, keypair stri `, region, omi, keypair) } -func testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, deletionProtection, keypair string) string { +func testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, keypair string, deletionProtection bool) string { return fmt.Sprintf(` - resource "outscale_vm" "outscale_vm" { + resource "outscale_vm" "outscale_vm1" { image_id = "%[1]s" vm_type = "tinav4.c2r2p2" - keypair_name = "%[3]s" - deletion_protection = %[2]s + keypair_name = "%[2]s" + deletion_protection = %[3]t } - `, omi, deletionProtection, keypair) + `, omi, keypair, deletionProtection) } //TODO: check if is needed @@ -774,44 +739,10 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair string) }`, omi, vmType, keypair) } -func testAccVmsConfigUpdateOAPIVMKey(omi, vmType, region, keypair, sgId string) string { - return fmt.Sprintf(` - resource "outscale_net" "net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-security-group-rs" - } - } - - resource "outscale_security_group" "sg" { - security_group_name = "%[4]s" - description = "Used in the terraform acceptance tests" - - tags { - key = "Name" - value = "tf-acc-test" - } - - net_id = outscale_net.net.id - } - - resource "outscale_vm" "basic" { - image_id = "%[1]s" - vm_type = "%[2]s" - keypair_name = "%[4]s" - security_group_ids = ["%[5]s"] - placement_subregion_name = "%[3]sb" - } - `, omi, vmType, region, keypair, sgId) -} - func testAccVmsConfigUpdateOAPIVMTags(omi, vmType string, region, value, keypair, sgId string) string { return fmt.Sprintf(` resource "outscale_net" "net" { ip_range = "10.0.0.0/16" - tags { key = "Name" value = "testacc-security-group-rs" @@ -821,12 +752,10 @@ func testAccVmsConfigUpdateOAPIVMTags(omi, vmType string, region, value, keypair resource "outscale_security_group" "sg" { security_group_name = "%[5]s" description = "Used in the terraform acceptance tests" - tags { key = "Name" value = "tf-acc-test" } - net_id = outscale_net.net.id } @@ -911,22 +840,11 @@ func testAccCheckOutscaleOAPIVMConfigWithBlockDeviceMappings(omi, vmType, region device_name = "/dev/sdc" bsu { volume_size = 22 - volume_type = "io1" - iops = 150 - snapshot_id = outscale_snapshot.snapshot.id + #volume_type = "io1" + #iops = 150 delete_on_vm_deletion = true } } - - block_device_mappings { - device_name = "/dev/sdc" - bsu { - volume_size = 22 - volume_type = "io1" - iops = 150 - snapshot_id = outscale_snapshot.snapshot.id - } - } } `, omi, vmType, region, keypair) } @@ -963,8 +881,7 @@ func testAccCheckOutscaleOAPIVMConfigWithNet(omi, vmType, region, keypair string } resource "outscale_route_table" "outscale_route_table" { - net_id = "${outscale_net.outscale_net.net_id}" - + net_id = outscale_net.outscale_net.net_id tags { key = "name" value = "Terraform_RT" @@ -978,7 +895,7 @@ func testAccCheckOutscaleOAPIVMConfigWithNet(omi, vmType, region, keypair string resource "outscale_internet_service_link" "outscale_internet_service_link" { internet_service_id = outscale_internet_service.outscale_internet_service.internet_service_id - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id } resource "outscale_route" "outscale_route" { diff --git a/outscale/resource_outscale_volume.go b/outscale/resource_outscale_volume.go index fb8442f3a..a420f5034 100644 --- a/outscale/resource_outscale_volume.go +++ b/outscale/resource_outscale_volume.go @@ -11,8 +11,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) const defaultIops = 150 @@ -186,9 +186,7 @@ func resourceOAPIVolumeCreate(d *schema.ResourceData, meta interface{}) error { if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") } - return resourceOAPIVolumeRead(d, meta) } @@ -228,14 +226,10 @@ func resourceOAPIVolumeRead(d *schema.ResourceData, meta interface{}) error { func resourceOAPIVolumeUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - d.SetPartial("tags") - stateConf := &resource.StateChangeConf{ Pending: []string{"creating"}, Target: []string{"available", "in-use"}, @@ -249,8 +243,6 @@ func resourceOAPIVolumeUpdate(d *schema.ResourceData, meta interface{}) error { if err != nil { return fmt.Errorf("Error waiting for Volume (%s) to update: %s", d.Id(), err) } - - d.Partial(false) return resourceOAPIVolumeRead(d, meta) } diff --git a/outscale/resource_outscale_volume_test.go b/outscale/resource_outscale_volume_test.go index 3064e0f1d..193c3e67a 100644 --- a/outscale/resource_outscale_volume_test.go +++ b/outscale/resource_outscale_volume_test.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVolume_basic(t *testing.T) { diff --git a/outscale/resource_outscale_volumes_link.go b/outscale/resource_outscale_volumes_link.go index 69476e826..9df543075 100644 --- a/outscale/resource_outscale_volumes_link.go +++ b/outscale/resource_outscale_volumes_link.go @@ -7,13 +7,12 @@ import ( "net/http" "time" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/openlyinc/pointy" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceOutscaleOAPIVolumeLink() *schema.Resource { diff --git a/outscale/resource_outscale_volumes_link_test.go b/outscale/resource_outscale_volumes_link_test.go index 05903c2ab..b337b35a0 100644 --- a/outscale/resource_outscale_volumes_link_test.go +++ b/outscale/resource_outscale_volumes_link_test.go @@ -7,8 +7,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleOAPIVolumeAttachment_basic(t *testing.T) { diff --git a/outscale/resource_outscale_vpn_connection.go b/outscale/resource_outscale_vpn_connection.go index b6857466f..71770a51a 100644 --- a/outscale/resource_outscale_vpn_connection.go +++ b/outscale/resource_outscale_vpn_connection.go @@ -6,8 +6,8 @@ import ( "net/http" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/spf13/cast" "github.com/terraform-providers/terraform-provider-outscale/utils" @@ -220,16 +220,9 @@ func resourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) func resourceOutscaleVPNConnectionUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - d.Partial(true) - if err := setOSCAPITags(conn, d); err != nil { return err } - - d.SetPartial("tags") - - d.Partial(false) - return resourceOutscaleVPNConnectionRead(d, meta) } diff --git a/outscale/resource_outscale_vpn_connection_route.go b/outscale/resource_outscale_vpn_connection_route.go index cb215969e..414c63344 100644 --- a/outscale/resource_outscale_vpn_connection_route.go +++ b/outscale/resource_outscale_vpn_connection_route.go @@ -9,11 +9,10 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/terraform-providers/terraform-provider-outscale/utils" - + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" + "github.com/terraform-providers/terraform-provider-outscale/utils" ) func resourceOutscaleVPNConnectionRoute() *schema.Resource { diff --git a/outscale/resource_outscale_vpn_connection_route_test.go b/outscale/resource_outscale_vpn_connection_route_test.go index 397ee0d49..bafa478cf 100644 --- a/outscale/resource_outscale_vpn_connection_route_test.go +++ b/outscale/resource_outscale_vpn_connection_route_test.go @@ -10,8 +10,8 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleVPNConnectionRoute_basic(t *testing.T) { diff --git a/outscale/resource_outscale_vpn_connection_test.go b/outscale/resource_outscale_vpn_connection_test.go index aeb2cd3a8..c718a1216 100644 --- a/outscale/resource_outscale_vpn_connection_test.go +++ b/outscale/resource_outscale_vpn_connection_test.go @@ -9,14 +9,14 @@ import ( oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccOutscaleVPNConnection_basic(t *testing.T) { t.Parallel() - resourceName := "outscale_vpn_connection.foo" + resourceName := "outscale_vpn_connection.vpn_basic" publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) @@ -26,18 +26,6 @@ func TestAccOutscaleVPNConnection_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccOutscaleVPNConnectionDestroy, Steps: []resource.TestStep{ - { - Config: testAccOutscaleVPNConnectionConfigWithoutStaticRoutes(publicIP), - Check: resource.ComposeTestCheckFunc( - testAccOutscaleVPNConnectionExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "client_gateway_id"), - resource.TestCheckResourceAttrSet(resourceName, "virtual_gateway_id"), - resource.TestCheckResourceAttrSet(resourceName, "connection_type"), - resource.TestCheckResourceAttrSet(resourceName, "vgw_telemetries.#"), - - resource.TestCheckResourceAttr(resourceName, "connection_type", "ipsec.1"), - ), - }, { Config: testAccOutscaleVPNConnectionConfig(publicIP, true), Check: resource.ComposeTestCheckFunc( @@ -130,7 +118,7 @@ func TestAccOutscaleVPNConnection_withTags(t *testing.T) { func TestAccOutscaleVPNConnection_importBasic(t *testing.T) { t.Parallel() - resourceName := "outscale_vpn_connection.foo" + resourceName := "outscale_vpn_connection.vpn_basic" publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) @@ -242,9 +230,9 @@ func testAccOutscaleVPNConnectionConfig(publicIP string, staticRoutesOnly bool) connection_type = "ipsec.1" } - resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" + resource "outscale_vpn_connection" "vpn_basic" { + client_gateway_id = outscale_client_gateway.customer_gateway.id + virtual_gateway_id = outscale_virtual_gateway.virtual_gateway.id connection_type = "ipsec.1" static_routes_only = "%t" } @@ -264,8 +252,8 @@ func testAccOutscaleVPNConnectionConfigWithoutStaticRoutes(publicIP string) stri } resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" + client_gateway_id = outscale_client_gateway.customer_gateway.id + virtual_gateway_id = outscale_virtual_gateway.virtual_gateway.id connection_type = "ipsec.1" } `, publicIP) @@ -284,8 +272,8 @@ func testAccOutscaleVPNConnectionConfigWithTags(publicIP, value string) string { } resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" + client_gateway_id = outscale_client_gateway.customer_gateway.id + virtual_gateway_id = outscale_virtual_gateway.virtual_gateway.id connection_type = "ipsec.1" static_routes_only = true diff --git a/outscale/sweeper_test.go b/outscale/sweeper_test.go index a15927576..4723c1e50 100644 --- a/outscale/sweeper_test.go +++ b/outscale/sweeper_test.go @@ -3,7 +3,7 @@ package outscale import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestMain(m *testing.M) { diff --git a/utils/utils.go b/utils/utils.go index e2524f58d..17c6128b1 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -1,20 +1,21 @@ package utils import ( + "bytes" "encoding/json" "fmt" + "hash/crc32" "log" "math/rand" "net/http" "strconv" "time" + "github.com/aws/aws-sdk-go/aws" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" - - "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) // PrintToJSON method helper to debug responses @@ -233,3 +234,31 @@ func StringSlicePtrToInterfaceSlice(list *[]string) []interface{} { func I32toa(i int32) string { return strconv.FormatInt(int64(i), 10) } + +// String hashes a string to a unique hashcode. +// +// crc32 returns a uint32, but for our use we need +// and non negative integer. Here we cast to an integer +// and invert it if the result is negative. +func String(s string) int { + v := int(crc32.ChecksumIEEE([]byte(s))) + if v >= 0 { + return v + } + if -v >= 0 { + return -v + } + // v == MinInt + return 0 +} + +// Strings hashes a list of strings to a unique hashcode. +func Strings(strings []string) string { + var buf bytes.Buffer + + for _, s := range strings { + buf.WriteString(fmt.Sprintf("%s-", s)) + } + + return fmt.Sprintf("%d", String(buf.String())) +} From 485cd7710f317aaca3391dc57b31373d80aa251b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Wed, 25 Jan 2023 11:09:55 +0000 Subject: [PATCH 02/82] Improve access_key datasource --- outscale/data_source_outscale_access_key.go | 33 ++++---------------- outscale/data_source_outscale_access_keys.go | 26 --------------- 2 files changed, 6 insertions(+), 53 deletions(-) diff --git a/outscale/data_source_outscale_access_key.go b/outscale/data_source_outscale_access_key.go index 78a5066f4..35086350a 100644 --- a/outscale/data_source_outscale_access_key.go +++ b/outscale/data_source_outscale_access_key.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -11,7 +10,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func dataSourceOutscaleAccessKey() *schema.Resource { @@ -21,7 +19,7 @@ func dataSourceOutscaleAccessKey() *schema.Resource { "filter": dataSourceFiltersSchema(), "access_key_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "creation_date": { Type: schema.TypeString, @@ -36,9 +34,8 @@ func dataSourceOutscaleAccessKey() *schema.Resource { Computed: true, }, "state": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"ACTIVE", "INACTIVE"}, false), + Type: schema.TypeString, + Computed: true, }, "request_id": { Type: schema.TypeString, @@ -51,24 +48,10 @@ func dataSourceOutscaleAccessKey() *schema.Resource { func dataSourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - accessKeyID, accessKeyOk := d.GetOk("access_key_id") - state, stateOk := d.GetOk("state") - - if !filtersOk && !accessKeyOk && !stateOk { - return fmt.Errorf("One of filters, access_key_id or state must be assigned") - } - filterReq := &oscgo.FiltersAccessKeys{} - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { filterReq = buildOutscaleDataSourceAccessKeyFilters(filters.(*schema.Set)) } - if accessKeyOk { - filterReq.SetAccessKeyIds([]string{accessKeyID.(string)}) - } - if stateOk { - filterReq.SetStates([]string{state.(string)}) - } var resp oscgo.ReadAccessKeysResponse var err error @@ -84,12 +67,8 @@ func dataSourceOutscaleAccessKeyRead(d *schema.ResourceData, meta interface{}) e return err } - if len(resp.GetAccessKeys()) == 0 { - return fmt.Errorf("Unable to find Access Key") - } - - if len(resp.GetAccessKeys()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetAccessKeys()), "Access Key"); err != nil { + return err } accessKey := resp.GetAccessKeys()[0] diff --git a/outscale/data_source_outscale_access_keys.go b/outscale/data_source_outscale_access_keys.go index c94c324a8..125f018ca 100644 --- a/outscale/data_source_outscale_access_keys.go +++ b/outscale/data_source_outscale_access_keys.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func dataSourceOutscaleAccessKeys() *schema.Resource { @@ -18,19 +17,6 @@ func dataSourceOutscaleAccessKeys() *schema.Resource { Read: dataSourceOutscaleAccessKeysRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "access_key_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "states": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{"ACTIVE", "INACTIVE"}, false), - }, - }, "access_keys": { Type: schema.TypeList, Computed: true, @@ -71,23 +57,11 @@ func dataSourceOutscaleAccessKeysRead(d *schema.ResourceData, meta interface{}) conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") - accessKeyID, accessKeyOk := d.GetOk("access_key_ids") - state, stateOk := d.GetOk("states") - - if !filtersOk && !accessKeyOk && !stateOk { - return fmt.Errorf("One of filters, access_key_ids or states must be assigned") - } filterReq := &oscgo.FiltersAccessKeys{} if filtersOk { filterReq = buildOutscaleDataSourceAccessKeyFilters(filters.(*schema.Set)) } - if accessKeyOk { - filterReq.SetAccessKeyIds(utils.InterfaceSliceToStringSlice(accessKeyID.([]interface{}))) - } - if stateOk { - filterReq.SetStates(utils.InterfaceSliceToStringSlice(state.([]interface{}))) - } var resp oscgo.ReadAccessKeysResponse var err error From 47e1a4780d7045cead2eb98c65d3cbc3444f4fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Wed, 25 Jan 2023 11:11:04 +0000 Subject: [PATCH 03/82] Merge access_key datasource testacc --- .../data_source_outscale_access_key_test.go | 57 ++++++---------- .../data_source_outscale_access_keys_test.go | 68 ------------------- 2 files changed, 21 insertions(+), 104 deletions(-) delete mode 100644 outscale/data_source_outscale_access_keys_test.go diff --git a/outscale/data_source_outscale_access_key_test.go b/outscale/data_source_outscale_access_key_test.go index 82915a281..1d4562f55 100644 --- a/outscale/data_source_outscale_access_key_test.go +++ b/outscale/data_source_outscale_access_key_test.go @@ -6,69 +6,54 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleDataSourceAccessKey_basic(t *testing.T) { +func TestAcc_AccessKey_DataSource(t *testing.T) { t.Parallel() - dataSourceName := "outscale_access_key.outscale_access_key" - + dataSourceName := "data.outscale_access_key.outscale_access_key_d" + dataSourcesName := "data.outscale_access_keys.outscale_access_keys_d" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccClientAccessKeyDataSourceBasic(), + Config: testAcc_AccessKey_DataSource_Config(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "access_key_id"), resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), resource.TestCheckResourceAttrSet(dataSourceName, "last_modification_date"), - resource.TestCheckResourceAttrSet(dataSourceName, "secret_key"), resource.TestCheckResourceAttrSet(dataSourceName, "state"), - ), - }, - }, - }) -} - -func TestAccOutscaleDataSourceAccessKey_withFilters(t *testing.T) { - t.Parallel() - dataSourceName := "outscale_access_key.outscale_access_key" - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientAccessKeyDataSourceWithFilters(), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet(dataSourceName, "access_key_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), - resource.TestCheckResourceAttrSet(dataSourceName, "last_modification_date"), - resource.TestCheckResourceAttrSet(dataSourceName, "secret_key"), - resource.TestCheckResourceAttrSet(dataSourceName, "state"), + resource.TestCheckResourceAttrSet(dataSourcesName, "access_keys.#"), + resource.TestCheckResourceAttrSet(dataSourcesName, "filter.#"), ), }, }, }) } -func testAccClientAccessKeyDataSourceBasic() string { +func testAcc_AccessKey_DataSource_Config() string { return ` resource "outscale_access_key" "outscale_access_key" {} - data "outscale_access_key" "outscale_access_key" { - access_key_id = outscale_access_key.outscale_access_key.id + data "outscale_access_key" "outscale_access_key_d" { + filter { + name = "access_key_ids" + values = [outscale_access_key.outscale_access_key.id] + } + filter { + name = "states" + values = [outscale_access_key.outscale_access_key.state] + } } - ` -} -func testAccClientAccessKeyDataSourceWithFilters() string { - return ` - resource "outscale_access_key" "outscale_access_key" {} - - data "outscale_access_key" "outscale_access_key" { + data "outscale_access_keys" "outscale_access_keys_d" { filter { name = "access_key_ids" values = [outscale_access_key.outscale_access_key.id] } + filter { + name = "states" + values = [outscale_access_key.outscale_access_key.state] + } } ` } diff --git a/outscale/data_source_outscale_access_keys_test.go b/outscale/data_source_outscale_access_keys_test.go deleted file mode 100644 index 2ee4fefe1..000000000 --- a/outscale/data_source_outscale_access_keys_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleDataSourceAccessKeys_basic(t *testing.T) { - t.Parallel() - dataSourceName := "data.outscale_access_keys.outscale_access_key" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientAccessKeysDataSourceBasic(), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet(dataSourceName, "access_keys.#"), - resource.TestCheckResourceAttrSet(dataSourceName, "access_key_ids.#"), - ), - }, - }, - }) -} - -func TestAccOutscaleDataSourceAccessKeys_withFilters(t *testing.T) { - t.Parallel() - dataSourceName := "data.outscale_access_keys.outscale_access_key" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientAccessKeysDataSourceWithFilters(), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet(dataSourceName, "access_keys.#"), - resource.TestCheckResourceAttrSet(dataSourceName, "filter.#"), - ), - }, - }, - }) -} - -func testAccClientAccessKeysDataSourceBasic() string { - return ` - resource "outscale_access_key" "outscale_access_key" {} - - data "outscale_access_keys" "outscale_access_key" { - access_key_ids = ["${outscale_access_key.outscale_access_key.id}"] - } - ` -} - -func testAccClientAccessKeysDataSourceWithFilters() string { - return ` - resource "outscale_access_key" "outscale_access_key" {} - - data "outscale_access_keys" "outscale_access_key" { - filter { - name = "access_key_ids" - values = ["${outscale_access_key.outscale_access_key.id}"] - } - } - ` -} From c504426f4bd200d2d23bbcbb716e534932de3a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Wed, 25 Jan 2023 11:24:28 +0000 Subject: [PATCH 04/82] Improve account datasource --- outscale/data_source_outscale_account.go | 14 ++------------ outscale/data_source_outscale_accounts.go | 4 ---- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/outscale/data_source_outscale_account.go b/outscale/data_source_outscale_account.go index 2083d0043..828f6f5fc 100644 --- a/outscale/data_source_outscale_account.go +++ b/outscale/data_source_outscale_account.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -86,14 +85,10 @@ func dataSourceAccount() *schema.Resource { } func dataSourceAccountRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadAccountsRequest{} - var resp oscgo.ReadAccountsResponse var err error - err = resource.Retry(30*time.Second, func() *resource.RetryError { rp, httpResp, err := conn.AccountApi.ReadAccounts(context.Background()).ReadAccountsRequest(req).Execute() if err != nil { @@ -105,13 +100,8 @@ func dataSourceAccountRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } - - if len(resp.GetAccounts()) == 0 { - return fmt.Errorf("Unable to find Account") - } - - if len(resp.GetAccounts()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetAccounts()), "Account"); err != nil { + return err } account := resp.GetAccounts()[0] diff --git a/outscale/data_source_outscale_accounts.go b/outscale/data_source_outscale_accounts.go index 12be14402..bd8d407a8 100644 --- a/outscale/data_source_outscale_accounts.go +++ b/outscale/data_source_outscale_accounts.go @@ -94,14 +94,10 @@ func dataSourceAccounts() *schema.Resource { } func dataSourceAccountsRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadAccountsRequest{} - var resp oscgo.ReadAccountsResponse var err error - err = resource.Retry(30*time.Second, func() *resource.RetryError { rp, httpResp, err := conn.AccountApi.ReadAccounts(context.Background()).ReadAccountsRequest(req).Execute() if err != nil { From 7b1400d8e8638f3173c198e67fe874175d0af90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Wed, 25 Jan 2023 11:25:23 +0000 Subject: [PATCH 05/82] Merge account datasource testacc --- outscale/data_source_outscale_account_test.go | 17 +++++++---- .../data_source_outscale_accounts_test.go | 29 ------------------- 2 files changed, 12 insertions(+), 34 deletions(-) delete mode 100644 outscale/data_source_outscale_accounts_test.go diff --git a/outscale/data_source_outscale_account_test.go b/outscale/data_source_outscale_account_test.go index 76f214469..910a7ee0b 100644 --- a/outscale/data_source_outscale_account_test.go +++ b/outscale/data_source_outscale_account_test.go @@ -7,8 +7,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceAccount_basic(t *testing.T) { - +func TestAcc_Account_DataSource(t *testing.T) { + dataSourceName := "data.outscale_account.account" + dataSourcesName := "data.outscale_accounts.accounts" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -16,14 +17,20 @@ func TestAccDataSourceAccount_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceAccountConfig(), + Config: testAcc_Account_DataSource_Config(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourcesName, "accounts.#"), + resource.TestCheckResourceAttrSet(dataSourceName, "account_id"), + ), }, }, }) } -func testAccDataSourceAccountConfig() string { +func testAcc_Account_DataSource_Config() string { return fmt.Sprintf(` - data "outscale_account" "account" { } + data "outscale_account" "account" { } + + data "outscale_accounts" "accounts" { } `) } diff --git a/outscale/data_source_outscale_accounts_test.go b/outscale/data_source_outscale_accounts_test.go deleted file mode 100644 index 63323dc6b..000000000 --- a/outscale/data_source_outscale_accounts_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceAccounts_basic(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceAccountsConfig(), - }, - }, - }) -} - -func testAccDataSourceAccountsConfig() string { - return fmt.Sprintf(` - data "outscale_accounts" "accounts" { } - `) -} From a8119a4c0d5da1133c07fc75f8b9108fc7e3743a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:50:17 +0000 Subject: [PATCH 06/82] Improve api_access_policy datasource --- outscale/data_source_outscale_api_access_policy.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/outscale/data_source_outscale_api_access_policy.go b/outscale/data_source_outscale_api_access_policy.go index e5682f303..f89f06cdc 100644 --- a/outscale/data_source_outscale_api_access_policy.go +++ b/outscale/data_source_outscale_api_access_policy.go @@ -33,9 +33,7 @@ func dataSourceOutscaleOAPIApiAccessPolicy() *schema.Resource { func dataSourceOutscaleOAPIApiAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadApiAccessPolicyRequest{} - var resp oscgo.ReadApiAccessPolicyResponse var err error err = resource.Retry(120*time.Second, func() *resource.RetryError { @@ -46,11 +44,9 @@ func dataSourceOutscaleOAPIApiAccessPolicyRead(d *schema.ResourceData, meta inte resp = rp return nil }) - if err != nil { return fmt.Errorf("[DEBUG] Error reading Api Access Policy id (%s)", utils.GetErrorResponse(err)) } - if !resp.HasApiAccessPolicy() { d.SetId("") return fmt.Errorf("Api Access Policy not found") From 27b6db87e38df1956fad3ea95353c4373cf4b7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:51:07 +0000 Subject: [PATCH 07/82] Improve api_access_policy datasource testacc --- .../data_source_outscale_api_access_policy_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/outscale/data_source_outscale_api_access_policy_test.go b/outscale/data_source_outscale_api_access_policy_test.go index 2df13984d..8c17769e7 100644 --- a/outscale/data_source_outscale_api_access_policy_test.go +++ b/outscale/data_source_outscale_api_access_policy_test.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIApiAccessPolicy_basic(t *testing.T) { - +func TestAcc_ApiAccessPolicy_DataSource(t *testing.T) { + dataSourceName := "data.outscale_api_access_policy.api_access_policy" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -16,13 +16,16 @@ func TestAccDataSourceOutscaleOAPIApiAccessPolicy_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIApiAccessPolicyConfig(), + Config: testAcc_ApiAccessPolicy_DataSource_Config(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "max_access_key_expiration_seconds"), + ), }, }, }) } -func testAccDataSourceOutscaleOAPIApiAccessPolicyConfig() string { +func testAcc_ApiAccessPolicy_DataSource_Config() string { return fmt.Sprintf(` data "outscale_api_access_policy" "api_access_policy" {} `) From 6212447fb0bb8b70bec40965a522b074531a57a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:53:19 +0000 Subject: [PATCH 08/82] Improve api_access_rule datasource --- .../data_source_outscale_api_access_rule.go | 22 +++++-------------- .../data_source_outscale_api_access_rules.go | 3 +-- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/outscale/data_source_outscale_api_access_rule.go b/outscale/data_source_outscale_api_access_rule.go index 64a96bd2a..d1e0bad42 100644 --- a/outscale/data_source_outscale_api_access_rule.go +++ b/outscale/data_source_outscale_api_access_rule.go @@ -51,13 +51,9 @@ func dataSourceOutscaleOAPIApiAccessRule() *schema.Resource { func dataSourceOutscaleOAPIApiAccessRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("filters must be assigned") - } - - req := oscgo.ReadApiAccessRulesRequest{ - Filters: buildOutscaleApiAccessRuleFilters(filters.(*schema.Set)), + req := oscgo.ReadApiAccessRulesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleApiAccessRuleFilters(filters.(*schema.Set)) } var resp oscgo.ReadApiAccessRulesResponse @@ -74,16 +70,10 @@ func dataSourceOutscaleOAPIApiAccessRuleRead(d *schema.ResourceData, meta interf if err != nil { return fmt.Errorf("[DEBUG] Error reading api access rule id (%s)", utils.GetErrorResponse(err)) } - apiAccessRules := resp.GetApiAccessRules()[:] - if len(apiAccessRules) < 1 { - d.SetId("") - return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") - } - if len(apiAccessRules) > 1 { - return fmt.Errorf("Your query returned more results. Please change your search criteria and try again") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetApiAccessRules()), "Api Access Rules"); err != nil { + return err } - - accRule := apiAccessRules[0] + accRule := resp.GetApiAccessRules()[0] if err := d.Set("api_access_rule_id", accRule.GetApiAccessRuleId()); err != nil { return err } diff --git a/outscale/data_source_outscale_api_access_rules.go b/outscale/data_source_outscale_api_access_rules.go index eb9f3a020..4a21bbfdf 100644 --- a/outscale/data_source_outscale_api_access_rules.go +++ b/outscale/data_source_outscale_api_access_rules.go @@ -58,9 +58,8 @@ func dataSourceOutscaleOAPIApiAccessRules() *schema.Resource { func dataSourceOutscaleOAPIApiAccessRulesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") req := oscgo.ReadApiAccessRulesRequest{} - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleApiAccessRuleFilters(filters.(*schema.Set)) } From 5e06809837b28a7097f0872801f9c5ba973ee293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:54:09 +0000 Subject: [PATCH 09/82] Merge api_access_rule datasource testacc --- ...ta_source_outscale_api_access_rule_test.go | 99 +++++++---------- ...a_source_outscale_api_access_rules_test.go | 104 ------------------ 2 files changed, 38 insertions(+), 165 deletions(-) delete mode 100644 outscale/data_source_outscale_api_access_rules_test.go diff --git a/outscale/data_source_outscale_api_access_rule_test.go b/outscale/data_source_outscale_api_access_rule_test.go index 493118479..f10886187 100644 --- a/outscale/data_source_outscale_api_access_rule_test.go +++ b/outscale/data_source_outscale_api_access_rule_test.go @@ -1,91 +1,48 @@ package outscale import ( - "context" "fmt" "testing" - "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccDataOutscaleOAPIApiAccessRule_basic(t *testing.T) { +func TestAcc_ApiAccessRule_DataSource(t *testing.T) { t.Parallel() - resourceName := "outscale_api_access_rule.rule_data" - + dataSourceName := "data.outscale_api_access_rule.rule" + dataSourcesName := "data.outscale_api_access_rules.filters_rules" + dataSourcesAllName := "data.outscale_api_access_rules.all_rules" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccDataCheckOutscaleApiAccessRuleDestroy, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPIApiAccessRuleConfig(utils.TestCaPem), + Config: testAcc_ApiAccessRule_DataSource_Config(), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleApiAccessRuleExists(resourceName), + resource.TestCheckResourceAttrSet(dataSourceName, "ip_ranges.#"), + + resource.TestCheckResourceAttrSet(dataSourcesName, "api_access_rules.#"), + resource.TestCheckResourceAttrSet(dataSourcesName, "filter.#"), + + resource.TestCheckResourceAttrSet(dataSourcesAllName, "api_access_rules.#"), ), }, }, }) } -func testAccDataCheckOutscaleApiAccessRuleDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_api_access_rule" { - continue - } - req := oscgo.ReadApiAccessRulesRequest{ - Filters: &oscgo.FiltersApiAccessRule{ApiAccessRuleIds: &[]string{rs.Primary.ID}}, - } - - var resp oscgo.ReadApiAccessRulesResponse - var err error - exists := false - err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.ApiAccessRuleApi.ReadApiAccessRules(context.Background()).ReadApiAccessRulesRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - if err != nil { - return fmt.Errorf("Api Access Rule reading (%s)", rs.Primary.ID) - } - - for _, r := range resp.GetApiAccessRules() { - if r.GetApiAccessRuleId() == rs.Primary.ID { - exists = true - } - } - if exists { - return fmt.Errorf("Api Access Rule still exists (%s)", rs.Primary.ID) - } - } - return nil -} - -func testAccDataOutscaleOAPIApiAccessRuleConfig(ca_pem string) string { +func testAcc_ApiAccessRule_DataSource_Config() string { return fmt.Sprintf(` -resource "outscale_ca" "ca_rule" { - ca_pem = %[1]q - description = "Ca data test create" -} - resource "outscale_api_access_rule" "rule_data" { - ca_ids = ["${outscale_ca.ca_rule.id}"] ip_ranges = ["192.4.2.32/16"] description = "test api access rule" } -data "outscale_api_access_rule" "api_access_rule" { + +data "outscale_api_access_rules" "filters_rules" { filter { name = "api_access_rule_ids" - values = ["${outscale_api_access_rule.rule_data.id}"] + values = [outscale_api_access_rule.rule_data.id] } filter { @@ -98,5 +55,25 @@ data "outscale_api_access_rule" "api_access_rule" { values = ["test api access rule"] } } - `, ca_pem) + +data "outscale_api_access_rules" "all_rules" {} + +data "outscale_api_access_rule" "rule" { + filter { + name = "api_access_rule_ids" + values = [outscale_api_access_rule.rule_data.id] + } + + filter { + name = "ip_ranges" + values = ["192.4.2.32/16"] + } + + filter { + name = "descriptions" + values = ["test api access rule"] + } +} + +`) } diff --git a/outscale/data_source_outscale_api_access_rules_test.go b/outscale/data_source_outscale_api_access_rules_test.go deleted file mode 100644 index 4776168b5..000000000 --- a/outscale/data_source_outscale_api_access_rules_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package outscale - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccDataOutscaleOAPIApiAccessRules_basic(t *testing.T) { - t.Parallel() - resourceName := "outscale_api_access_rule.rule_data" - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccDataCheckOutscaleApiAccessRuleDestroy, - Steps: []resource.TestStep{ - { - Config: testAccDataOutscaleOAPIApiAccessRulesConfig(utils.TestCaPem), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleApiAccessRuleExists(resourceName), - ), - }, - }, - }) -} - -func testAccDataCheckOutscaleApiAccessRulesDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_api_access_rule" { - continue - } - req := oscgo.ReadApiAccessRulesRequest{ - Filters: &oscgo.FiltersApiAccessRule{ApiAccessRuleIds: &[]string{rs.Primary.ID}}, - } - - var resp oscgo.ReadApiAccessRulesResponse - var err error - exists := false - err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.ApiAccessRuleApi.ReadApiAccessRules(context.Background()).ReadApiAccessRulesRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - if err != nil { - return fmt.Errorf("Api Access Rule reading (%s)", rs.Primary.ID) - } - - for _, r := range resp.GetApiAccessRules() { - if r.GetApiAccessRuleId() == rs.Primary.ID { - exists = true - } - } - if exists { - return fmt.Errorf("Api Access Rule still exists (%s)", rs.Primary.ID) - } - } - return nil -} - -func testAccDataOutscaleOAPIApiAccessRulesConfig(ca_pem string) string { - return fmt.Sprintf(` -resource "outscale_ca" "ca_rule" { - ca_pem = %[1]q - description = "Ca testacc create" -} - -resource "outscale_api_access_rule" "rule_data" { - ca_ids = ["${outscale_ca.ca_rule.id}"] - ip_ranges = ["192.4.2.32/16"] - description = "test api access rule" -} - - -data "outscale_api_access_rules" "filters_rules" { - filter { - name = "api_access_rule_ids" - values = ["${outscale_api_access_rule.rule_data.id}"] - } - - filter { - name = "ip_ranges" - values = ["192.4.2.32/16"] - } - - filter { - name = "descriptions" - values = ["test api access rule"] - } -} - -data "outscale_api_access_rules" "all_rules" {} - `, ca_pem) -} From bb10f517a3c08e8fe370260ebe7bed27c961b9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:55:53 +0000 Subject: [PATCH 10/82] Improve ca datasource --- outscale/data_source_outscale_ca.go | 16 ++++------------ outscale/data_source_outscale_cas.go | 5 +---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/outscale/data_source_outscale_ca.go b/outscale/data_source_outscale_ca.go index 204db2d38..0268a34c0 100644 --- a/outscale/data_source_outscale_ca.go +++ b/outscale/data_source_outscale_ca.go @@ -44,13 +44,9 @@ func dataSourceOutscaleOAPICa() *schema.Resource { func dataSourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("filters must be assigned") - } - params := oscgo.ReadCasRequest{} - if filtersOk { + + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.Filters = buildOutscaleOAPIDataSourceCaFilters(filters.(*schema.Set)) } var resp oscgo.ReadCasResponse @@ -70,13 +66,9 @@ func dataSourceOutscaleOAPICaRead(d *schema.ResourceData, meta interface{}) erro if !resp.HasCas() { return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") } - if len(resp.GetCas()) == 0 { - d.SetId("") - return fmt.Errorf("Certificate authority not found") - } - if len(resp.GetCas()) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more specific search criteria") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetCas()), "Certificate authority"); err != nil { + return err } ca := resp.GetCas()[0] diff --git a/outscale/data_source_outscale_cas.go b/outscale/data_source_outscale_cas.go index f26599a69..e51f1a612 100644 --- a/outscale/data_source_outscale_cas.go +++ b/outscale/data_source_outscale_cas.go @@ -46,11 +46,8 @@ func dataSourceOutscaleOAPICas() *schema.Resource { func dataSourceOutscaleOAPICasRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") params := oscgo.ReadCasRequest{} - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.Filters = buildOutscaleOAPIDataSourceCaFilters(filters.(*schema.Set)) } var resp oscgo.ReadCasResponse From a78c25d4f978a2876cb5852b66cd51e19e3d9629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:56:27 +0000 Subject: [PATCH 11/82] Merge ca datasource testacc --- outscale/data_source_outscale_ca_test.go | 92 +++++++++-------------- outscale/data_source_outscale_cas_test.go | 88 ---------------------- 2 files changed, 36 insertions(+), 144 deletions(-) delete mode 100644 outscale/data_source_outscale_cas_test.go diff --git a/outscale/data_source_outscale_ca_test.go b/outscale/data_source_outscale_ca_test.go index 6f7b40182..dc70a04d4 100644 --- a/outscale/data_source_outscale_ca_test.go +++ b/outscale/data_source_outscale_ca_test.go @@ -1,87 +1,67 @@ package outscale import ( - "context" "fmt" "testing" - "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccDataOutscaleOAPICa_basic(t *testing.T) { - resourceName := "outscale_ca.ca_test" - +func TestAcc_Ca_DataSource(t *testing.T) { + dataSourceName := "data.outscale_ca.ca_data" + dataSourcesName := "data.outscale_cas.cas_data" + dataSourcesAllName := "data.outscale_cas.all_cas" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccDataCheckOutscaleCaDestroy, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataOutscaleOAPICaConfig(utils.TestCaPem), + Config: testAcc_Ca_DataSource_Config(utils.TestCaPem), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleCaExists(resourceName), + resource.TestCheckResourceAttrSet(dataSourceName, "ca_fingerprint"), + resource.TestCheckResourceAttrSet(dataSourceName, "ca_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "description"), + + resource.TestCheckResourceAttrSet(dataSourcesName, "cas.#"), + resource.TestCheckResourceAttrSet(dataSourcesName, "filter.#"), + + resource.TestCheckResourceAttrSet(dataSourcesAllName, "cas.#"), ), }, }, }) } -func testAccDataCheckOutscaleCaDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_ca" { - continue - } - req := oscgo.ReadCasRequest{} - req.Filters = &oscgo.FiltersCa{ - CaIds: &[]string{rs.Primary.ID}, - } - - var resp oscgo.ReadCasResponse - var err error - exists := false - err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.CaApi.ReadCas(context.Background()).ReadCasRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - if err != nil { - return fmt.Errorf("Ca reading (%s)", rs.Primary.ID) - } - - for _, ca := range resp.GetCas() { - if ca.GetCaId() == rs.Primary.ID { - exists = true - } - } - - if exists { - return fmt.Errorf("Ca still exists (%s)", rs.Primary.ID) - } - } - return nil -} - -func testAccDataOutscaleOAPICaConfig(ca_pem string) string { +func testAcc_Ca_DataSource_Config(ca_pem string) string { return fmt.Sprintf(` resource "outscale_ca" "ca_test" { ca_pem = %[1]q - description = "Ca testacc create" + description = "Ca testacc create" } data "outscale_ca" "ca_data" { - filter { + filter { + name = "ca_ids" + values = [outscale_ca.ca_test.id] + } +} + +data "outscale_cas" "cas_data" { + filter { name = "ca_ids" - values = ["${outscale_ca.ca_test.id}"] + values = [outscale_ca.ca_test.id] + } + filter { + name = "descriptions" + values = [outscale_ca.ca_test.description] + } + filter { + name = "ca_fingerprints" + values = [outscale_ca.ca_test.ca_fingerprint] } } + +data "outscale_cas" "all_cas" {} `, ca_pem) } diff --git a/outscale/data_source_outscale_cas_test.go b/outscale/data_source_outscale_cas_test.go deleted file mode 100644 index 74b60a61f..000000000 --- a/outscale/data_source_outscale_cas_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package outscale - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccDataOutscaleOAPICas_basic(t *testing.T) { - resName := "outscale_ca.ca_test" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccDataCheckOutscaleCasDestroy, - Steps: []resource.TestStep{ - { - Config: testAccDataOutscaleOAPICasConfig(utils.TestCaPem), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleCaExists(resName), - ), - }, - }, - }) -} - -func testAccDataCheckOutscaleCasDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_ca" { - continue - } - req := oscgo.ReadCasRequest{} - req.Filters = &oscgo.FiltersCa{ - CaIds: &[]string{rs.Primary.ID}, - } - - var resp oscgo.ReadCasResponse - var err error - exists := false - err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.CaApi.ReadCas(context.Background()).ReadCasRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - if err != nil { - return fmt.Errorf("Ca reading (%s)", rs.Primary.ID) - } - - for _, ca := range resp.GetCas() { - if ca.GetCaId() == rs.Primary.ID { - exists = true - } - } - - if exists { - return fmt.Errorf("Ca still exists (%s)", rs.Primary.ID) - } - } - return nil -} - -func testAccDataOutscaleOAPICasConfig(ca_pem string) string { - return fmt.Sprintf(` -resource "outscale_ca" "ca_test" { - ca_pem = %[1]q - description = "Ca testacc create" -} - -data "outscale_cas" "cas_data" { - filter { - name = "ca_ids" - values = ["${outscale_ca.ca_test.id}"] - } -} -data "outscale_cas" "all_cas" {} -`, ca_pem) -} From 41d1188a91a1af4e1fe22a3a447df721dc629c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:57:17 +0000 Subject: [PATCH 12/82] Improve client_gateway datasource --- .../data_source_outscale_client_gateway.go | 27 +++---------------- .../data_source_outscale_client_gateways.go | 21 +-------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/outscale/data_source_outscale_client_gateway.go b/outscale/data_source_outscale_client_gateway.go index 447fa587f..f6363d240 100644 --- a/outscale/data_source_outscale_client_gateway.go +++ b/outscale/data_source_outscale_client_gateway.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -24,7 +23,7 @@ func dataSourceOutscaleClientGateway() *schema.Resource { }, "client_gateway_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "connection_type": { Type: schema.TypeString, @@ -50,22 +49,8 @@ func dataSourceOutscaleClientGateway() *schema.Resource { func dataSourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - clientGatewayID, clientGatewayOk := d.GetOk("client_gateway_id") - - if !filtersOk && !clientGatewayOk { - return fmt.Errorf("One of filters, or client_gateway_id must be assigned") - } - params := oscgo.ReadClientGatewaysRequest{} - - if clientGatewayOk { - params.Filters = &oscgo.FiltersClientGateway{ - ClientGatewayIds: &[]string{clientGatewayID.(string)}, - } - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.Filters = buildOutscaleDataSourceClientGatewayFilters(filters.(*schema.Set)) } @@ -83,12 +68,8 @@ func dataSourceOutscaleClientGatewayRead(d *schema.ResourceData, meta interface{ return err } - if len(resp.GetClientGateways()) == 0 { - return fmt.Errorf("Unable to find Client Gateway") - } - - if len(resp.GetClientGateways()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetClientGateways()), "Client Gateway"); err != nil { + return err } clientGateway := resp.GetClientGateways()[0] diff --git a/outscale/data_source_outscale_client_gateways.go b/outscale/data_source_outscale_client_gateways.go index 8931956db..304b82edd 100644 --- a/outscale/data_source_outscale_client_gateways.go +++ b/outscale/data_source_outscale_client_gateways.go @@ -17,13 +17,6 @@ func dataSourceOutscaleClientGateways() *schema.Resource { Read: dataSourceOutscaleClientGatewaysRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "client_gateway_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "client_gateways": { Type: schema.TypeList, Computed: true, @@ -35,7 +28,7 @@ func dataSourceOutscaleClientGateways() *schema.Resource { }, "client_gateway_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "connection_type": { Type: schema.TypeString, @@ -65,20 +58,8 @@ func dataSourceOutscaleClientGatewaysRead(d *schema.ResourceData, meta interface conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") - clientGatewayIDs, clientGatewayOk := d.GetOk("client_gateway_ids") - - if !filtersOk && !clientGatewayOk { - return fmt.Errorf("One of filters, or client_gateway_id must be assigned") - } - params := oscgo.ReadClientGatewaysRequest{} - if clientGatewayOk { - params.Filters = &oscgo.FiltersClientGateway{ - ClientGatewayIds: utils.InterfaceSliceToStringList(clientGatewayIDs.([]interface{})), - } - } - if filtersOk { params.Filters = buildOutscaleDataSourceClientGatewayFilters(filters.(*schema.Set)) } From 69dfd10c5e51a5cf8b532ae789c657c2fd419ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 14:57:54 +0000 Subject: [PATCH 13/82] Merge client_gateway datasource testacc --- ...ata_source_outscale_client_gateway_test.go | 94 +++++-------------- ...ta_source_outscale_client_gateways_test.go | 80 ---------------- 2 files changed, 23 insertions(+), 151 deletions(-) delete mode 100644 outscale/data_source_outscale_client_gateways_test.go diff --git a/outscale/data_source_outscale_client_gateway_test.go b/outscale/data_source_outscale_client_gateway_test.go index d4b1d80e1..9f4924a98 100644 --- a/outscale/data_source_outscale_client_gateway_test.go +++ b/outscale/data_source_outscale_client_gateway_test.go @@ -9,8 +9,10 @@ import ( "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccOutscaleGatewayDatasource_basic(t *testing.T) { +func TestAcc_ClientGateway_Datasource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_client_gateway.test" + dataSourcesName := "data.outscale_client_gateways.test" rBgpAsn := utils.RandIntRange(64512, 65534) value := fmt.Sprintf("testacc-%s", acctest.RandString(5)) @@ -19,47 +21,24 @@ func TestAccOutscaleGatewayDatasource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccClientGatewayDatasourceBasic(rBgpAsn, value), - }, - }, - }) -} + Config: testAcc_ClientGateway_Datasource(rBgpAsn, value), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "client_gateway_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "bgp_asn"), -func TestAccOutscaleGatewayDatasource_withFilters(t *testing.T) { - t.Parallel() - // datasourceName := "data.outscale_client_gateway.test" - rBgpAsn := utils.RandIntRange(64512, 65534) - value := fmt.Sprintf("testacc-%s", acctest.RandString(5)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientGatewayDatasourceWithFilters(rBgpAsn, value), + resource.TestCheckResourceAttrSet(dataSourcesName, "client_gateways.#"), + resource.TestCheckResourceAttrSet(dataSourcesName, "filter.#"), + ), }, }, }) } -func TestAccOutscaleGatewayDatasource_withFiltersNoLocalhost(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientGatewayDatasourceWithFiltersNoLocalhost(), - }, - }, - }) -} - -func testAccClientGatewayDatasourceBasic(rBgpAsn int, value string) string { +func testAcc_ClientGateway_Datasource(rBgpAsn int, value string) string { return fmt.Sprintf(` resource "outscale_client_gateway" "foo" { bgp_asn = %d - public_ip = "172.0.0.1" + public_ip = "171.33.75.123" connection_type = "ipsec.1" tags { @@ -67,52 +46,25 @@ func testAccClientGatewayDatasourceBasic(rBgpAsn int, value string) string { value = "%s" } } - - data "outscale_client_gateway" "test" { - client_gateway_id = "${outscale_client_gateway.foo.id}" - } - `, rBgpAsn, value) -} - -func testAccClientGatewayDatasourceWithFilters(rBgpAsn int, value string) string { - return fmt.Sprintf(` - resource "outscale_client_gateway" "foo" { - bgp_asn = %d + + resource "outscale_client_gateway" "foo2" { + bgp_asn = 4 public_ip = "172.0.0.1" connection_type = "ipsec.1" - - tags { - key = "Name" - value = "%s" + } + + data "outscale_client_gateways" "test" { + filter { + name = "client_gateway_ids" + values = [outscale_client_gateway.foo.id, outscale_client_gateway.foo2.id] } } - + data "outscale_client_gateway" "test" { filter { name = "client_gateway_ids" - values = ["${outscale_client_gateway.foo.id}"] + values = [outscale_client_gateway.foo.id] } } `, rBgpAsn, value) } - -func testAccClientGatewayDatasourceWithFiltersNoLocalhost() string { - return fmt.Sprintf(` - resource "outscale_client_gateway" "outscale_client_gateway" { - bgp_asn = 571 - public_ip = "171.33.75.123" - connection_type = "ipsec.1" - tags { - key = "name-mzi" - value = "CGW_1_mzi" - } - } - - data "outscale_client_gateway" "outscale_client_gateway_2" { - filter { - name = "client_gateway_ids" - values = [outscale_client_gateway.outscale_client_gateway.client_gateway_id] - } - } - `) -} diff --git a/outscale/data_source_outscale_client_gateways_test.go b/outscale/data_source_outscale_client_gateways_test.go deleted file mode 100644 index 605450b57..000000000 --- a/outscale/data_source_outscale_client_gateways_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleClientGatewaysDatasource_basic(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleClientGatewaysDatasourceConfigBasic, - }, - }, - }) -} - -func TestAccOutscaleClientGatewaysDatasource_withFilters(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleClientGatewaysDatasourceConfigWithFilters, - }, - }, - }) -} - -const testAccOutscaleClientGatewaysDatasourceConfigBasic = ` - resource "outscale_client_gateway" "foo1" { - bgp_asn = 3 - public_ip = "172.0.0.1" - connection_type = "ipsec.1" - - tags { - key = "Name" - value = "%s" - } - } - - resource "outscale_client_gateway" "foo2" { - bgp_asn = 4 - public_ip = "172.0.0.1" - connection_type = "ipsec.1" - } - - data "outscale_client_gateways" "test" { - client_gateway_ids = ["${outscale_client_gateway.foo1.id}", "${outscale_client_gateway.foo2.id}"] - } -` - -const testAccOutscaleClientGatewaysDatasourceConfigWithFilters = ` - resource "outscale_client_gateway" "foo1" { - bgp_asn = 3 - public_ip = "172.0.0.1" - connection_type = "ipsec.1" - - tags { - key = "Name" - value = "%s" - } - } - - resource "outscale_client_gateway" "foo2" { - bgp_asn = 4 - public_ip = "172.0.0.1" - connection_type = "ipsec.1" - } - - data "outscale_client_gateways" "test" { - filter { - name = "client_gateway_ids" - values = ["${outscale_client_gateway.foo1.id}", "${outscale_client_gateway.foo2.id}"] - } - } -` From 2efb103986df595cd4774d148be9d25c086898fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:00 +0000 Subject: [PATCH 14/82] Improve dhcp_option datasource --- outscale/data_source_outscale_dhcp_option.go | 25 ++--------------- outscale/data_source_outscale_dhcp_options.go | 28 +++---------------- 2 files changed, 7 insertions(+), 46 deletions(-) diff --git a/outscale/data_source_outscale_dhcp_option.go b/outscale/data_source_outscale_dhcp_option.go index 242f8dfeb..c3f9784b2 100644 --- a/outscale/data_source_outscale_dhcp_option.go +++ b/outscale/data_source_outscale_dhcp_option.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -63,23 +62,10 @@ func dataSourceOutscaleDHCPOption() *schema.Resource { func dataSourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - dhcpID, dhcpIDOk := d.GetOk("dhcp_options_set_id") - if !dhcpIDOk && !filtersOk { - return fmt.Errorf("One of filters, or dhcp_options_set_id must be provided") - } - params := oscgo.ReadDhcpOptionsRequest{} - if dhcpIDOk { - params.Filters = &oscgo.FiltersDhcpOptions{ - DhcpOptionsSetIds: &[]string{dhcpID.(string)}, - } - } - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.Filters = buildOutscaleDataSourceDHCPOptionFilters(filters.(*schema.Set)) } - var resp oscgo.ReadDhcpOptionsResponse var err error err = resource.Retry(120*time.Second, func() *resource.RetryError { @@ -93,13 +79,8 @@ func dataSourceOutscaleDHCPOptionRead(d *schema.ResourceData, meta interface{}) if err != nil { return err } - - if len(resp.GetDhcpOptionsSets()) == 0 { - return fmt.Errorf("Unable to find DHCP Option") - } - - if len(resp.GetDhcpOptionsSets()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetDhcpOptionsSets()), "DHCP Option"); err != nil { + return err } dhcpOption := resp.GetDhcpOptionsSets()[0] diff --git a/outscale/data_source_outscale_dhcp_options.go b/outscale/data_source_outscale_dhcp_options.go index bf6805fab..5853393ee 100644 --- a/outscale/data_source_outscale_dhcp_options.go +++ b/outscale/data_source_outscale_dhcp_options.go @@ -18,13 +18,6 @@ func dataSourceOutscaleDHCPOptions() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "dhcp_options_set_ids": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "dhcp_options": { Type: schema.TypeList, Computed: true, @@ -77,27 +70,14 @@ func dataSourceOutscaleDHCPOptions() *schema.Resource { func dataSourceOutscaleDHCPOptionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - dhcpIDs, dhcpIDOk := d.GetOk("dhcp_options_set_ids") - if !dhcpIDOk && !filtersOk { - return fmt.Errorf("One of filters, or dhcp_options_set_id must be provided") + req := oscgo.ReadDhcpOptionsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleDataSourceDHCPOptionFilters(filters.(*schema.Set)) } - - params := oscgo.ReadDhcpOptionsRequest{} - if dhcpIDOk { - params.Filters = &oscgo.FiltersDhcpOptions{ - DhcpOptionsSetIds: utils.InterfaceSliceToStringList(dhcpIDs.([]interface{})), - } - } - if filtersOk { - params.Filters = buildOutscaleDataSourceDHCPOptionFilters(filters.(*schema.Set)) - } - var resp oscgo.ReadDhcpOptionsResponse var err error err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.DhcpOptionApi.ReadDhcpOptions(context.Background()).ReadDhcpOptionsRequest(params).Execute() + rp, httpResp, err := conn.DhcpOptionApi.ReadDhcpOptions(context.Background()).ReadDhcpOptionsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From b1d67805e844350db5de63b84f1987d6bf8d0ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:06 +0000 Subject: [PATCH 15/82] Merge dhcp_option datasource testacc --- .../data_source_outscale_dhcp_option_test.go | 97 +++------------- .../data_source_outscale_dhcp_options_test.go | 109 ------------------ 2 files changed, 18 insertions(+), 188 deletions(-) delete mode 100644 outscale/data_source_outscale_dhcp_options_test.go diff --git a/outscale/data_source_outscale_dhcp_option_test.go b/outscale/data_source_outscale_dhcp_option_test.go index 2d9e20d93..ae1c5ca2a 100644 --- a/outscale/data_source_outscale_dhcp_option_test.go +++ b/outscale/data_source_outscale_dhcp_option_test.go @@ -8,10 +8,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleDHCPOption_basic(t *testing.T) { +func TestAcc_DHCPOption_DataSource(t *testing.T) { t.Parallel() - resourceName := "outscale_dhcp_option.foo" dataSourceName := "data.outscale_dhcp_option.test" + dataSourcesName := "data.outscale_dhcp_options.test" value := fmt.Sprintf("test-acc-value-%s", acctest.RandString(5)) resource.Test(t, resource.TestCase{ @@ -19,73 +19,21 @@ func TestAccOutscaleDHCPOption_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccClientDHCPOptionBasic(value), + Config: testAcc_DHCPOption_DataSource_Config(value), Check: resource.ComposeTestCheckFunc( - // resource validations - testAccCheckOutscaleDHCPOptionExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "domain_name"), - resource.TestCheckResourceAttrSet(resourceName, "domain_name_servers.#"), - resource.TestCheckResourceAttrSet(resourceName, "ntp_servers.#"), - resource.TestCheckResourceAttrSet(resourceName, "log_servers.#"), - //resource.TestCheckResourceAttrSet(resourceName, "tags.#"), - - resource.TestCheckResourceAttr(resourceName, "domain_name", "test.fr"), - resource.TestCheckResourceAttr(resourceName, "domain_name_servers.0", "192.168.12.1"), - resource.TestCheckResourceAttr(resourceName, "ntp_servers.0", "192.0.0.2"), - resource.TestCheckResourceAttr(resourceName, "log_servers.0", "192.0.0.12"), - //resource.TestCheckResourceAttr(resourceName, "tags.#", "1"), - //resource.TestCheckResourceAttr(resourceName, "tags.0.key", "name"), - //resource.TestCheckResourceAttr(resourceName, "tags.0.value", value), // data source validations resource.TestCheckResourceAttrSet(dataSourceName, "dhcp_options_set_id"), + resource.TestCheckResourceAttr(dataSourcesName, "dhcp_options.#", "2"), ), }, }, }) } -func TestAccOutscaleDHCPOption_withFilters(t *testing.T) { - t.Parallel() - resourceName := "outscale_dhcp_option.foo" - dataSourceName := "data.outscale_dhcp_option.test" - value := fmt.Sprintf("test-acc-value-%s", acctest.RandString(5)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccClientDHCPOptionWithFilters(value), - Check: resource.ComposeTestCheckFunc( - // resource validations - testAccCheckOutscaleDHCPOptionExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "domain_name"), - resource.TestCheckResourceAttrSet(resourceName, "domain_name_servers.#"), - resource.TestCheckResourceAttrSet(resourceName, "ntp_servers.#"), - resource.TestCheckResourceAttrSet(resourceName, "log_servers.#"), - //resource.TestCheckResourceAttrSet(resourceName, "tags.#"), - - resource.TestCheckResourceAttr(resourceName, "domain_name", "test.fr"), - resource.TestCheckResourceAttr(resourceName, "domain_name_servers.0", "192.168.12.1"), - resource.TestCheckResourceAttr(resourceName, "ntp_servers.0", "192.0.0.2"), - resource.TestCheckResourceAttr(resourceName, "log_servers.0", "192.0.0.12"), - //resource.TestCheckResourceAttr(resourceName, "tags.#", "1"), - //resource.TestCheckResourceAttr(resourceName, "tags.0.key", "name"), - //resource.TestCheckResourceAttr(resourceName, "tags.0.value", value), - - // data source validations - resource.TestCheckResourceAttrSet(dataSourceName, "filter.#"), - resource.TestCheckResourceAttr(dataSourceName, "filter.#", "2"), - ), - }, - }, - }) -} - -func testAccClientDHCPOptionBasic(value string) string { +func testAcc_DHCPOption_DataSource_Config(value string) string { return fmt.Sprintf(` - resource "outscale_dhcp_option" "foo" { + resource "outscale_dhcp_option" "foo1" { domain_name = "test.fr" domain_name_servers = ["192.168.12.1"] ntp_servers = ["192.0.0.2"] @@ -97,38 +45,29 @@ func testAccClientDHCPOptionBasic(value string) string { } } - data "outscale_dhcp_option" "test" { - filter { - name = "dhcp_options_set_ids" - values = ["${outscale_dhcp_option.foo.id}"] - } - } - - `, value) -} - -func testAccClientDHCPOptionWithFilters(value string) string { - return fmt.Sprintf(` - resource "outscale_dhcp_option" "foo" { + resource "outscale_dhcp_option" "foo2" { domain_name = "test.fr" - domain_name_servers = ["192.168.12.1"] - ntp_servers = ["192.0.0.2"] - log_servers = ["192.0.0.12"] - + domain_name_servers = ["192.168.12.2"] + ntp_servers = ["192.0.0.3"] + log_servers = ["192.0.0.13"] + tags { key = "name" - value = "%s" + value = "%[1]s" } } data "outscale_dhcp_option" "test" { filter { name = "dhcp_options_set_ids" - values = ["${outscale_dhcp_option.foo.id}"] + values = [outscale_dhcp_option.foo1.id] } + } + + data "outscale_dhcp_options" "test" { filter { - name = "tag_keys" - values = ["name"] + name = "dhcp_options_set_ids" + values = [outscale_dhcp_option.foo1.id, outscale_dhcp_option.foo2.id] } } `, value) diff --git a/outscale/data_source_outscale_dhcp_options_test.go b/outscale/data_source_outscale_dhcp_options_test.go deleted file mode 100644 index 929e14264..000000000 --- a/outscale/data_source_outscale_dhcp_options_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleDHCPOptionsDatasource_basic(t *testing.T) { - t.Parallel() - value := fmt.Sprintf("test-acc-value-%s", acctest.RandString(5)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleDHCPOptionsDatasourceConfigBasic(value), - }, - }, - }) -} - -func TestAccOutscaleDHCPOptionsDatasource_withFilters(t *testing.T) { - t.Parallel() - value := fmt.Sprintf("test-acc-value-%s", acctest.RandString(5)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleDHCPOptionsDatasourceConfigWithFilters(value), - }, - }, - }) -} - -func testAccOutscaleDHCPOptionsDatasourceConfigBasic(value string) string { - return fmt.Sprintf(` - resource "outscale_dhcp_option" "foo1" { - domain_name = "test.fr" - domain_name_servers = ["192.168.12.1"] - ntp_servers = ["192.0.0.2"] - log_servers = ["192.0.0.12"] - - tags { - key = "name" - value = "%[1]s" - } - } - - resource "outscale_dhcp_option" "foo2" { - domain_name = "test.fr" - domain_name_servers = ["192.168.12.2"] - ntp_servers = ["192.0.0.3"] - log_servers = ["192.0.0.13"] - - tags { - key = "name" - value = "%[1]s" - } - } - - data "outscale_dhcp_options" "test" { - filter { - name = "dhcp_options_set_ids" - values = ["${outscale_dhcp_option.foo1.id}", "${outscale_dhcp_option.foo2.id}"] - } - } - `, value) -} - -func testAccOutscaleDHCPOptionsDatasourceConfigWithFilters(value string) string { - return fmt.Sprintf(` - resource "outscale_dhcp_option" "foo1" { - domain_name = "test.fr" - domain_name_servers = ["192.168.12.2"] - ntp_servers = ["192.0.0.3"] - log_servers = ["192.0.0.13"] - - tags { - key = "name" - value = "%[1]s" - } - } - - resource "outscale_dhcp_option" "foo2" { - domain_name = "test.fr" - domain_name_servers = ["192.168.12.2"] - ntp_servers = ["192.0.0.3"] - log_servers = ["192.0.0.13"] - - tags { - key = "name" - value = "%[1]s" - } - } - - data "outscale_dhcp_options" "test" { - filter { - name = "dhcp_options_set_ids" - values = ["${outscale_dhcp_option.foo1.id}", "${outscale_dhcp_option.foo2.id}"] - } - } - `, value) -} From c71abea042ccb9d60a5b5d79a38883be58054da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:32 +0000 Subject: [PATCH 16/82] Improve flexible_gpu datasource --- outscale/data_source_outscale_flexible_gpu.go | 16 ++-------------- outscale/data_source_outscale_flexible_gpus.go | 10 +++------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/outscale/data_source_outscale_flexible_gpu.go b/outscale/data_source_outscale_flexible_gpu.go index 70892b46f..b2e7e3571 100644 --- a/outscale/data_source_outscale_flexible_gpu.go +++ b/outscale/data_source_outscale_flexible_gpu.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -58,22 +57,11 @@ func dataSourceOutscaleOAPIFlexibleGpu() *schema.Resource { func dataSourceOutscaleOAPIFlexibleGpuRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - flexID, IDOk := d.GetOk("flexible_gpu_id") - - if !filtersOk && !IDOk { - return fmt.Errorf("One of filters, or flexible_gpu_id must be assigned") - } - req := oscgo.ReadFlexibleGpusRequest{} - - req.Filters = &oscgo.FiltersFlexibleGpu{ - FlexibleGpuIds: &[]string{flexID.(string)}, + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) } - req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) - var resp oscgo.ReadFlexibleGpusResponse var err error diff --git a/outscale/data_source_outscale_flexible_gpus.go b/outscale/data_source_outscale_flexible_gpus.go index fd183c948..2664e17f1 100644 --- a/outscale/data_source_outscale_flexible_gpus.go +++ b/outscale/data_source_outscale_flexible_gpus.go @@ -66,14 +66,10 @@ func dataSourceOutscaleOAPIFlexibleGpusRead(d *schema.ResourceData, meta interfa conn := meta.(*OutscaleClient).OSCAPI filters, filtersOk := d.GetOk("filter") - _, IDOk := d.GetOk("flexible_gpu_id") - - if !filtersOk && !IDOk { - return fmt.Errorf("One of filters, or flexible_gpu_id must be assigned") - } - req := oscgo.ReadFlexibleGpusRequest{} - req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) + if filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceFlexibleGpuFilters(filters.(*schema.Set))) + } var resp oscgo.ReadFlexibleGpusResponse var err error From e47167ec0281f442b0900458dcdb50291c657070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:33 +0000 Subject: [PATCH 17/82] Merge flexible_gpu datasource testacc --- .../data_source_outscale_flexible_gpu_test.go | 103 ++++++++++++------ ...data_source_outscale_flexible_gpus_test.go | 64 ----------- 2 files changed, 68 insertions(+), 99 deletions(-) delete mode 100644 outscale/data_source_outscale_flexible_gpus_test.go diff --git a/outscale/data_source_outscale_flexible_gpu_test.go b/outscale/data_source_outscale_flexible_gpu_test.go index 0c1390104..f401e6524 100644 --- a/outscale/data_source_outscale_flexible_gpu_test.go +++ b/outscale/data_source_outscale_flexible_gpu_test.go @@ -8,9 +8,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIFlexibleGpu_basic(t *testing.T) { +func TestAcc_FlexibleGpu_DataSource(t *testing.T) { t.Parallel() region := fmt.Sprintf("%sa", os.Getenv("OUTSCALE_REGION")) + dataSourceName := "data.outscale_flexible_gpu.fgpu" + dataSourcesName := "data.outscale_flexible_gpus.fgpus" resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -19,46 +21,77 @@ func TestAccDataSourceOutscaleOAPIFlexibleGpu_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIFlexibleGpuConfig(region, region), + Config: testAcc_FlexibleGpu_DataSource_Config(region), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "flexible_gpu_id"), + resource.TestCheckResourceAttrSet(dataSourcesName, "flexible_gpus.#"), + ), }, }, }) } -func testAccDataSourceOutscaleOAPIFlexibleGpuConfig(region, region1 string) string { +func testAcc_FlexibleGpu_DataSource_Config(region string) string { return fmt.Sprintf(` - resource "outscale_flexible_gpu" "fGPU-data1" { - model_name = "nvidia-p6" - generation = "v5" - subregion_name = "%s" - delete_on_vm_deletion = true - } + resource "outscale_flexible_gpu" "fGPU-1" { + model_name = "nvidia-p6" + generation = "v5" + subregion_name = "%[1]s" + delete_on_vm_deletion = true + } - data "outscale_flexible_gpu" "data_fGPU-1" { - filter { - name = "flexible_gpu_ids" - values = [outscale_flexible_gpu.fGPU-data1.flexible_gpu_id] - } - filter { - name = "delete_on_vm_deletion" - values = [true] - } - filter { - name = "generations" - values = ["v5"] - } - filter { - name = "states" - values = ["allocated"] - } - filter { - name = "model_names" - values = ["nvidia-p6"] - } - filter { - name = "subregion_names" - values = ["%s"] - } + data "outscale_flexible_gpu" "fgpu" { + filter { + name = "flexible_gpu_ids" + values = [outscale_flexible_gpu.fGPU-1.flexible_gpu_id] } - `, region, region) + filter { + name = "delete_on_vm_deletion" + values = [true] + } + filter { + name = "generations" + values = ["v5"] + } + filter { + name = "states" + values = ["allocated"] + } + filter { + name = "model_names" + values = ["nvidia-p6"] + } + filter { + name = "subregion_names" + values = ["%[1]s"] + } + } + + data "outscale_flexible_gpus" "fgpus" { + filter { + name = "flexible_gpu_ids" + values = [outscale_flexible_gpu.fGPU-1.flexible_gpu_id] + } + filter { + name = "delete_on_vm_deletion" + values = [true] + } + filter { + name = "generations" + values = ["v5"] + } + filter { + name = "states" + values = ["allocated"] + } + filter { + name = "model_names" + values = ["nvidia-p6"] + } + filter { + name = "subregion_names" + values = ["%[1]s"] + } + } + `, region) } diff --git a/outscale/data_source_outscale_flexible_gpus_test.go b/outscale/data_source_outscale_flexible_gpus_test.go deleted file mode 100644 index a325db959..000000000 --- a/outscale/data_source_outscale_flexible_gpus_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIFlexibleGpus_basic(t *testing.T) { - t.Parallel() - region := fmt.Sprintf("%sa", os.Getenv("OUTSCALE_REGION")) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIFlexibleGpusConfig(region, region), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIFlexibleGpusConfig(region, region1 string) string { - return fmt.Sprintf(` - resource "outscale_flexible_gpu" "fGPUS-1" { - model_name = "nvidia-p6" - generation = "v5" - subregion_name = "%s" - delete_on_vm_deletion = true - } - - data "outscale_flexible_gpu" "data_fGPU-1" { - filter { - name = "flexible_gpu_ids" - values = [outscale_flexible_gpu.fGPUS-1.flexible_gpu_id] - } - filter { - name = "delete_on_vm_deletion" - values = [true] - } - filter { - name = "generations" - values = ["v5"] - } - filter { - name = "states" - values = ["allocated"] - } - filter { - name = "model_names" - values = ["nvidia-p6"] - } - filter { - name = "subregion_names" - values = ["%s"] - } - } - `, region, region) -} From 25244de7b3f935902df71536b5dd67e2856a1d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:46 +0000 Subject: [PATCH 18/82] Improve image datasource --- outscale/data_source_outscale_image.go | 50 ++++------------------- outscale/data_source_outscale_images.go | 53 ++++--------------------- 2 files changed, 14 insertions(+), 89 deletions(-) diff --git a/outscale/data_source_outscale_image.go b/outscale/data_source_outscale_image.go index 20d3c70b5..045e3ebf5 100644 --- a/outscale/data_source_outscale_image.go +++ b/outscale/data_source_outscale_image.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -20,16 +19,13 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { "filter": dataSourceFiltersSchema(), "permission": { Type: schema.TypeList, - Optional: true, - ForceNew: true, + Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "image_id": { Type: schema.TypeString, - Optional: true, - ForceNew: true, + Computed: true, }, - // Computed values. "architecture": { Type: schema.TypeString, Computed: true, @@ -84,39 +80,32 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { }, "block_device_mappings": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bsu": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "delete_on_vm_deletion": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "iops": { Type: schema.TypeInt, - Optional: true, Computed: true, }, "snapshot_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "volume_size": { Type: schema.TypeInt, - Optional: true, Computed: true, }, "volume_type": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -124,12 +113,10 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { }, "device_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "virtual_device_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -197,30 +184,11 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { func dataSourceOutscaleOAPIImageRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - executableUsers, executableUsersOk := d.GetOk("permission") - ai, aisOk := d.GetOk("account_id") - imageID, imageIDOk := d.GetOk("image_id") - if !executableUsersOk && !filtersOk && !aisOk && !imageIDOk { - return fmt.Errorf("One of executable_users, filters, or account_id must be assigned, or image_id must be provided") + req := oscgo.ReadImagesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) } - filtersReq := &oscgo.FiltersImage{} - if filtersOk { - filtersReq = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) - } - if imageIDOk { - filtersReq.SetImageIds([]string{imageID.(string)}) - } - if aisOk { - filtersReq.SetAccountIds([]string{ai.(string)}) - } - if executableUsersOk { - filtersReq.SetPermissionsToLaunchAccountIds(utils.InterfaceSliceToStringSlice(executableUsers.([]interface{}))) - } - - req := oscgo.ReadImagesRequest{Filters: filtersReq} - var resp oscgo.ReadImagesResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { @@ -237,12 +205,8 @@ func dataSourceOutscaleOAPIImageRead(d *schema.ResourceData, meta interface{}) e } images := resp.GetImages() - - if len(images) < 1 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - if len(images) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more specific search criteria") + if err := utils.IsResponseEmptyOrMutiple(len(images), "Image Export Task"); err != nil { + return err } return resourceDataAttrSetter(d, func(set AttributeSetter) error { diff --git a/outscale/data_source_outscale_images.go b/outscale/data_source_outscale_images.go index f2afc57ab..2bbc88496 100644 --- a/outscale/data_source_outscale_images.go +++ b/outscale/data_source_outscale_images.go @@ -20,25 +20,6 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "permissions": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "image_ids": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "account_ids": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - // Computed values. "request_id": { Type: schema.TypeString, Computed: true, @@ -62,39 +43,32 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { }, "block_device_mappings": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bsu": { Type: schema.TypeList, - Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "delete_on_vm_deletion": { Type: schema.TypeBool, - Optional: true, Computed: true, }, "iops": { Type: schema.TypeInt, - Optional: true, Computed: true, }, "snapshot_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "volume_size": { Type: schema.TypeInt, - Optional: true, Computed: true, }, "volume_type": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -102,12 +76,10 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { }, "device_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "virtual_device_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, @@ -214,26 +186,11 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { func dataSourceOutscaleOAPIImagesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - executableUsers, executableUsersOk := d.GetOk("permissions") - filters, filtersOk := d.GetOk("filter") - aids, ownersOk := d.GetOk("account_ids") - if !executableUsersOk && !filtersOk && !ownersOk { - return fmt.Errorf("One of executable_users, filters, or account_ids must be assigned") + req := oscgo.ReadImagesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) } - filtersReq := &oscgo.FiltersImage{} - if filtersOk { - filtersReq = buildOutscaleOAPIDataSourceImagesFilters(filters.(*schema.Set)) - } - if ownersOk { - filtersReq.SetAccountIds([]string{aids.(string)}) - } - if executableUsersOk { - filtersReq.SetPermissionsToLaunchAccountIds(utils.InterfaceSliceToStringSlice(executableUsers.([]interface{}))) - } - - req := oscgo.ReadImagesRequest{Filters: filtersReq} - var resp oscgo.ReadImagesResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { @@ -251,6 +208,10 @@ func dataSourceOutscaleOAPIImagesRead(d *schema.ResourceData, meta interface{}) images := resp.GetImages() + if len(images) == 0 { + return fmt.Errorf("your query returned no results, please change your search criteria and try again") + } + return resourceDataAttrSetter(d, func(set AttributeSetter) error { d.SetId(resource.UniqueId()) From 8e56123559686243f66c7360a76ba53c17bd22cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:46 +0000 Subject: [PATCH 19/82] Merge image datasource testacc --- outscale/data_source_outscale_image_test.go | 95 +++++++------------- outscale/data_source_outscale_images_test.go | 83 ----------------- 2 files changed, 30 insertions(+), 148 deletions(-) delete mode 100644 outscale/data_source_outscale_images_test.go diff --git a/outscale/data_source_outscale_image_test.go b/outscale/data_source_outscale_image_test.go index 5d542f09d..2d84690e8 100644 --- a/outscale/data_source_outscale_image_test.go +++ b/outscale/data_source_outscale_image_test.go @@ -7,37 +7,16 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPIImageDataSource_Instance(t *testing.T) { +func TestAcc_Image_DataSource(t *testing.T) { t.Parallel() omi := os.Getenv("OUTSCALE_IMAGEID") region := os.Getenv("OUTSCALE_REGION") imageName := fmt.Sprintf("image-test-%d", acctest.RandInt()) - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIImageConfigBasic(omi, "tinav4.c2r2p2", region, imageName), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIImageDataSourceID("data.outscale_image.nat_ami"), - resource.TestCheckResourceAttr("data.outscale_image.nat_ami", "architecture", "x86_64"), - ), - }, - }, - }) -} - -func TestAccOutscaleOAPIImageDataSource_basic(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") - region := os.Getenv("OUTSCALE_REGION") - imageName := fmt.Sprintf("image-test-%d", acctest.RandInt()) + dataSourceName := "data.outscale_image.omi" + dataSourcesName := "data.outscale_images.omis" resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -46,69 +25,55 @@ func TestAccOutscaleOAPIImageDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIImageDataSourceBasicConfig(omi, "tinav4.c2r2p2", region, imageName), + Config: testAcc_Image_DataSource_Config(omi, "tinav4.c2r2p2", region, imageName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIImageDataSourceID("data.outscale_image.omi"), + + resource.TestCheckResourceAttrSet(dataSourceName, "image_id"), + resource.TestCheckResourceAttr(dataSourcesName, "images.#", "2"), ), }, }, }) } -func testAccCheckOutscaleOAPIImageDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find AMI data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("AMI data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPIImageDataSourceBasicConfig(omi, vmType, region, imageName string) string { +func testAcc_Image_DataSource_Config(omi, vmType, region, imageName string) string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { + resource "outscale_vm" "basic_one" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "terraform-basic" placement_subregion_name = "%[3]sa" } - resource "outscale_image" "image" { - image_name = "%[4]s" - vm_id = "${outscale_vm.basic.id}" + resource "outscale_vm" "basic_two" { + image_id = "%[1]s" + vm_type = "%[2]s" + keypair_name = "terraform-basic" + placement_subregion_name = "%[3]sa" + } + + resource "outscale_image" "image_one" { + image_name = "%[4]s-one" + vm_id = outscale_vm.basic_one.id + } + + resource "outscale_image" "image_two" { + image_name = "%[4]s-two" + vm_id = outscale_vm.basic_two.id } data "outscale_image" "omi" { filter { name = "image_ids" - values = ["${outscale_image.image.id}"] + values = [outscale_image.image_one.id] } } - `, omi, vmType, region, imageName) -} -func testAccCheckOutscaleOAPIImageConfigBasic(omi, vmType, region, imageName string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%[1]s" - vm_type = "%[2]s" - keypair_name = "terraform-basic" - placement_subregion_name = "%[3]sa" - } - - resource "outscale_image" "foo" { - image_name = "%[4]s" - vm_id = "${outscale_vm.basic.id}" - } - - data "outscale_image" "nat_ami" { - image_id = "${outscale_image.foo.id}" + data "outscale_images" "omis" { + filter { + name = "image_ids" + values = [outscale_image.image_one.id, outscale_image.image_two.id] + } } `, omi, vmType, region, imageName) } diff --git a/outscale/data_source_outscale_images_test.go b/outscale/data_source_outscale_images_test.go deleted file mode 100644 index 9f3c34a95..000000000 --- a/outscale/data_source_outscale_images_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccOutscaleOAPIImagesDataSource_Instance(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") - region := os.Getenv("OUTSCALE_REGION") - imageName := fmt.Sprintf("image-test-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, "tinav4.c2r2p2", region, imageName), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIImagesDataSourceID("data.outscale_images.nat_ami"), - ), - }, - }, - }) -} - -func testAccCheckOutscaleOAPIImagesDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find AMI data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("AMI data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, vmType, region, imageName string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic_one" { - image_id = "%[1]s" - vm_type = "%[2]s" - keypair_name = "terraform-basic" - placement_subregion_name = "%[3]sa" - } - - resource "outscale_vm" "basic_two" { - image_id = "%[1]s" - vm_type = "%[2]s" - keypair_name = "terraform-basic" - placement_subregion_name = "%[3]sa" - } - - resource "outscale_image" "image_one" { - image_name = "%[4]s-one" - vm_id = "${outscale_vm.basic_one.id}" - } - - resource "outscale_image" "image_two" { - image_name = "%[4]s-two" - vm_id = "${outscale_vm.basic_two.id}" - } - - data "outscale_images" "nat_ami" { - filter { - name = "image_ids" - values = ["${outscale_image.image_one.id}", "${outscale_image.image_two.id}"] - } - } - `, omi, vmType, region, imageName) -} From e0de8df0ecdf824e623e8f9fcb8e9f2e66e68304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:57 +0000 Subject: [PATCH 20/82] Improve keypair datasource --- outscale/data_source_outscale_keypair.go | 24 +++------------- outscale/data_source_outscale_keypairs.go | 35 ++++------------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/outscale/data_source_outscale_keypair.go b/outscale/data_source_outscale_keypair.go index 0cd0d5ff4..9699fc586 100644 --- a/outscale/data_source_outscale_keypair.go +++ b/outscale/data_source_outscale_keypair.go @@ -16,20 +16,9 @@ import ( func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadKeypairsRequest{ - Filters: &oscgo.FiltersKeypair{KeypairNames: &[]string{d.Id()}}, - } - - KeyName, KeyNameisOk := d.GetOk("keypair_name") - if KeyNameisOk { - filter := oscgo.FiltersKeypair{} - filter.SetKeypairNames([]string{KeyName.(string)}) - req.SetFilters(filter) - } - - filters, filtersOk := d.GetOk("filter") + req := oscgo.ReadKeypairsRequest{} - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleOAPIKeyPairsDataSourceFilters(filters.(*schema.Set))) } @@ -59,12 +48,8 @@ func datasourceOutscaleOApiKeyPairRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error retrieving OAPIKeyPair: %s", errString) } - if len(resp.GetKeypairs()) < 1 { - return fmt.Errorf("Unable to find key pair, please provide a better query criteria ") - } - if len(resp.GetKeypairs()) > 1 { - - return fmt.Errorf("Found to many key pairs, please provide a better query criteria ") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetKeypairs()), "KeyPair"); err != nil { + return err } keypair := resp.GetKeypairs()[0] @@ -88,7 +73,6 @@ func datasourceOutscaleOAPIKeyPair() *schema.Resource { // Attributes "keypair_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "keypair_fingerprint": { diff --git a/outscale/data_source_outscale_keypairs.go b/outscale/data_source_outscale_keypairs.go index 275d35aad..e775628f4 100644 --- a/outscale/data_source_outscale_keypairs.go +++ b/outscale/data_source_outscale_keypairs.go @@ -15,26 +15,9 @@ import ( func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadKeypairsRequest{ - Filters: &oscgo.FiltersKeypair{}, - } - - //filters, filtersOk := d.GetOk("filter") - KeyName, KeyNameisOk := d.GetOk("keypair_names") - - if KeyNameisOk { - var names []string - for _, v := range KeyName.([]interface{}) { - names = append(names, v.(string)) - } - filter := oscgo.FiltersKeypair{} - filter.SetKeypairNames(names) - req.SetFilters(filter) - } + req := oscgo.ReadKeypairsRequest{} - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleOAPIKeyPairsDataSourceFilters(filters.(*schema.Set))) } @@ -64,13 +47,14 @@ func datasourceOutscaleOAPiKeyPairsRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error retrieving OAPIKeyPair: %s", errString) } - if len(resp.GetKeypairs()) < 1 { - return fmt.Errorf("Unable to find key pair, please provide a better query criteria ") + result_len := len(resp.GetKeypairs()) + if result_len == 0 { + return fmt.Errorf("your query returned no results, please change your search criteria and try again") } d.SetId(resource.UniqueId()) - keypairs := make([]map[string]interface{}, len(resp.GetKeypairs())) + keypairs := make([]map[string]interface{}, result_len) for k, v := range resp.GetKeypairs() { keypair := make(map[string]interface{}) if v.GetKeypairName() != "" { @@ -92,13 +76,6 @@ func datasourceOutscaleOAPIKeyPairs() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), // Attributes - "keypair_names": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "keypairs": { Type: schema.TypeList, Computed: true, From 2d8704b2dfaeeeb8e15975d50cb92b97bad70b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:23:57 +0000 Subject: [PATCH 21/82] Merge keypair datasource testacc --- outscale/data_source_outscale_keypair_test.go | 41 +++++-------- .../data_source_outscale_keypairs_test.go | 60 ------------------- 2 files changed, 16 insertions(+), 85 deletions(-) delete mode 100644 outscale/data_source_outscale_keypairs_test.go diff --git a/outscale/data_source_outscale_keypair_test.go b/outscale/data_source_outscale_keypair_test.go index eb7c0f409..f64a9e7ab 100644 --- a/outscale/data_source_outscale_keypair_test.go +++ b/outscale/data_source_outscale_keypair_test.go @@ -5,55 +5,46 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccOutscaleOAPIKeypairDataSource_Instance(t *testing.T) { +func TestAcc_Keypair_DataSource(t *testing.T) { t.Parallel() keyPairName := fmt.Sprintf("acc-test-keypair-%d", utils.RandIntRange(0, 400)) - + dataSourceName := "data.outscale_keypair.keypair" + dataSourcesName := "data.outscale_keypairs.keypairs" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIKeypairDataSourceConfig(keyPairName), + Config: testAcc_Keypair_DataSource_Config(keyPairName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeypairDataSourceID("data.outscale_keypair.nat_ami"), - resource.TestCheckResourceAttr("data.outscale_keypair.nat_ami", "keypair_name", keyPairName), + resource.TestCheckResourceAttr(dataSourceName, "keypair_name", keyPairName), + resource.TestCheckResourceAttr(dataSourcesName, "keypairs.#", "1"), ), }, }, }) } -func testAccCheckOutscaleOAPIKeypairDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find key pair data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Key Pair data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPIKeypairDataSourceConfig(keypairName string) string { +func testAcc_Keypair_DataSource_Config(keypairName string) string { return fmt.Sprintf(` resource "outscale_keypair" "a_key_pair" { keypair_name = "%s" } - data "outscale_keypair" "nat_ami" { - #keypair_name = "${outscale_keypair.a_key_pair.id}" + data "outscale_keypair" "keypair" { + filter { + name = "keypair_names" + values = [outscale_keypair.a_key_pair.keypair_name] + } + } + + data "outscale_keypairs" "keypairs" { filter { name = "keypair_names" - values = ["${outscale_keypair.a_key_pair.keypair_name}"] + values = [outscale_keypair.a_key_pair.keypair_name] } } `, keypairName) diff --git a/outscale/data_source_outscale_keypairs_test.go b/outscale/data_source_outscale_keypairs_test.go deleted file mode 100644 index 1d0457bda..000000000 --- a/outscale/data_source_outscale_keypairs_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccOutscaleOAPIKeypairsDataSource_Instance(t *testing.T) { - t.Parallel() - keyPairName := fmt.Sprintf("testacc-keypair-%d", utils.RandIntRange(0, 400)) - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIKeypairsDataSourceConfig(keyPairName), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIKeypairsDataSourceID("data.outscale_keypairs.nat_ami"), - resource.TestCheckResourceAttr("data.outscale_keypairs.nat_ami", "keypairs.0.keypair_name", keyPairName), - ), - }, - }, - }) -} - -func testAccCheckOutscaleOAPIKeypairsDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find keypair data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Key Pair data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPIKeypairsDataSourceConfig(keyPairName string) string { - return fmt.Sprintf(` - resource "outscale_keypair" "a_key_pair" { - keypair_name = "%s" - } - - data "outscale_keypairs" "nat_ami" { - #keypair_name = ["${outscale_keypair.a_key_pair.id}"] - - filter { - name = "keypair_names" - values = ["${outscale_keypair.a_key_pair.keypair_name}"] - } - } - `, keyPairName) -} From 6cf5fb1c745fa6cf66778abe7b9101c6f3d6705b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:17 +0000 Subject: [PATCH 22/82] Improve load_balancer datasource --- .../data_source_outscale_load_balancer.go | 44 ++++--------------- .../data_source_outscale_load_balancers.go | 16 +++---- 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/outscale/data_source_outscale_load_balancer.go b/outscale/data_source_outscale_load_balancer.go index 4fee3c09c..00e105fcc 100644 --- a/outscale/data_source_outscale_load_balancer.go +++ b/outscale/data_source_outscale_load_balancer.go @@ -23,24 +23,20 @@ func attrLBchema() map[string]*schema.Schema { }, "load_balancer_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "load_balancer_type": { Type: schema.TypeString, - Optional: true, Computed: true, }, "security_groups": { Type: schema.TypeList, Computed: true, - Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "subnets": { Type: schema.TypeList, Computed: true, - Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "source_security_group": lb_sg_schema(), @@ -48,7 +44,6 @@ func attrLBchema() map[string]*schema.Schema { "dns_name": { Type: schema.TypeString, Computed: true, - Optional: true, }, "access_log": { Type: schema.TypeList, @@ -78,7 +73,6 @@ func attrLBchema() map[string]*schema.Schema { "health_check": { Type: schema.TypeList, Computed: true, - Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "healthy_threshold": { @@ -115,13 +109,11 @@ func attrLBchema() map[string]*schema.Schema { "backend_vm_ids": { Type: schema.TypeList, Computed: true, - Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "listeners": { Type: schema.TypeList, Computed: true, - Optional: true, Elem: &schema.Resource{ Schema: lb_listener_schema(true), }, @@ -136,9 +128,7 @@ func attrLBchema() map[string]*schema.Schema { }, "net_id": { Type: schema.TypeString, - Optional: true, Computed: true, - ForceNew: true, }, "application_sticky_cookie_policies": { Type: schema.TypeList, @@ -209,38 +199,21 @@ func buildOutscaleDataSourceLBFilters(set *schema.Set) oscgo.FiltersLoadBalancer case "load_balancer_name": filters.LoadBalancerNames = &filterValues default: - filters.LoadBalancerNames = &filterValues log.Printf("[Debug] Unknown Filter Name: %s. default to 'load_balancer_name'", name) } } return filters } -func readLbs(conn *oscgo.APIClient, d *schema.ResourceData) (*oscgo.ReadLoadBalancersResponse, *string, error) { +func readLbs(conn *oscgo.APIClient, d *schema.ResourceData) (*oscgo.ReadLoadBalancersResponse, error) { return readLbs_(conn, d, schema.TypeString) } -func readLbs_(conn *oscgo.APIClient, d *schema.ResourceData, t schema.ValueType) (*oscgo.ReadLoadBalancersResponse, *string, error) { - ename, nameOk := d.GetOk("load_balancer_name") - filters, filtersOk := d.GetOk("filter") - req := oscgo.ReadLoadBalancersRequest{ - Filters: &oscgo.FiltersLoadBalancer{}, - } - - if !nameOk && !filtersOk { - return nil, nil, fmt.Errorf("One of filters, or load_balancer_name must be assigned") - } - - if filtersOk { +func readLbs_(conn *oscgo.APIClient, d *schema.ResourceData, t schema.ValueType) (*oscgo.ReadLoadBalancersResponse, error) { + req := oscgo.ReadLoadBalancersRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleDataSourceLBFilters(filters.(*schema.Set))) - } else if t == schema.TypeString { - req.Filters.SetLoadBalancerNames([]string{ename.(string)}) - } else { /* assuming typelist */ - req.Filters = &oscgo.FiltersLoadBalancer{ - LoadBalancerNames: utils.InterfaceSliceToStringSlicePtr(ename.([]interface{})), - } } - elbName := (*req.Filters.LoadBalancerNames)[0] var resp oscgo.ReadLoadBalancersResponse var err error var statusCode int @@ -255,20 +228,19 @@ func readLbs_(conn *oscgo.APIClient, d *schema.ResourceData, t schema.ValueType) statusCode = httpResp.StatusCode return nil }) - if err != nil { if statusCode == http.StatusNotFound { d.SetId("") - return nil, nil, fmt.Errorf("Loadbalancer Not Found") + return nil, fmt.Errorf("Loadbalancer Not Found") } - return nil, nil, fmt.Errorf("Error retrieving ELB: %s", err) + return nil, fmt.Errorf("Error retrieving ELB: %s", err) } - return &resp, &elbName, nil + return &resp, nil } func readLbs0(conn *oscgo.APIClient, d *schema.ResourceData) (*oscgo.LoadBalancer, *oscgo.ReadLoadBalancersResponse, error) { - resp, _, err := readLbs(conn, d) + resp, err := readLbs(conn, d) if err != nil { return nil, nil, err } diff --git a/outscale/data_source_outscale_load_balancers.go b/outscale/data_source_outscale_load_balancers.go index 5a5b34540..052d6c384 100644 --- a/outscale/data_source_outscale_load_balancers.go +++ b/outscale/data_source_outscale_load_balancers.go @@ -8,12 +8,7 @@ import ( func attrLBSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "load_balancer_name": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "load_balancer": { + "load_balancers": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -105,7 +100,7 @@ func attrLBSchema() map[string]*schema.Schema { }, "listeners": { Type: schema.TypeList, - Required: true, + Computed: true, Elem: &schema.Resource{ Schema: lb_listener_schema(true), }, @@ -193,8 +188,7 @@ func attrLBSchema() map[string]*schema.Schema { func dataSourceOutscaleOAPILoadBalancers() *schema.Resource { return &schema.Resource{ - Read: dataSourceOutscaleOAPILoadBalancersRead, - + Read: dataSourceOutscaleOAPILoadBalancersRead, Schema: getDataSourceSchemas(attrLBSchema()), } } @@ -202,7 +196,7 @@ func dataSourceOutscaleOAPILoadBalancers() *schema.Resource { func dataSourceOutscaleOAPILoadBalancersRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - resp, _, err := readLbs_(conn, d, schema.TypeList) + resp, err := readLbs_(conn, d, schema.TypeList) if err != nil { return err } @@ -283,7 +277,7 @@ func dataSourceOutscaleOAPILoadBalancersRead(d *schema.ResourceData, meta interf lbs_ret[k] = l } - err = d.Set("load_balancer", lbs_ret) + err = d.Set("load_balancers", lbs_ret) if err != nil { return err } From 4087b3d3509057a4bc10927416581f9ed26d4a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:17 +0000 Subject: [PATCH 23/82] Merge load_balancer datasource testacc --- ...data_source_outscale_load_balancer_test.go | 35 ++++++----- ...ata_source_outscale_load_balancers_test.go | 60 ------------------- 2 files changed, 21 insertions(+), 74 deletions(-) delete mode 100644 outscale/data_source_outscale_load_balancers_test.go diff --git a/outscale/data_source_outscale_load_balancer_test.go b/outscale/data_source_outscale_load_balancer_test.go index ebfcf19f4..896d1cb9b 100644 --- a/outscale/data_source_outscale_load_balancer_test.go +++ b/outscale/data_source_outscale_load_balancer_test.go @@ -5,17 +5,15 @@ import ( "os" "testing" - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPIDSLBU_basic(t *testing.T) { +func TestAcc_LoadBalancer_DataSource(t *testing.T) { t.Parallel() - var conf oscgo.LoadBalancer - region := os.Getenv("OUTSCALE_REGION") zone := fmt.Sprintf("%sa", region) + dataSourceName := "data.outscale_load_balancer.test" + dataSourcesName := "data.outscale_load_balancers.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -25,19 +23,18 @@ func TestAccOutscaleOAPIDSLBU_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, Steps: []resource.TestStep{ { - Config: testAccDSOutscaleOAPILBUConfig(zone), + Config: testAcc_LoadBalancer_DataSource_Config(zone), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPILBUExists("outscale_load_balancer.dataLb", &conf), - resource.TestCheckResourceAttr( - "data.outscale_load_balancer.dataTest", "subregion_names.#", "1"), - resource.TestCheckResourceAttr( - "data.outscale_load_balancer.dataTest", "subregion_names.0", zone), + resource.TestCheckResourceAttr(dataSourceName, "subregion_names.#", "1"), + resource.TestCheckResourceAttr(dataSourceName, "subregion_names.0", zone), + + resource.TestCheckResourceAttr(dataSourcesName, "load_balancers.#", "1"), )}, }, }) } -func testAccDSOutscaleOAPILBUConfig(zone string) string { +func testAcc_LoadBalancer_DataSource_Config(zone string) string { return fmt.Sprintf(` resource "outscale_load_balancer" "dataLb" { subregion_names = ["%s"] @@ -56,8 +53,18 @@ func testAccDSOutscaleOAPILBUConfig(zone string) string { } } - data "outscale_load_balancer" "dataTest" { - load_balancer_name = outscale_load_balancer.dataLb.id + data "outscale_load_balancer" "test" { + filter { + name = "load_balancer_names" + values = [outscale_load_balancer.dataLb.id] + } + } + + data "outscale_load_balancers" "test" { + filter { + name = "load_balancer_names" + values = [outscale_load_balancer.dataLb.id] + } } `, zone) } diff --git a/outscale/data_source_outscale_load_balancers_test.go b/outscale/data_source_outscale_load_balancers_test.go deleted file mode 100644 index 2b9ca6abf..000000000 --- a/outscale/data_source_outscale_load_balancers_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccOutscaleOAPIDSLBSU_basic(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") - zone := fmt.Sprintf("%sa", region) - numLbu := utils.RandIntRange(0, 50) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - IDRefreshName: "outscale_load_balancer.bar", - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPILBUDestroy, - Steps: []resource.TestStep{ - { - Config: testAccDSOutscaleOAPILBsUConfig(zone, numLbu), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_load_balancers.test", "load_balancer.#", "1"), - )}, - }, - }) -} - -func testAccDSOutscaleOAPILBsUConfig(zone string, numLbu int) string { - return fmt.Sprintf(` - resource "outscale_load_balancer" "bar" { - subregion_names = ["%s"] - load_balancer_name = "foobar-terraform-elb%d" - - listeners { - backend_port = 8000 - backend_protocol = "HTTP" - load_balancer_port = 80 - - // Protocol should be case insensitive - load_balancer_protocol = "HTTP" - } - - tags { - key = "name" - value = "baz" - } - } - - data "outscale_load_balancers" "test" { - load_balancer_name = [outscale_load_balancer.bar.id] - } -`, zone, numLbu) -} From 6c10f27836b5bb36c50b593bf97879a2e9601e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:28 +0000 Subject: [PATCH 24/82] Improve nat_service datasource --- outscale/data_source_outscale_nat_service.go | 35 ++++--------------- outscale/data_source_outscale_nat_services.go | 33 +++-------------- 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/outscale/data_source_outscale_nat_service.go b/outscale/data_source_outscale_nat_service.go index 27ee999d7..4e5253e1f 100644 --- a/outscale/data_source_outscale_nat_service.go +++ b/outscale/data_source_outscale_nat_service.go @@ -21,7 +21,7 @@ func dataSourceOutscaleOAPINatService() *schema.Resource { "filter": dataSourceFiltersSchema(), "nat_service_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "subnet_id": { Type: schema.TypeString, @@ -63,29 +63,14 @@ func dataSourceOutscaleOAPINatService() *schema.Resource { func dataSourceOutscaleOAPINatServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - natGatewayID, natGatewayIDOK := d.GetOk("nat_service_id") - - if !filtersOk && !natGatewayIDOK { - return fmt.Errorf("filters, or owner must be assigned, or nat_service_id must be provided") - } - - params := oscgo.ReadNatServicesRequest{} - - if filtersOk { - params.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) + req := oscgo.ReadNatServicesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) } - if natGatewayIDOK && natGatewayID.(string) != "" { - filter := oscgo.FiltersNatService{} - filter.SetNatServiceIds([]string{natGatewayID.(string)}) - params.SetFilters(filter) - } - var resp oscgo.ReadNatServicesResponse err := resource.Retry(5*time.Minute, func() *resource.RetryError { var err error - rp, httpResp, err := conn.NatServiceApi.ReadNatServices(context.Background()).ReadNatServicesRequest(params).Execute() + rp, httpResp, err := conn.NatServiceApi.ReadNatServices(context.Background()).ReadNatServicesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -100,14 +85,8 @@ func dataSourceOutscaleOAPINatServiceRead(d *schema.ResourceData, meta interface return fmt.Errorf("[DEBUG] Error reading Nar Service (%s)", errString) } - - if len(resp.GetNatServices()) < 1 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - - if len(resp.GetNatServices()) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more " + - "specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetNatServices()), "Nat Service"); err != nil { + return err } return ngOAPIDescriptionAttributes(d, resp.GetNatServices()[0]) diff --git a/outscale/data_source_outscale_nat_services.go b/outscale/data_source_outscale_nat_services.go index fcefe4fdc..24692210c 100644 --- a/outscale/data_source_outscale_nat_services.go +++ b/outscale/data_source_outscale_nat_services.go @@ -18,13 +18,6 @@ func dataSourceOutscaleOAPINatServices() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "nat_service_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - // Attributes "nat_services": { Type: schema.TypeList, Computed: true, @@ -76,33 +69,15 @@ func dataSourceOutscaleOAPINatServices() *schema.Resource { func dataSourceOutscaleOAPINatServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - natGatewayID, natGatewayIDOK := d.GetOk("nat_service_ids") - - if !filtersOk && !natGatewayIDOK { - return fmt.Errorf("filters, or owner must be assigned, or nat_service_id must be provided") - } - - params := oscgo.ReadNatServicesRequest{} - if filtersOk { - params.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) - } - if natGatewayIDOK { - ids := make([]string, len(natGatewayID.([]interface{}))) - - for k, v := range natGatewayID.([]interface{}) { - ids[k] = v.(string) - } - filter := oscgo.FiltersNatService{} - filter.SetNatServiceIds(ids) - params.SetFilters(filter) + req := oscgo.ReadNatServicesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPINatServiceDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadNatServicesResponse err := resource.Retry(5*time.Minute, func() *resource.RetryError { var err error - rp, httpResp, err := conn.NatServiceApi.ReadNatServices(context.Background()).ReadNatServicesRequest(params).Execute() + rp, httpResp, err := conn.NatServiceApi.ReadNatServices(context.Background()).ReadNatServicesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 18c6dbea62c14bb6c8a331366b85dffd704b580d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:28 +0000 Subject: [PATCH 25/82] Merge nat_service datasource testacc --- .../data_source_outscale_nat_service_test.go | 67 ++++++++-------- .../data_source_outscale_nat_services_test.go | 78 ------------------- 2 files changed, 33 insertions(+), 112 deletions(-) delete mode 100644 outscale/data_source_outscale_nat_services_test.go diff --git a/outscale/data_source_outscale_nat_service_test.go b/outscale/data_source_outscale_nat_service_test.go index 722ec520f..7b1815634 100644 --- a/outscale/data_source_outscale_nat_service_test.go +++ b/outscale/data_source_outscale_nat_service_test.go @@ -1,46 +1,32 @@ package outscale import ( - "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPINatServiceDataSource_Instance(t *testing.T) { +func TestAcc_NatService_DataSource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_nat_service.nat" + dataSourcesName := "data.outscale_nat_services.nats" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPINatServiceDataSourceConfig, + Config: testAcc_NatService_DataSource_Config, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleNatServiceDataSourceID("data.outscale_nat_service.nat"), - resource.TestCheckResourceAttrSet("data.outscale_nat_service.nat", "subnet_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "subnet_id"), + resource.TestCheckResourceAttr(dataSourcesName, "nat_services.#", "1"), + resource.TestCheckResourceAttrSet(dataSourcesName, "nat_services.0.subnet_id"), ), }, }, }) } -func testAccCheckOutscaleNatServiceDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find Nat Service data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Nat Service data source ID not set") - } - return nil - } -} - -const testAccCheckOutscaleOAPINatServiceDataSourceConfig = ` +const testAcc_NatService_DataSource_Config = ` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" tags { @@ -50,41 +36,54 @@ const testAccCheckOutscaleOAPINatServiceDataSourceConfig = ` } resource "outscale_subnet" "outscale_subnet" { - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id ip_range = "10.0.0.0/18" } resource "outscale_public_ip" "outscale_public_ip" {} resource "outscale_nat_service" "outscale_nat_service" { - depends_on = ["outscale_route.outscale_route"] - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - public_ip_id = "${outscale_public_ip.outscale_public_ip.public_ip_id}" + depends_on = [outscale_route.outscale_route] + subnet_id = outscale_subnet.outscale_subnet.subnet_id + public_ip_id = outscale_public_ip.outscale_public_ip.public_ip_id } resource "outscale_route_table" "outscale_route_table" { - net_id = "${outscale_net.outscale_net.net_id}" + net_id = outscale_net.outscale_net.net_id } resource "outscale_route" "outscale_route" { destination_ip_range = "0.0.0.0/0" - gateway_id = "${outscale_internet_service.outscale_internet_service.internet_service_id}" - route_table_id = "${outscale_route_table.outscale_route_table.route_table_id}" + gateway_id = outscale_internet_service.outscale_internet_service.internet_service_id + route_table_id = outscale_route_table.outscale_route_table.route_table_id } resource "outscale_route_table_link" "outscale_route_table_link" { - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - route_table_id = "${outscale_route_table.outscale_route_table.id}" + subnet_id = outscale_subnet.outscale_subnet.subnet_id + route_table_id = outscale_route_table.outscale_route_table.id } resource "outscale_internet_service" "outscale_internet_service" {} resource "outscale_internet_service_link" "outscale_internet_service_link" { - net_id = "${outscale_net.outscale_net.net_id}" - internet_service_id = "${outscale_internet_service.outscale_internet_service.id}" + net_id = outscale_net.outscale_net.net_id + internet_service_id = outscale_internet_service.outscale_internet_service.id } + + + data "outscale_nat_service" "nat" { - nat_service_id = "${outscale_nat_service.outscale_nat_service.id}" + filter { + name = "nat_service_ids" + values = [outscale_nat_service.outscale_nat_service.id] + } + } + + data "outscale_nat_services" "nats" { + filter { + name = "nat_service_ids" + values = [outscale_nat_service.outscale_nat_service.id] + } } ` diff --git a/outscale/data_source_outscale_nat_services_test.go b/outscale/data_source_outscale_nat_services_test.go deleted file mode 100644 index 7f5490c8f..000000000 --- a/outscale/data_source_outscale_nat_services_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPINatServicesDataSource_Instance(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPINatServicesDataSourceConfig, - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleNatServiceDataSourceID("data.outscale_nat_services.nat"), - resource.TestCheckResourceAttr("data.outscale_nat_services.nat", "nat_services.#", "1"), - resource.TestCheckResourceAttrSet("data.outscale_nat_services.nat", "nat_services.0.subnet_id"), - ), - }, - }, - }) -} - -const testAccCheckOutscaleOAPINatServicesDataSourceConfig = ` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-nat-services-ds" - } - } - - resource "outscale_subnet" "outscale_subnet" { - net_id = "${outscale_net.outscale_net.net_id}" - ip_range = "10.0.0.0/18" - } - - resource "outscale_public_ip" "outscale_public_ip" {} - - resource "outscale_nat_service" "outscale_nat_service" { - depends_on = ["outscale_route.outscale_route"] - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - public_ip_id = "${outscale_public_ip.outscale_public_ip.public_ip_id}" - } - - resource "outscale_route_table" "outscale_route_table" { - net_id = "${outscale_net.outscale_net.net_id}" - } - - resource "outscale_route" "outscale_route" { - destination_ip_range = "0.0.0.0/0" - gateway_id = "${outscale_internet_service.outscale_internet_service.internet_service_id}" - route_table_id = "${outscale_route_table.outscale_route_table.route_table_id}" - } - - resource "outscale_route_table_link" "outscale_route_table_link" { - subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" - route_table_id = "${outscale_route_table.outscale_route_table.id}" - } - - resource "outscale_internet_service" "outscale_internet_service" {} - - resource "outscale_internet_service_link" "outscale_internet_service_link" { - net_id = "${outscale_net.outscale_net.net_id}" - internet_service_id = "${outscale_internet_service.outscale_internet_service.id}" - } - - data "outscale_nat_services" "nat" { - filter { - name = "nat_service_ids" - values = ["${outscale_nat_service.outscale_nat_service.id}"] - } - } -` From afedd92cc6a099e13c2be28c2a3ee5af3b9cc428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:49 +0000 Subject: [PATCH 26/82] Improve image_export_task datasource --- outscale/data_source_outscale_image_export_task.go | 14 ++++---------- .../data_source_outscale_image_export_tasks.go | 5 ----- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/outscale/data_source_outscale_image_export_task.go b/outscale/data_source_outscale_image_export_task.go index 717405b27..4fd496f05 100644 --- a/outscale/data_source_outscale_image_export_task.go +++ b/outscale/data_source_outscale_image_export_task.go @@ -28,11 +28,6 @@ func dataSourceOutscaleOAPIImageExportTask() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "dry_run": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, "osu_export": { Type: schema.TypeList, Computed: true, @@ -89,10 +84,8 @@ func dataSourceOutscaleOAPIImageExportTask() *schema.Resource { func dataSourceOAPISnapshotImageTaskRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - filtersReq := &oscgo.FiltersExportTask{} - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { filtersReq = buildOutscaleOSCAPIDataSourceImageExportTaskFilters(filters.(*schema.Set)) } @@ -114,9 +107,10 @@ func dataSourceOAPISnapshotImageTaskRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error reading task image %s", err) } - if len(resp.GetImageExportTasks()) == 0 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetImageExportTasks()), "Image Export Task"); err != nil { + return err } + v := resp.GetImageExportTasks()[0] if err = d.Set("progress", v.GetProgress()); err != nil { diff --git a/outscale/data_source_outscale_image_export_tasks.go b/outscale/data_source_outscale_image_export_tasks.go index 9f0ba2de2..cac9b9ad2 100644 --- a/outscale/data_source_outscale_image_export_tasks.go +++ b/outscale/data_source_outscale_image_export_tasks.go @@ -27,11 +27,6 @@ func dataSourceOutscaleOAPIImageExportTasks() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "dry_run": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, "image_export_tasks": { Type: schema.TypeList, Computed: true, From 9e4c69472192eba1d6d28e27da98ad9a63695d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:24:50 +0000 Subject: [PATCH 27/82] Merge image_export_task datasource testacc --- ..._source_outscale_image_export_task_test.go | 39 +++++------ ...source_outscale_image_export_tasks_test.go | 68 ------------------- 2 files changed, 17 insertions(+), 90 deletions(-) delete mode 100644 outscale/data_source_outscale_image_export_tasks_test.go diff --git a/outscale/data_source_outscale_image_export_task_test.go b/outscale/data_source_outscale_image_export_task_test.go index a5205286f..8b1c8f78c 100644 --- a/outscale/data_source_outscale_image_export_task_test.go +++ b/outscale/data_source_outscale_image_export_task_test.go @@ -6,16 +6,18 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPIImageExportTaskDataSource_basic(t *testing.T) { +func TestAcc_ImageExportTask_DataSource(t *testing.T) { omi := os.Getenv("OUTSCALE_IMAGEID") region := os.Getenv("OUTSCALE_REGION") imageName := acctest.RandomWithPrefix("test-image-name") + dataSourceName := "data.outscale_image_export_task.export_task" + dataSourcesName := "data.outscale_image_export_tasks.export_tasks" + if os.Getenv("TEST_QUOTA") == "true" { resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -24,9 +26,10 @@ func TestAccOutscaleOAPIImageExportTaskDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, "tinav4.c2r2p2", region, imageName), + Config: testAcc_ImageExportTask_DataSource_Config(omi, "tinav4.c2r2p2", region, imageName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleImageExportTaskDataSourceID("data.outscale_image_export_task.test"), + resource.TestCheckResourceAttrSet(dataSourceName, "task_id"), + resource.TestCheckResourceAttrSet(dataSourcesName, "image_export_tasks.#"), ), }, }, @@ -36,22 +39,7 @@ func TestAccOutscaleOAPIImageExportTaskDataSource_basic(t *testing.T) { } } -func testAccCheckOutscaleImageExportTaskDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("can't find Image Export Task data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("image Export Task data source ID not set") - } - return nil - } -} - -func testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, vmType, region, imageName string) string { +func testAcc_ImageExportTask_DataSource_Config(omi, vmType, region, imageName string) string { return fmt.Sprintf(` resource "outscale_vm" "basic" { image_id = "%s" @@ -66,6 +54,7 @@ func testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, vmType, region, ima no_reboot = "true" description = "terraform testing" } + resource "outscale_image_export_task" "outscale_image_export_task" { image_id = outscale_image.foo.id osu_export { @@ -74,12 +63,18 @@ func testAccOutscaleOAPIImageExportTaskDataSourceConfig(omi, vmType, region, ima } } - - data "outscale_image_export_task" "test" { + data "outscale_image_export_task" "export_task" { filter { name = "task_ids" values = [outscale_image_export_task.outscale_image_export_task.id] } } + + data "outscale_image_export_tasks" "export_tasks" { + filter { + name = "tags_ids" + values = [outscale_image_export_task.outscale_image_export_task.id] + } + } `, omi, vmType, region, imageName, imageName) } diff --git a/outscale/data_source_outscale_image_export_tasks_test.go b/outscale/data_source_outscale_image_export_tasks_test.go deleted file mode 100644 index 1e9bbd081..000000000 --- a/outscale/data_source_outscale_image_export_tasks_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPIImageExportTasksDataSource_basic(t *testing.T) { - omi := os.Getenv("OUTSCALE_IMAGEID") - region := os.Getenv("OUTSCALE_REGION") - imageName := acctest.RandomWithPrefix("test-image-name") - - if os.Getenv("TEST_QUOTA") == "true" { - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPIImageExportTasksDataSourceConfig(omi, "tinav4.c2r2p2", region, imageName), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleImageExportTaskDataSourceID("outscale_image_export_task.outscale_image_export_task"), - ), - }, - }, - }) - } else { - t.Skip("will be done soon") - } -} - -func testAccOutscaleOAPIImageExportTasksDataSourceConfig(omi, vmType, region, imageName string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - placement_subregion_name = "%sa" - } - - resource "outscale_image" "foo" { - image_name = "%s" - vm_id = outscale_vm.basic.id - no_reboot = "true" - description = "terraform testing" - } - resource "outscale_image_export_task" "outscale_image_export_task" { - image_id = outscale_image.foo.id - osu_export { - osu_bucket = "terraform-export-%s" - disk_image_format = "qcow2" - } - } - - data "outscale_image_export_tasks" "export_tasks" { - filter { - name = "tags_ids" - values = [outscale_image_export_task.outscale_image_export_task.id] - } - } - `, omi, vmType, region, imageName, imageName) -} From 61a830d6da06889237cdb99022309d6185ee51a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:03 +0000 Subject: [PATCH 28/82] Improve internet_service datasource --- .../data_source_outscale_internet_service.go | 28 ++--------- .../data_source_outscale_internet_services.go | 48 ++++--------------- 2 files changed, 12 insertions(+), 64 deletions(-) diff --git a/outscale/data_source_outscale_internet_service.go b/outscale/data_source_outscale_internet_service.go index 8c5f0e64a..9989e0ef8 100644 --- a/outscale/data_source_outscale_internet_service.go +++ b/outscale/data_source_outscale_internet_service.go @@ -41,25 +41,8 @@ func datasourceOutscaleOAPIInternetService() *schema.Resource { func datasourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - internetID, insternetIDOk := d.GetOk("internet_service_id") - - if !filtersOk && !insternetIDOk { - return fmt.Errorf("One of filters, or instance_id must be assigned") - } - - // Build up search parameters params := oscgo.ReadInternetServicesRequest{} - - if insternetIDOk { - params.Filters = &oscgo.FiltersInternetService{ - InternetServiceIds: &[]string{internetID.(string)}, - } - - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.Filters = buildOutscaleOSCAPIDataSourceInternetServiceFilters(filters.(*schema.Set)) } @@ -78,23 +61,18 @@ func datasourceOutscaleOAPIInternetServiceRead(d *schema.ResourceData, meta inte if err != nil { return fmt.Errorf("[DEBUG] Error reading Internet Service id (%s)", utils.GetErrorResponse(err)) } - - if !resp.HasInternetServices() || len(resp.GetInternetServices()) == 0 { - return fmt.Errorf("Error reading Internet Service: Internet Services is not found with the seatch criteria") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetInternetServices()), "Image Export Task"); err != nil { + return err } result := resp.GetInternetServices()[0] - log.Printf("[DEBUG] Setting OAPI Internet Service id (%s)", err) - if err := d.Set("internet_service_id", result.GetInternetServiceId()); err != nil { return err } - if err := d.Set("state", result.GetState()); err != nil { return err } - if err := d.Set("net_id", result.GetNetId()); err != nil { return err } diff --git a/outscale/data_source_outscale_internet_services.go b/outscale/data_source_outscale_internet_services.go index e5de60f6d..4be2325c8 100644 --- a/outscale/data_source_outscale_internet_services.go +++ b/outscale/data_source_outscale_internet_services.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -18,13 +17,6 @@ func datasourceOutscaleOAPIInternetServices() *schema.Resource { Read: datasourceOutscaleOAPIInternetServicesRead, Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "internet_service_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "internet_services": { Type: schema.TypeList, Computed: true, @@ -56,35 +48,15 @@ func datasourceOutscaleOAPIInternetServices() *schema.Resource { func datasourceOutscaleOAPIInternetServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - internetID, internetIDOk := d.GetOk("internet_service_ids") - - if !filtersOk && !internetIDOk { - return fmt.Errorf("One of filters, or instance_id must be assigned") - } - - // Build up search parameters - params := oscgo.ReadInternetServicesRequest{ - Filters: &oscgo.FiltersInternetService{}, - } - filter := oscgo.FiltersInternetService{} - if internetIDOk { - i := internetID.([]string) - in := make([]string, len(i)) - copy(in, i) - filter.SetInternetServiceIds(in) - params.SetFilters(filter) - } - - if filtersOk { - params.Filters = buildOutscaleOSCAPIDataSourceInternetServiceFilters(filters.(*schema.Set)) + req := oscgo.ReadInternetServicesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOSCAPIDataSourceInternetServiceFilters(filters.(*schema.Set)) } var resp oscgo.ReadInternetServicesResponse var err error err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.InternetServiceApi.ReadInternetServices(context.Background()).ReadInternetServicesRequest(params).Execute() + rp, httpResp, err := conn.InternetServiceApi.ReadInternetServices(context.Background()).ReadInternetServicesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -92,19 +64,17 @@ func datasourceOutscaleOAPIInternetServicesRead(d *schema.ResourceData, meta int return nil }) - var errString string - if err != nil { - errString = err.Error() - - return fmt.Errorf("[DEBUG] Error reading Internet Services (%s)", errString) + return fmt.Errorf("[DEBUG] Error reading Internet Services (%s)", err.Error()) } - log.Printf("[DEBUG] Setting OAPI LIN Internet Gateways id (%s)", err) + result := resp.GetInternetServices() + if len(result) == 0 { + return fmt.Errorf("your query returned no results, please change your search criteria and try again") + } d.SetId(resource.UniqueId()) - result := resp.GetInternetServices() return internetServicesOAPIDescriptionAttributes(d, result) } From e6e09cd377e709287758bef2fbabcef81562542e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:04 +0000 Subject: [PATCH 29/82] Merge internet_service datasource testacc --- ...a_source_outscale_internet_service_test.go | 24 +++++++++----- ..._source_outscale_internet_services_test.go | 31 ------------------- 2 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 outscale/data_source_outscale_internet_services_test.go diff --git a/outscale/data_source_outscale_internet_service_test.go b/outscale/data_source_outscale_internet_service_test.go index 08423cebc..ced1fc532 100644 --- a/outscale/data_source_outscale_internet_service_test.go +++ b/outscale/data_source_outscale_internet_service_test.go @@ -6,29 +6,39 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPIInternetServiceDatasource_basic(t *testing.T) { +func TestAcc_InternetService_Datasource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_internet_service.internet_service" + dataSourcesName := "data.outscale_internet_services.internet_services" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIInternetServiceDatasourceConfig, + Config: testAcc_InternetService_Datasource_Config, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.outscale_internet_service.outscale_internet_serviced", "internet_service_id"), + resource.TestCheckResourceAttrSet(dataSourcesName, "internet_services.#"), + resource.TestCheckResourceAttrSet(dataSourceName, "internet_service_id"), ), }, }, }) } -const testAccOutscaleOAPIInternetServiceDatasourceConfig = ` - resource "outscale_internet_service" "outscale_internet_service" {} +const testAcc_InternetService_Datasource_Config = ` + resource "outscale_internet_service" "gateway" {} - data "outscale_internet_service" "outscale_internet_serviced" { + data "outscale_internet_service" "internet_service" { filter { name = "internet_service_ids" - values = ["${outscale_internet_service.outscale_internet_service.internet_service_id}"] + values = [outscale_internet_service.gateway.internet_service_id] + } + } + + data "outscale_internet_services" "internet_services" { + filter { + name = "internet_service_id" + values = [outscale_internet_service.gateway.internet_service_id] } } ` diff --git a/outscale/data_source_outscale_internet_services_test.go b/outscale/data_source_outscale_internet_services_test.go deleted file mode 100644 index 37ca191dc..000000000 --- a/outscale/data_source_outscale_internet_services_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPIInternetServicesDatasource_basic(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPIInternetServicesDatasourceConfig, - }, - }, - }) -} - -const testAccOutscaleOAPIInternetServicesDatasourceConfig = ` - resource "outscale_internet_service" "gateway" {} - - data "outscale_internet_services" "outscale_internet_services" { - filter { - name = "internet_service_id" - values = ["${outscale_internet_service.gateway.id}"] - } - } -` From 5630c98482357fe0031defa5bb34e9c546d2d7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:23 +0000 Subject: [PATCH 30/82] Improve net_access_point datasource --- .../data_source_outscale_net_access_point.go | 18 ++++-------------- .../data_source_outscale_net_access_points.go | 10 +++------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/outscale/data_source_outscale_net_access_point.go b/outscale/data_source_outscale_net_access_point.go index fb5dd815f..d975cd99a 100644 --- a/outscale/data_source_outscale_net_access_point.go +++ b/outscale/data_source_outscale_net_access_point.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -54,18 +53,12 @@ func dataSourceOutscaleNetAccessPoint() *schema.Resource { func dataSourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("One of filters must be assigned") - } - var resp oscgo.ReadNetAccessPointsResponse - var err error req := oscgo.ReadNetAccessPointsRequest{} - - req.SetFilters(buildOutscaleDataSourcesNAPFilters(filters.(*schema.Set))) - err = resource.Retry(30*time.Second, func() *resource.RetryError { + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleDataSourcesNAPFilters(filters.(*schema.Set))) + } + err := resource.Retry(30*time.Second, func() *resource.RetryError { rp, httpResp, err := conn.NetAccessPointApi.ReadNetAccessPoints( context.Background()). ReadNetAccessPointsRequest(req).Execute() @@ -75,15 +68,12 @@ func dataSourceOutscaleNetAccessPointRead(d *schema.ResourceData, meta interface resp = rp return nil }) - if err != nil { return err } - if err := utils.IsResponseEmptyOrMutiple(len(resp.GetNetAccessPoints()), "NetAccessPoint"); err != nil { return err } - nap := resp.GetNetAccessPoints()[0] d.Set("net_access_point_id", nap.NetAccessPointId) diff --git a/outscale/data_source_outscale_net_access_points.go b/outscale/data_source_outscale_net_access_points.go index b8e7d466e..2986f5aa3 100644 --- a/outscale/data_source_outscale_net_access_points.go +++ b/outscale/data_source_outscale_net_access_points.go @@ -96,16 +96,12 @@ func buildOutscaleDataSourcesNAPFilters(set *schema.Set) oscgo.FiltersNetAccessP func dataSourceOutscaleNetAccessPointsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") req := oscgo.ReadNetAccessPointsRequest{} - var resp oscgo.ReadNetAccessPointsResponse - var err error - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleDataSourcesNAPFilters(filters.(*schema.Set))) } - err = resource.Retry(30*time.Second, func() *resource.RetryError { + var resp oscgo.ReadNetAccessPointsResponse + err := resource.Retry(30*time.Second, func() *resource.RetryError { rp, httpResp, err := conn.NetAccessPointApi.ReadNetAccessPoints( context.Background()). ReadNetAccessPointsRequest(req).Execute() From b6190eea1dabe0840ab39cc82770789a47d3e9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:23 +0000 Subject: [PATCH 31/82] Merge net_access_point datasource testacc --- ...a_source_outscale_net_access_point_test.go | 124 +++++++++++------- ..._source_outscale_net_access_points_test.go | 77 ----------- 2 files changed, 78 insertions(+), 123 deletions(-) delete mode 100644 outscale/data_source_outscale_net_access_points_test.go diff --git a/outscale/data_source_outscale_net_access_point_test.go b/outscale/data_source_outscale_net_access_point_test.go index c716cf3ef..870001bcb 100644 --- a/outscale/data_source_outscale_net_access_point_test.go +++ b/outscale/data_source_outscale_net_access_point_test.go @@ -8,10 +8,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPINetAccessPoint_basic(t *testing.T) { +func TestAcc_NetAccessPoint_DataSource(t *testing.T) { t.Parallel() serviceName := fmt.Sprintf("com.outscale.%s.api", os.Getenv("OUTSCALE_REGION")) - + dataSourceName := "data.outscale_net_access_point.data_net_access_point" + dataSourcesName := "data.outscale_net_access_points.data_net_access_points" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -19,59 +20,90 @@ func TestAccDataSourceOutscaleOAPINetAccessPoint_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPINetAccessPointConfig(serviceName, serviceName), + Config: testAcc_NetAccessPoint_DataSource_Config(serviceName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourcesName, "net_access_points.#", "1"), + resource.TestCheckResourceAttr(dataSourceName, "service_name", serviceName), + ), }, }, }) } -func testAccDataSourceOutscaleOAPINetAccessPointConfig(sName, sName2 string) string { +func testAcc_NetAccessPoint_DataSource_Config(sName string) string { return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - } + resource "outscale_net" "outscale_net" { + ip_range = "10.0.0.0/16" + } + + resource "outscale_route_table" "route_table-1" { + net_id = outscale_net.outscale_net.net_id + } - resource "outscale_route_table" "route_table-1" { - net_id = outscale_net.outscale_net.net_id - } + resource "outscale_net_access_point" "net_access_point_1" { + net_id = outscale_net.outscale_net.net_id + route_table_ids = [outscale_route_table.route_table-1.route_table_id] + service_name = "%[1]s" + tags { + key = "name" + value = "terraform-Net-Access-Point" + } - resource "outscale_net_access_point" "net_access_point_1" { - net_id = outscale_net.outscale_net.net_id - route_table_ids = [outscale_route_table.route_table-1.route_table_id] - service_name = "%s" - tags { - key = "name" - value = "terraform-Net-Access-Point" - } + } - } + data "outscale_net_access_point" "data_net_access_point" { + filter { + name = "net_access_point_ids" + values = [outscale_net_access_point.net_access_point_1.net_access_point_id] + } + filter { + name = "net_ids" + values = [outscale_net.outscale_net.net_id] + } + filter { + name = "service_names" + values = [ "%[1]s"] + } + filter { + name = "states" + values = ["available"] + } + filter { + name = "tag_keys" + values = ["name"] + } + filter { + name = "tag_values" + values = ["terraform-Net-Access-Point"] + } + } - data "outscale_net_access_point" "data_net_access_point" { - filter { - name = "net_access_point_ids" - values = [outscale_net_access_point.net_access_point_1.net_access_point_id] - } - filter { - name = "net_ids" - values = [outscale_net.outscale_net.net_id] - } - filter { - name = "service_names" - values = [ "%s"] - } - filter { - name = "states" - values = ["available"] - } - filter { - name = "tag_keys" - values = ["name"] - } - filter { - name = "tag_values" - values = ["terraform-Net-Access-Point"] - } - } - `, sName, sName2) + data "outscale_net_access_points" "data_net_access_points" { + filter { + name = "net_access_point_ids" + values = [outscale_net_access_point.net_access_point_1.net_access_point_id] + } + filter { + name = "net_ids" + values = [outscale_net.outscale_net.net_id] + } + filter { + name = "service_names" + values = [ "%[1]s"] + } + filter { + name = "states" + values = ["available"] + } + filter { + name = "tag_keys" + values = ["name"] + } + filter { + name = "tag_values" + values = ["terraform-Net-Access-Point"] + } + } + `, sName) } diff --git a/outscale/data_source_outscale_net_access_points_test.go b/outscale/data_source_outscale_net_access_points_test.go deleted file mode 100644 index e2e2bf5f8..000000000 --- a/outscale/data_source_outscale_net_access_points_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPINetAccessPoints_basic(t *testing.T) { - t.Parallel() - serviceName := fmt.Sprintf("com.outscale.%s.api", os.Getenv("OUTSCALE_REGION")) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPINetAccessPointsConfig(serviceName, serviceName), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPINetAccessPointsConfig(sName, sName2 string) string { - return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - } - - resource "outscale_route_table" "route_table-1" { - net_id = outscale_net.outscale_net.net_id - } - - resource "outscale_net_access_point" "net_access_point_1" { - net_id = outscale_net.outscale_net.net_id - route_table_ids = [outscale_route_table.route_table-1.route_table_id] - service_name = "%s" - tags { - key = "name" - value = "terraform-Net-Access-Point" - } - - } - - data "outscale_net_access_points" "data_net_access_points" { - filter { - name = "net_access_point_ids" - values = [outscale_net_access_point.net_access_point_1.net_access_point_id] - } - filter { - name = "net_ids" - values = [outscale_net.outscale_net.net_id] - } - filter { - name = "service_names" - values = [ "%s"] - } - filter { - name = "states" - values = ["available"] - } - filter { - name = "tag_keys" - values = ["name"] - } - filter { - name = "tag_values" - values = ["terraform-Net-Access-Point"] - } - } - - `, sName, sName2) -} From e9f0544e79ea67f2ee7a9df0274cf782dab75b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:31 +0000 Subject: [PATCH 32/82] Improve net_peering datasource --- outscale/data_source_outscale_net_peering.go | 14 ++++---------- outscale/data_source_outscale_net_peerings.go | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/outscale/data_source_outscale_net_peering.go b/outscale/data_source_outscale_net_peering.go index 1ffcb21e9..31c6e3a32 100644 --- a/outscale/data_source_outscale_net_peering.go +++ b/outscale/data_source_outscale_net_peering.go @@ -54,16 +54,10 @@ func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - log.Printf("[DEBUG] Reading Net Peering Connections.") - req := oscgo.ReadNetPeeringsRequest{} - - filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("filters must be assigned") + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set))) } - req.SetFilters(buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set))) var resp oscgo.ReadNetPeeringsResponse var err error @@ -86,8 +80,8 @@ func dataSourceOutscaleOAPILinPeeringConnectionRead(d *schema.ResourceData, meta return fmt.Errorf("Error reading Net Peering Connection details: %s", err) } - if len(resp.GetNetPeerings()) > 1 { - return fmt.Errorf("multiple Net Peering connections matched; use additional constraints to reduce matches to a single Net Peering Connection") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetNetPeerings()), "Net Peering"); err != nil { + return err } netPeering := resp.GetNetPeerings()[0] diff --git a/outscale/data_source_outscale_net_peerings.go b/outscale/data_source_outscale_net_peerings.go index 8da1774b1..529a27158 100644 --- a/outscale/data_source_outscale_net_peerings.go +++ b/outscale/data_source_outscale_net_peerings.go @@ -61,21 +61,15 @@ func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { func dataSourceOutscaleOAPILinPeeringsConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - log.Printf("[DEBUG] Reading VPC Peering Connections.") - - filters, filtersOk := d.GetOk("filter") - if !filtersOk { - return fmt.Errorf("One of filters must be assigned") + req := oscgo.ReadNetPeeringsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set))) } - params := oscgo.ReadNetPeeringsRequest{} - params.SetFilters(buildOutscaleOAPILinPeeringConnectionFilters(filters.(*schema.Set))) - var resp oscgo.ReadNetPeeringsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NetPeeringApi.ReadNetPeerings(context.Background()).ReadNetPeeringsRequest(params).Execute() + rp, httpResp, err := conn.NetPeeringApi.ReadNetPeerings(context.Background()).ReadNetPeeringsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 1b700e24cd11c909202b7e97f5314c6a4f8293e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:32 +0000 Subject: [PATCH 33/82] Merge net_peering datasource testacc --- .../data_source_outscale_net_peering_test.go | 45 +++++-------- outscale/data_source_outscale_net_peerings.go | 1 - .../data_source_outscale_net_peerings_test.go | 63 ------------------- 3 files changed, 14 insertions(+), 95 deletions(-) delete mode 100644 outscale/data_source_outscale_net_peerings_test.go diff --git a/outscale/data_source_outscale_net_peering_test.go b/outscale/data_source_outscale_net_peering_test.go index 2ccdfd23a..ba45bc2c2 100644 --- a/outscale/data_source_outscale_net_peering_test.go +++ b/outscale/data_source_outscale_net_peering_test.go @@ -1,15 +1,15 @@ package outscale import ( - "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccDataSourceOutscaleOAPILinPeeringConnection_basic(t *testing.T) { +func TestAcc_NetPeering_DataSource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_net_peering.net_peering" + dataSourcesName := "data.outscale_net_peerings.net_peerings" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -17,39 +17,15 @@ func TestAccDataSourceOutscaleOAPILinPeeringConnection_basic(t *testing.T) { { Config: testAccDataSourceOutscaleOAPILinPeeringConnectionConfig, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPILinPeeringConnectionCheck("outscale_net_peering.net_peering"), + resource.TestCheckResourceAttrSet(dataSourceName, "net_peering_id"), + + resource.TestCheckResourceAttr(dataSourcesName, "net_peerings.#", "1"), ), }, }, }) } -func testAccDataSourceOutscaleOAPILinPeeringConnectionCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - pcxRs, ok := s.RootModule().Resources["outscale_net_peering.net_peering"] - if !ok { - return fmt.Errorf("can't find outscale_net_peering.net_peering in state") - } - - attr := rs.Primary.Attributes - - if attr["id"] != pcxRs.Primary.Attributes["id"] { - return fmt.Errorf( - "id is %s; want %s", - attr["id"], - pcxRs.Primary.Attributes["id"], - ) - } - - return nil - } -} - const testAccDataSourceOutscaleOAPILinPeeringConnectionConfig = ` resource "outscale_net" "net" { ip_range = "10.10.0.0/24" @@ -72,7 +48,14 @@ const testAccDataSourceOutscaleOAPILinPeeringConnectionConfig = ` source_net_id = outscale_net.net2.net_id } - data "outscale_net_peering" "net_peering_data" { + data "outscale_net_peering" "net_peering" { + filter { + name = "net_peering_ids" + values = [outscale_net_peering.net_peering.net_peering_id] + } + } + + data "outscale_net_peerings" "net_peerings" { filter { name = "net_peering_ids" values = [outscale_net_peering.net_peering.net_peering_id] diff --git a/outscale/data_source_outscale_net_peerings.go b/outscale/data_source_outscale_net_peerings.go index 529a27158..4f137219f 100644 --- a/outscale/data_source_outscale_net_peerings.go +++ b/outscale/data_source_outscale_net_peerings.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "reflect" "time" diff --git a/outscale/data_source_outscale_net_peerings_test.go b/outscale/data_source_outscale_net_peerings_test.go deleted file mode 100644 index 3dd12410d..000000000 --- a/outscale/data_source_outscale_net_peerings_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPILinPeeringsConnection_basic(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPILinPeeringsConnectionConfig, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_net_peerings.outscale_net_peerings", "net_peerings.#", "1"), - ), - }, - }, - }) -} - -const testAccDataSourceOutscaleOAPILinPeeringsConnectionConfig = ` - resource "outscale_net" "outscale_net" { - ip_range = "10.10.0.0/24" - tags { - key = "Name" - value = "testacc-net-peerings-ds-net" - } - } - - resource "outscale_net" "outscale_net2" { - ip_range = "10.31.0.0/16" - tags { - key = "Name" - value = "testacc-net-peerings-ds-net2" - } - } - - resource "outscale_net_peering" "outscale_net_peering" { - accepter_net_id = "${outscale_net.outscale_net.net_id}" - source_net_id = "${outscale_net.outscale_net2.net_id}" - tags { - key = "okht" - value = "testacc-peerings-ds" - } - - } - - resource "outscale_net_peering" "outscale_net_peering2" { - accepter_net_id = "${outscale_net.outscale_net.net_id}" - source_net_id = "${outscale_net.outscale_net2.net_id}" - } - - data "outscale_net_peerings" "outscale_net_peerings" { - filter { - name = "net_peering_ids" - values = ["${outscale_net_peering.outscale_net_peering.net_peering_id}"] - } - } -` From ae614146aec036e1af2c48e682f5c9b901cfee8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:37 +0000 Subject: [PATCH 34/82] Improve net datasource --- outscale/data_source_outscale_net.go | 19 ++++--------------- outscale/data_source_outscale_nets.go | 27 +-------------------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/outscale/data_source_outscale_net.go b/outscale/data_source_outscale_net.go index b00d486e5..7ff3df7c3 100644 --- a/outscale/data_source_outscale_net.go +++ b/outscale/data_source_outscale_net.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -31,7 +30,6 @@ func dataSourceOutscaleOAPIVpc() *schema.Resource { "net_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, @@ -56,15 +54,9 @@ func dataSourceOutscaleOAPIVpc() *schema.Resource { func dataSourceOutscaleOAPIVpcRead(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))) - } - - if id := d.Get("net_id"); id != "" { - req.Filters.SetNetIds([]string{id.(string)}) + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceNetFilters(filters.(*schema.Set))) } var err error @@ -81,11 +73,8 @@ func dataSourceOutscaleOAPIVpcRead(d *schema.ResourceData, meta interface{}) err if err != nil { return err } - if len(resp.GetNets()) == 0 { - return fmt.Errorf("No matching Net found") - } - if len(resp.GetNets()) > 1 { - return fmt.Errorf("Multiple Nets matched; use additional constraints to reduce matches to a single Net") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetNets()), "Net"); err != nil { + return err } net := resp.GetNets()[0] diff --git a/outscale/data_source_outscale_nets.go b/outscale/data_source_outscale_nets.go index eb83186d7..7a472f2bb 100644 --- a/outscale/data_source_outscale_nets.go +++ b/outscale/data_source_outscale_nets.go @@ -18,11 +18,6 @@ func dataSourceOutscaleOAPIVpcs() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "net_id": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "nets": { Type: schema.TypeList, Computed: true, @@ -66,32 +61,12 @@ func dataSourceOutscaleOAPIVpcs() *schema.Resource { func dataSourceOutscaleOAPIVpcsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadNetsRequest{} - filters, filtersOk := d.GetOk("filter") - netIds, netIdsOk := d.GetOk("net_id") - - if !filtersOk && !netIdsOk { - return fmt.Errorf("filters or net_id(s) must be provided") - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleOAPIDataSourceNetFilters(filters.(*schema.Set))) } - if netIdsOk { - ids := make([]string, len(netIds.([]interface{}))) - - for k, v := range netIds.([]interface{}) { - ids[k] = v.(string) - } - var filters oscgo.FiltersNet - filters.SetNetIds(ids) - req.SetFilters(filters) - - } - var err error var resp oscgo.ReadNetsResponse err = resource.Retry(5*time.Minute, func() *resource.RetryError { From 81acc81c372dae9915300ab189916962d2308fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:37 +0000 Subject: [PATCH 35/82] Merge net datasource testacc --- outscale/data_source_outscale_net_test.go | 58 ++++++++-------------- outscale/data_source_outscale_nets_test.go | 51 ------------------- 2 files changed, 20 insertions(+), 89 deletions(-) delete mode 100644 outscale/data_source_outscale_nets_test.go diff --git a/outscale/data_source_outscale_net_test.go b/outscale/data_source_outscale_net_test.go index 187a74398..35e40e645 100644 --- a/outscale/data_source_outscale_net_test.go +++ b/outscale/data_source_outscale_net_test.go @@ -7,62 +7,37 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccDataSourceOutscaleOAPIVpc_basic(t *testing.T) { +func TestAcc_Net_DataSource(t *testing.T) { t.Parallel() rand.Seed(time.Now().UTC().UnixNano()) ipRange := utils.RandVpcCidr() tag := fmt.Sprintf("terraform-testacc-vpc-data-source-%s", ipRange) + + dataSourceName := "data.outscale_net.net" + dataSourcesName := "data.outscale_nets.nets" + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag), + Config: testAcc_Net_DataSource_Config(ipRange, tag), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIVpcCheck("data.outscale_net.by_id", ipRange, tag), + resource.TestCheckResourceAttr(dataSourceName, "ip_range", ipRange), + + resource.TestCheckResourceAttr(dataSourcesName, "nets.#", "1"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIVpcCheck(name, ipRange, tag string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - netRs, ok := s.RootModule().Resources["outscale_net.test"] - if !ok { - return fmt.Errorf("can't find outscale_net.test in state") - } - - attr := rs.Primary.Attributes - - if attr["id"] != netRs.Primary.Attributes["id"] { - return fmt.Errorf( - "id is %s; want %s", - attr["id"], - netRs.Primary.Attributes["id"], - ) - } - - if attr["ip_range"] != ipRange { - return fmt.Errorf("bad cidr_block %s, expected: %s", attr["ip_range"], ipRange) - } - - return nil - } -} - -func testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag string) string { +func testAcc_Net_DataSource_Config(ipRange, tag string) string { return fmt.Sprintf(` - resource "outscale_net" "test" { + resource "outscale_net" "net" { ip_range = "%s" tags { @@ -71,11 +46,18 @@ func testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag string) string { } } - data "outscale_net" "by_id" { + data "outscale_net" "net" { filter { name = "net_ids" - values = ["${outscale_net.test.id}"] + values = [outscale_net.net.id] } } + + data "outscale_nets" "nets" { + filter { + name = "net_ids" + values = [outscale_net.net.id] + } + } `, ipRange, tag) } diff --git a/outscale/data_source_outscale_nets_test.go b/outscale/data_source_outscale_nets_test.go deleted file mode 100644 index 3dce335d9..000000000 --- a/outscale/data_source_outscale_nets_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package outscale - -import ( - "fmt" - "math/rand" - "testing" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccDataSourceOutscaleOAPIVpcs_basic(t *testing.T) { - - rand.Seed(time.Now().UTC().UnixNano()) - ipRange := utils.RandVpcCidr() - tag := fmt.Sprintf("terraform-testacc-vpc-data-source-%s", ipRange) - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIVpcsConfig(ipRange, tag), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_nets.by_id", "nets.#", "1"), - ), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIVpcsConfig(ipRange, tag string) string { - return fmt.Sprintf(` - resource "outscale_net" "test" { - ip_range = "%s" - - tags { - key = "Name" - value = "%s" - } - } - - data "outscale_nets" "by_id" { - filter { - name = "net_ids" - values = [outscale_net.test.id] - } - } - `, ipRange, tag) - -} From 0d083e7b121a9012b7e078a68ebc6f7c4373dc7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:41 +0000 Subject: [PATCH 36/82] Improve nic datasource --- outscale/data_source_outscale_nic.go | 33 ++++----------------------- outscale/data_source_outscale_nics.go | 31 +++++-------------------- 2 files changed, 10 insertions(+), 54 deletions(-) diff --git a/outscale/data_source_outscale_nic.go b/outscale/data_source_outscale_nic.go index 7f38280e1..adb935263 100644 --- a/outscale/data_source_outscale_nic.go +++ b/outscale/data_source_outscale_nic.go @@ -2,10 +2,8 @@ package outscale import ( "context" - "errors" "fmt" "log" - "net/http" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -23,14 +21,10 @@ func dataSourceOutscaleOAPINic() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - // This is attribute part for schema Nic - // Argument "nic_id": { Type: schema.TypeString, Computed: true, }, - - // Attributes "description": { Type: schema.TypeString, Computed: true, @@ -212,46 +206,27 @@ func dataSourceOutscaleOAPINic() *schema.Resource { } } -// Read Nic func dataSourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, okFilters := d.GetOk("filter") - - if !okFilters { - return errors.New("filters must be assigned") - } - - dnri := oscgo.ReadNicsRequest{} - if okFilters { - dnri.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) + req := oscgo.ReadNicsRequest{} + if filters, okFilters := d.GetOk("filter"); okFilters { + req.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) } var resp oscgo.ReadNicsResponse var err error - var statusCode int err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(dnri).Execute() + rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } resp = rp - statusCode = httpResp.StatusCode return nil }) if err != nil { return fmt.Errorf("Error describing Network Interfaces : %s", err) } - - if err != nil { - if statusCode == http.StatusNotFound { - // The ENI is gone now, so just remove it from the state - d.SetId("") - return nil - } - return fmt.Errorf("Error retrieving ENI: %s", err) - } if err := utils.IsResponseEmptyOrMutiple(len(resp.GetNics()), "Nic"); err != nil { return err } diff --git a/outscale/data_source_outscale_nics.go b/outscale/data_source_outscale_nics.go index 36fcef8d7..1244f8418 100644 --- a/outscale/data_source_outscale_nics.go +++ b/outscale/data_source_outscale_nics.go @@ -193,22 +193,8 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - "tags": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "key": { - Type: schema.TypeString, - Computed: true, - }, - "value": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }}, + "tags": dataSourceTagsSchema(), + }, }, }, "request_id": { @@ -221,19 +207,16 @@ func getDSOAPINicsSchema() map[string]*schema.Schema { // Read Nic func dataSourceOutscaleOAPINicsRead(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))) + req := oscgo.ReadNicsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceNicFilters(filters.(*schema.Set))) } var resp oscgo.ReadNicsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(params).Execute() + rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -244,11 +227,9 @@ func dataSourceOutscaleOAPINicsRead(d *schema.ResourceData, meta interface{}) er if err != nil { return fmt.Errorf("Error reading Network Interface Cards : %s", err) } - if resp.GetNics() == nil { return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") } - if len(resp.GetNics()) == 0 { return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") } From 3ad8cc6c21e4a35de41a22ae2eda4209428621de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:42 +0000 Subject: [PATCH 37/82] Merge nic datasource testacc --- outscale/data_source_outscale_nic_test.go | 167 +++------------------ outscale/data_source_outscale_nics_test.go | 58 ------- 2 files changed, 19 insertions(+), 206 deletions(-) delete mode 100644 outscale/data_source_outscale_nics_test.go diff --git a/outscale/data_source_outscale_nic_test.go b/outscale/data_source_outscale_nic_test.go index 570abaa1a..fe7e8dfc6 100644 --- a/outscale/data_source_outscale_nic_test.go +++ b/outscale/data_source_outscale_nic_test.go @@ -1,142 +1,38 @@ package outscale import ( - "context" "fmt" "os" - "strings" - - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/terraform-providers/terraform-provider-outscale/utils" "testing" - "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPIENIDataSource_basic(t *testing.T) { +func TestAcc_Nic_DataSource(t *testing.T) { t.Parallel() - var conf oscgo.Nic subregion := os.Getenv("OUTSCALE_REGION") + dataSourceName := "data.outscale_nic.nic" + dataSourcesName := "data.outscale_nics.nics" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "outscale_nic.outscale_nic", Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIENIDataSourceConfig(subregion), + Config: testAcc_Nic_DataSource_Config(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), - ), - }, - }, - }) -} + resource.TestCheckResourceAttr(dataSourcesName, "nics.#", "1"), -func TestAccOutscaleOAPIENIDataSource_basicFilter(t *testing.T) { - t.Parallel() - var conf oscgo.Nic - - subregion := os.Getenv("OUTSCALE_REGION") - if subregion == "" { - subregion = "in-west-2" - } - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "outscale_nic.outscale_nic", - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleOAPIENIDestroy, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPIENIDataSourceConfigFilter, - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), + resource.TestCheckResourceAttrSet(dataSourceName, "nic_id"), ), }, }, }) } -func testAccCheckOutscaleOAPIENIDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_nic" { - continue - } - - var resp oscgo.ReadNicsResponse - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - req := oscgo.ReadNicsRequest{ - Filters: &oscgo.FiltersNic{NicIds: &[]string{rs.Primary.ID}}, - } - - var err error - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(req).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - - if err != nil { - return err - } - - if len(resp.GetNics()) != 0 { - return fmt.Errorf("Nic is not destroyed yet") - } - } - return nil -} - -func testAccCheckOutscaleOAPINICDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "outscale_nic" { - continue - } - - conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI - dnir := oscgo.ReadNicsRequest{ - Filters: &oscgo.FiltersNic{NicIds: &[]string{rs.Primary.ID}}, - } - - var resp oscgo.ReadNicsResponse - var err error - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(dnir).Execute() - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - - if err != nil { - if strings.Contains(fmt.Sprint(err), "InvalidNetworkInterfaceID.NotFound") { - return nil - } - errString := err.Error() - return fmt.Errorf("Could not find network interface: %s", errString) - - } - - if len(resp.GetNics()) > 0 { - return fmt.Errorf("Nic with id %s is not destroyed yet", rs.Primary.ID) - } - } - - return nil -} - -func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { +func testAcc_Nic_DataSource_Config(subregion string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -161,43 +57,18 @@ func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { } } - data "outscale_nic" "outscale_nic" { - filter { - name = "nic_ids" - values = [outscale_nic.outscale_nic.nic_id] - } + data "outscale_nic" "nic" { + filter { + name = "nic_ids" + values = [outscale_nic.outscale_nic.nic_id] + } } + + data "outscale_nics" "nics" { + filter { + name = "nic_ids" + values = [outscale_nic.outscale_nic.nic_id] + } + } `, subregion) } - -const testAccOutscaleOAPIENIDataSourceConfigFilter = ` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-nic-ds-filter" - } - } - - resource "outscale_subnet" "outscale_subnet" { - subregion_name = "eu-west-2a" - ip_range = "10.0.0.0/16" - net_id = outscale_net.outscale_net.id - } - - resource "outscale_nic" "outscale_nic" { - subnet_id = outscale_subnet.outscale_subnet.id - tags { - value = "tf-value" - key = "tf-key" - } - } - - data "outscale_nic" "outscale_nic" { - filter { - name = "nic_ids" - values = [outscale_nic.outscale_nic.nic_id] - } - } -` diff --git a/outscale/data_source_outscale_nics_test.go b/outscale/data_source_outscale_nics_test.go deleted file mode 100644 index f95286bae..000000000 --- a/outscale/data_source_outscale_nics_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPINicsDataSource(t *testing.T) { - subregion := os.Getenv("OUTSCALE_REGION") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPINicsDataSourceConfig(subregion), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_nics.outscale_nics", "nics.#", "1"), - ), - }, - }, - }) -} - -func testAccCheckOutscaleOAPINicsDataSourceConfig(subregion string) string { - return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-nics-ds" - } - } - - resource "outscale_subnet" "outscale_subnet" { - subregion_name = "%sa" - ip_range = "10.0.0.0/16" - net_id = outscale_net.outscale_net.net_id - } - - resource "outscale_nic" "outscale_nic" { - subnet_id = outscale_subnet.outscale_subnet.subnet_id - depends_on = [outscale_subnet.outscale_subnet] - } - - data "outscale_nics" "outscale_nics" { - filter { - name = "nic_ids" - values = [outscale_nic.outscale_nic.id] - } - depends_on = [outscale_nic.outscale_nic] - } - `, subregion) -} From 2408588b53943c67d9afe0ceb09fcc69444522e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:52 +0000 Subject: [PATCH 38/82] Improve product_type datasource --- outscale/data_source_outscale_product_type.go | 15 +++------------ outscale/data_source_outscale_product_types.go | 6 +----- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/outscale/data_source_outscale_product_type.go b/outscale/data_source_outscale_product_type.go index b759f0fd5..9ff1a2c52 100644 --- a/outscale/data_source_outscale_product_type.go +++ b/outscale/data_source_outscale_product_type.go @@ -41,12 +41,8 @@ func dataSourceOutscaleOAPIProductType() *schema.Resource { func dataSourceOutscaleOAPIProductTypeRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadProductTypesRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIProductTypeDataSourceFilters(filters.(*schema.Set)) } @@ -65,13 +61,8 @@ func dataSourceOutscaleOAPIProductTypeRead(d *schema.ResourceData, meta interfac errString := err.Error() return fmt.Errorf("[DEBUG] Error reading ProductType (%s)", errString) } - - if len(resp.GetProductTypes()) == 0 { - return fmt.Errorf("no matching product type found") - } - - if len(resp.GetProductTypes()) > 1 { - return fmt.Errorf("multiple product type matched; use additional constraints to reduce matches to a single product type") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetProductTypes()), "Product Type"); err != nil { + return err } productType := resp.GetProductTypes()[0] diff --git a/outscale/data_source_outscale_product_types.go b/outscale/data_source_outscale_product_types.go index 2d0184a54..c25e997ee 100644 --- a/outscale/data_source_outscale_product_types.go +++ b/outscale/data_source_outscale_product_types.go @@ -48,12 +48,8 @@ func dataSourceOutscaleOAPIProductTypes() *schema.Resource { func dataSourceOutscaleOAPIProductTypesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadProductTypesRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIProductTypeDataSourceFilters(filters.(*schema.Set)) } From 2fc13a961d6a5c8538d242f7a7e498755523cb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:25:52 +0000 Subject: [PATCH 39/82] Merge product_type datasource testacc --- .../data_source_outscale_product_type_test.go | 28 ++++++++++++------- ...data_source_outscale_product_types_test.go | 24 ---------------- 2 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 outscale/data_source_outscale_product_types_test.go diff --git a/outscale/data_source_outscale_product_type_test.go b/outscale/data_source_outscale_product_type_test.go index c1d508e76..13901d6da 100644 --- a/outscale/data_source_outscale_product_type_test.go +++ b/outscale/data_source_outscale_product_type_test.go @@ -6,24 +6,32 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIProductType(t *testing.T) { +func TestAcc_ProductType_DataSource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_product_type.test" + dataSourcesName := "data.outscale_product_types.all" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIProductTypeConfig, - Check: resource.ComposeTestCheckFunc(), + Config: testAcc_ProductType_DataSource_Config, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourceName, "product_type_id", "0001"), + resource.TestCheckResourceAttrSet(dataSourcesName, "product_types.#"), + ), }, }, }) } -const testAccDataSourceOutscaleOAPIProductTypeConfig = ` - data "outscale_product_type" "test" { - filter { - name = "product_type_ids" - values = ["0001"] - } -}` +const testAcc_ProductType_DataSource_Config = ` + data "outscale_product_type" "test" { + filter { + name = "product_type_ids" + values = ["0001"] + } + } + + data "outscale_product_types" "all" {} +` diff --git a/outscale/data_source_outscale_product_types_test.go b/outscale/data_source_outscale_product_types_test.go deleted file mode 100644 index 2572e876e..000000000 --- a/outscale/data_source_outscale_product_types_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIProductTypes(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIProductTypesConfig, - Check: resource.ComposeTestCheckFunc(), - }, - }, - }) -} - -const testAccDataSourceOutscaleOAPIProductTypesConfig = ` - data "outscale_product_types" "all" {}` From bf02ce1ad1c3cc8aeab73444700f642574817ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:06 +0000 Subject: [PATCH 40/82] Improve public_ip datasource --- outscale/data_source_outscale_public_ip.go | 37 ++++----------------- outscale/data_source_outscale_public_ips.go | 8 +---- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/outscale/data_source_outscale_public_ip.go b/outscale/data_source_outscale_public_ip.go index d3ab81989..387384605 100644 --- a/outscale/data_source_outscale_public_ip.go +++ b/outscale/data_source_outscale_public_ip.go @@ -27,12 +27,10 @@ func getOAPIPublicIPDataSourceSchema() map[string]*schema.Schema { "filter": dataSourceFiltersSchema(), "public_ip_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "public_ip": { Type: schema.TypeString, - Optional: true, Computed: true, }, "link_public_ip_id": { @@ -65,21 +63,8 @@ func getOAPIPublicIPDataSourceSchema() map[string]*schema.Schema { func dataSourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - req := oscgo.ReadPublicIpsRequest{ - Filters: &oscgo.FiltersPublicIp{}, - } - - if p, ok := d.GetOk("public_ip_id"); ok { - req.Filters.SetPublicIpIds([]string{p.(string)}) - } - - if id, ok := d.GetOk("public_ip"); ok { - req.Filters.SetPublicIps([]string{id.(string)}) - } - - filters, filtersOk := d.GetOk("filter") - if filtersOk { + req := oscgo.ReadPublicIpsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIDataSourcePublicIpsFilters(filters.(*schema.Set)) } @@ -104,46 +89,36 @@ func dataSourceOutscaleOAPIPublicIPRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error retrieving EIP: %s", err) } - // Verify Outscale returned our EIP - if err := utils.IsResponseEmptyOrMutiple(len(response.GetPublicIps()), "PublicIp"); err != nil { + if err := utils.IsResponseEmptyOrMutiple(len(response.GetPublicIps()), "Public Ip"); err != nil { return err } address := response.GetPublicIps()[0] - - log.Printf("[DEBUG] EIP read configuration: %+v", address) - if err := d.Set("link_public_ip_id", address.GetLinkPublicIpId()); err != nil { return err } if err := d.Set("vm_id", address.GetVmId()); err != nil { return err } - if err := d.Set("nic_id", address.GetNicId()); err != nil { return err } - if err := d.Set("nic_account_id", address.GetNicAccountId()); err != nil { return err } - if err := d.Set("private_ip", address.GetPrivateIp()); err != nil { return err } - + if err := d.Set("public_ip", address.GetPublicIp()); err != nil { + return err + } if err := d.Set("public_ip_id", address.GetPublicIpId()); err != nil { return err } - if err := d.Set("tags", tagsOSCAPIToMap(address.GetTags())); err != nil { return fmt.Errorf("Error setting PublicIp tags: %s", err) } - - d.Set("public_ip", address.PublicIp) - d.SetId(address.GetPublicIp()) - return nil } diff --git a/outscale/data_source_outscale_public_ips.go b/outscale/data_source_outscale_public_ips.go index dfe52c969..43155ebf5 100644 --- a/outscale/data_source_outscale_public_ips.go +++ b/outscale/data_source_outscale_public_ips.go @@ -22,7 +22,6 @@ func dataSourceOutscaleOAPIPublicIPS() *schema.Resource { func oapiGetPublicIPSDataSourceSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - // Attributes "filter": dataSourceFiltersSchema(), "public_ips": { Type: schema.TypeList, @@ -70,12 +69,8 @@ func oapiGetPublicIPSDataSourceSchema() map[string]*schema.Schema { func dataSourceOutscalePublicIPSRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadPublicIpsRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIDataSourcePublicIpsFilters(filters.(*schema.Set)) } @@ -101,7 +96,6 @@ func dataSourceOutscalePublicIPSRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error retrieving EIP: %s", err) } - // Verify Outscale returned our EIP if len(resp.GetPublicIps()) == 0 { return fmt.Errorf("Unable to find EIP: %#v", resp.GetPublicIps()) } From 614cae3ed7ff393a2590d5589cc155119468b9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:06 +0000 Subject: [PATCH 41/82] Merge public_ip datasource testacc --- .../data_source_outscale_public_ip_test.go | 146 ++---------------- .../data_source_outscale_public_ips_test.go | 83 ---------- 2 files changed, 15 insertions(+), 214 deletions(-) delete mode 100644 outscale/data_source_outscale_public_ips_test.go diff --git a/outscale/data_source_outscale_public_ip_test.go b/outscale/data_source_outscale_public_ip_test.go index bcf4c8d0e..05cb8f8ff 100644 --- a/outscale/data_source_outscale_public_ip_test.go +++ b/outscale/data_source_outscale_public_ip_test.go @@ -1,163 +1,47 @@ package outscale import ( - "fmt" - "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccDataSourceOutscaleOAPIPublicIP(t *testing.T) { +func TestAcc_PublicIP_DataSource(t *testing.T) { t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIPublicIPConfig, - Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIPublicIPCheck("data.outscale_public_ip.by_public_ip_id"), - testAccDataSourceOutscaleOAPIPublicIPCheck("data.outscale_public_ip.by_public_ip"), - ), - }, - }, - }) -} - -func TestAccDataSourceOutscaleOAPIPublicIPWithVM(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") + dataSourceName := "data.outscale_public_ip.by_public_ip" + dataSourcesName := "data.outscale_public_ips.by_public_ips" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicIPConfigwithVM(omi), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIPublicIPCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - eipRs, ok := s.RootModule().Resources["outscale_public_ip.test"] - if !ok { - return fmt.Errorf("can't find outscale_public_ip.test in state") - } - - attr := rs.Primary.Attributes - - if attr["public_ip_id"] != eipRs.Primary.Attributes["public_ip_id"] { - return fmt.Errorf( - "public_ip_id is %s; want %s", - attr["public_ip_id"], - eipRs.Primary.Attributes["public_ip_id"], - ) - } - - if attr["public_ip"] != eipRs.Primary.Attributes["public_ip"] { - return fmt.Errorf( - "public_ip is %s; want %s", - attr["public_ip"], - eipRs.Primary.Attributes["public_ip"], - ) - } - - return nil - } -} - -func TestAccDataSourceOutscaleOAPIPublicIP_withTags(t *testing.T) { + Config: testAcc_PublicIP_DataSource_Config, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourcesName, "public_ips.#", "2"), - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIPublicIPConfigWithTags, + resource.TestCheckResourceAttrSet(dataSourceName, "public_ip"), + ), }, }, }) } -const testAccDataSourceOutscaleOAPIPublicIPConfig = ` - resource "outscale_public_ip" "test" {} - - data "outscale_public_ip" "by_public_ip_id" { - public_ip_id = "${outscale_public_ip.test.public_ip_id}" - } +const testAcc_PublicIP_DataSource_Config = ` + resource "outscale_public_ip" "test1" {} + resource "outscale_public_ip" "test2" {} data "outscale_public_ip" "by_public_ip" { filter { name = "public_ips" - values = ["${outscale_public_ip.test.public_ip}"] - } - } -` - -const testAccDataSourceOutscaleOAPIPublicIPConfigWithTags = ` - resource "outscale_public_ip" "outscale_public_ip" { - tags { - key = "name" - value = "public_ip-data" + values = [outscale_public_ip.test1.public_ip] } } - data "outscale_public_ip" "outscale_public_ip" { + data "outscale_public_ips" "by_public_ips" { filter { - name = "tags" - values = ["name=public_ip-data"] - } - - filter { - name = "public_ip_ids" - values = [outscale_public_ip.outscale_public_ip.public_ip_id] + name = "public_ips" + values = [outscale_public_ip.test1.public_ip, outscale_public_ip.test2.public_ip] } } ` - -func testAccDataSourceOutscaleOAPIPublicIPConfigwithVM(omi string) string { - return fmt.Sprintf(` - resource "outscale_vm" "outscale_vm" { - image_id = "%s" - vm_type = "tinav4.c2r2p2" - keypair_name = "terraform-basic" - } - - resource "outscale_public_ip" "outscale_public_ip" { - tags { - key = "name" - value = "Terraform_EIP" - } - tags { - key = "platform" - value = "eu-west-2" - } - tags { - key = "project" - value = "terraform" - } - } - - resource "outscale_public_ip_link" "outscale_public_ip_link" { - vm_id = outscale_vm.outscale_vm.vm_id - public_ip = outscale_public_ip.outscale_public_ip.public_ip - } - - data "outscale_public_ip" "outscale_public_ip-5" { - filter { - name = "link_public_ip_ids" - values = [outscale_public_ip_link.outscale_public_ip_link.link_public_ip_id] - } - } - `, omi) -} diff --git a/outscale/data_source_outscale_public_ips_test.go b/outscale/data_source_outscale_public_ips_test.go deleted file mode 100644 index 438057354..000000000 --- a/outscale/data_source_outscale_public_ips_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package outscale - -import ( - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIPublicIPS(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIPublicIPSConfig, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet( - "data.outscale_public_ips.by_public_ips", "public_ips.0.public_ip"), - resource.TestCheckResourceAttrSet( - "data.outscale_public_ips.by_public_ips", "public_ips.1.public_ip"), - resource.TestCheckResourceAttrSet( - "data.outscale_public_ips.by_public_ips", "public_ips.2.public_ip"), - ), - }, - }, - }) -} - -func TestAccDataSourceOutscaleOAPIPublicIPS_withTags(t *testing.T) { - t.Parallel() - if os.Getenv("TEST_QUOTA") == "true" { - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIPublicIPSConfigWithTags, - }, - }, - }) - } else { - t.Skip("will be done soon") - } -} - -const testAccDataSourceOutscaleOAPIPublicIPSConfig = ` - resource "outscale_public_ip" "test" {} - resource "outscale_public_ip" "test1" {} - resource "outscale_public_ip" "test2" {} - - data "outscale_public_ips" "by_public_ips" { - filter { - name = "public_ip" - values = [outscale_public_ip.test.public_ip, outscale_public_ip.test1.public_ip, outscale_public_ip.test2.public_ip] - } - } -` - -const testAccDataSourceOutscaleOAPIPublicIPSConfigWithTags = ` - resource "outscale_public_ip" "outscale_public_ip" { - tags { - key = "name" - value = "public_ip-data" - } - } - - resource "outscale_public_ip" "outscale_public_ip2" { - tags { - key = "name" - value = "public_ip-data" - } - } - - data "outscale_public_ips" "outscale_public_ips" { - filter { - name = "tags" - values = ["name=public_ip-data"] - } - depends_on = [outscale_public_ip.outscale_public_ip, outscale_public_ip.outscale_public_ip2] - } -` From d169387d919f4e94de1b659cd9fe39767bbc056b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:13 +0000 Subject: [PATCH 42/82] Improve quota datasource --- outscale/data_source_outscale_quota.go | 16 +++------------- outscale/data_source_outscale_quotas.go | 6 +----- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/outscale/data_source_outscale_quota.go b/outscale/data_source_outscale_quota.go index 2711b3e52..9bf4d8817 100644 --- a/outscale/data_source_outscale_quota.go +++ b/outscale/data_source_outscale_quota.go @@ -61,12 +61,8 @@ func dataSourceOutscaleOAPIQuota() *schema.Resource { func dataSourceOutscaleOAPIQuotaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadQuotasRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIQuotaDataSourceFilters(filters.(*schema.Set)) } @@ -85,15 +81,9 @@ func dataSourceOutscaleOAPIQuotaRead(d *schema.ResourceData, meta interface{}) e errString := err.Error() return fmt.Errorf("[DEBUG] Error reading quotaType (%s)", errString) } - - if len(resp.GetQuotaTypes()) == 0 { - return fmt.Errorf("no matching quotas type found") - } - - if len(resp.GetQuotaTypes()) > 1 { - return fmt.Errorf("multiple quotas type matched; use additional constraints to reduce matches to a single quotaType") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetQuotaTypes()), "Quota"); err != nil { + return err } - quotaType := resp.GetQuotaTypes()[0] d.SetId(resource.UniqueId()) diff --git a/outscale/data_source_outscale_quotas.go b/outscale/data_source_outscale_quotas.go index 6ca16a2a2..cd214ccc2 100644 --- a/outscale/data_source_outscale_quotas.go +++ b/outscale/data_source_outscale_quotas.go @@ -68,12 +68,8 @@ func dataSourceOutscaleOAPIQuotas() *schema.Resource { func dataSourceOutscaleOAPIQuotasRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadQuotasRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPIQuotaDataSourceFilters(filters.(*schema.Set)) } From 31657957635b5f776d4a4163ee1982c4f05dd442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:13 +0000 Subject: [PATCH 43/82] Merge quota datasource testacc --- outscale/data_source_outscale_quota_test.go | 29 +++++++++++++------- outscale/data_source_outscale_quotas_test.go | 25 ----------------- 2 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 outscale/data_source_outscale_quotas_test.go diff --git a/outscale/data_source_outscale_quota_test.go b/outscale/data_source_outscale_quota_test.go index 7246924b8..93c3afaa1 100644 --- a/outscale/data_source_outscale_quota_test.go +++ b/outscale/data_source_outscale_quota_test.go @@ -6,25 +6,34 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIQuota(t *testing.T) { +func TestAcc_Quota_DataSource(t *testing.T) { t.Parallel() + dataSourceName := "data.outscale_quota.lbu-quota" + dataSourcesName := "data.outscale_quotas.all-quotas" + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIQuotaConfig, - Check: resource.ComposeTestCheckFunc(), + Config: testAcc_Quota_DataSource_Config, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourcesName, "quotas.#"), + + resource.TestCheckResourceAttr(dataSourceName, "name", "lb_listeners_limit"), + ), }, }, }) } -const testAccDataSourceOutscaleOAPIQuotaConfig = ` - data "outscale_quota" "lbu-quota" { - filter { - name = "quota_names" - values = ["lb_listeners_limit"] - } -} +const testAcc_Quota_DataSource_Config = ` + data "outscale_quota" "lbu-quota" { + filter { + name = "quota_names" + values = ["lb_listeners_limit"] + } + } + + data "outscale_quotas" "all-quotas" {} ` diff --git a/outscale/data_source_outscale_quotas_test.go b/outscale/data_source_outscale_quotas_test.go deleted file mode 100644 index 00cb5704d..000000000 --- a/outscale/data_source_outscale_quotas_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourcesOutscaleOAPIQuotas(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourcesOutscaleOAPIQuotasConfig, - Check: resource.ComposeTestCheckFunc(), - }, - }, - }) -} - -const testAccDataSourcesOutscaleOAPIQuotasConfig = ` -data "outscale_quotas" "all-quotas" {} -` From 5f615ce26c6ce0a390228cca0a1dc387fa6825c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:21 +0000 Subject: [PATCH 44/82] Improve route_table datasource --- outscale/data_source_outscale_route_table.go | 32 ++++-------------- outscale/data_source_outscale_route_tables.go | 33 +++---------------- 2 files changed, 10 insertions(+), 55 deletions(-) diff --git a/outscale/data_source_outscale_route_table.go b/outscale/data_source_outscale_route_table.go index baeba7056..2417eb481 100644 --- a/outscale/data_source_outscale_route_table.go +++ b/outscale/data_source_outscale_route_table.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -23,7 +22,6 @@ func dataSourceOutscaleOAPIRouteTable() *schema.Resource { "filter": dataSourceFiltersSchema(), "route_table_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "request_id": { @@ -133,28 +131,15 @@ func dataSourceOutscaleOAPIRouteTable() *schema.Resource { func dataSourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - routeTableID, routeTableIDOk := d.GetOk("route_table_id") - filter, filterOk := d.GetOk("filter") - - if !filterOk && !routeTableIDOk { - return fmt.Errorf("One of route_table_id or filters must be assigned") - } - - params := oscgo.ReadRouteTablesRequest{} - if routeTableIDOk { - params.Filters = &oscgo.FiltersRouteTable{ - RouteTableIds: &[]string{routeTableID.(string)}, - } - } - - if filterOk { - params.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) + req := oscgo.ReadRouteTablesRequest{} + if filter, filterOk := d.GetOk("filter"); filterOk { + req.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) } var resp oscgo.ReadRouteTablesResponse var err error err = resource.Retry(60*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.RouteTableApi.ReadRouteTables(context.Background()).ReadRouteTablesRequest(params).Execute() + rp, httpResp, err := conn.RouteTableApi.ReadRouteTables(context.Background()).ReadRouteTablesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -164,13 +149,8 @@ func dataSourceOutscaleOAPIRouteTableRead(d *schema.ResourceData, meta interface if err != nil { return err } - - numRouteTables := len(resp.GetRouteTables()) - if numRouteTables <= 0 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - if numRouteTables > 1 { - return fmt.Errorf("Multiple Route Table matched; use additional constraints to reduce matches to a single Route Table") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetRouteTables()), "Route Table"); err != nil { + return err } rt := resp.GetRouteTables()[0] diff --git a/outscale/data_source_outscale_route_tables.go b/outscale/data_source_outscale_route_tables.go index cb70c94fb..2159b58c1 100644 --- a/outscale/data_source_outscale_route_tables.go +++ b/outscale/data_source_outscale_route_tables.go @@ -18,11 +18,6 @@ func dataSourceOutscaleOAPIRouteTables() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "route_table_id": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "request_id": { Type: schema.TypeString, Computed: true, @@ -142,35 +137,15 @@ func dataSourceOutscaleOAPIRouteTables() *schema.Resource { func dataSourceOutscaleOAPIRouteTablesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - rtbID, rtbOk := d.GetOk("route_table_id") - filter, filterOk := d.GetOk("filter") - if !filterOk && !rtbOk { - return fmt.Errorf("One of route_table_id or filters must be assigned") - } - - params := oscgo.ReadRouteTablesRequest{ - Filters: &oscgo.FiltersRouteTable{}, - } - - if rtbOk { - i := rtbID.([]interface{}) - in := make([]string, len(i)) - for k, v := range i { - in[k] = v.(string) - } - filter := oscgo.FiltersRouteTable{} - filter.SetRouteTableIds(in) - params.SetFilters(filter) - } - - if filterOk { - params.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) + req := oscgo.ReadRouteTablesRequest{} + if filter, filterOk := d.GetOk("filter"); filterOk { + req.Filters = buildOutscaleOAPIDataSourceRouteTableFilters(filter.(*schema.Set)) } var resp oscgo.ReadRouteTablesResponse var err error err = resource.Retry(60*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.RouteTableApi.ReadRouteTables(context.Background()).ReadRouteTablesRequest(params).Execute() + rp, httpResp, err := conn.RouteTableApi.ReadRouteTables(context.Background()).ReadRouteTablesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 5c7ae1b5d7068363e169f0dd3a5a87655cb94c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:21 +0000 Subject: [PATCH 45/82] Merge route_table datasource testacc --- .../data_source_outscale_route_table_test.go | 90 ++++--------------- .../data_source_outscale_route_tables_test.go | 65 -------------- 2 files changed, 16 insertions(+), 139 deletions(-) delete mode 100644 outscale/data_source_outscale_route_tables_test.go diff --git a/outscale/data_source_outscale_route_table_test.go b/outscale/data_source_outscale_route_table_test.go index f0606ce8c..efa27fe24 100644 --- a/outscale/data_source_outscale_route_table_test.go +++ b/outscale/data_source_outscale_route_table_test.go @@ -1,89 +1,33 @@ package outscale import ( - "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccDataSourceOutscaleOAPIRouteTable_basic(t *testing.T) { +func TestAcc_RouteTable_DataSource(t *testing.T) { + dataSourceName := "data.outscale_route_table.route_table" + dataSourcesName := "data.outscale_route_tables.route_tables" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIRouteTableGroupConfig, + Config: testAcc_RouteTable_DataSource_Config, Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_filter"), - testAccDataSourceOutscaleOAPIRouteTableCheck("data.outscale_route_table.by_id"), + resource.TestCheckResourceAttr(dataSourcesName, "route_tables.#", "1"), + + resource.TestCheckResourceAttrSet(dataSourceName, "net_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "route_table_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "routes.#"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIRouteTableCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - rts, ok := s.RootModule().Resources["outscale_route_table.test"] - if !ok { - return fmt.Errorf("can't find outscale_route_table.test in state") - } - vpcRs, ok := s.RootModule().Resources["outscale_net.test"] - if !ok { - return fmt.Errorf("can't find outscale_net.test in state") - } - // FIXME: Missing route_table_links on ReadRouteTables request - // subnetRs, ok := s.RootModule().Resources["outscale_subnet.test"] - // if !ok { - // return fmt.Errorf("can't find outscale_subnet.test in state") - // } - attr := rs.Primary.Attributes - - if attr["id"] != rts.Primary.Attributes["id"] { - return fmt.Errorf( - "id is %s; want %s", - attr["id"], - rts.Primary.Attributes["id"], - ) - } - - if attr["route_table_id"] != rts.Primary.Attributes["id"] { - return fmt.Errorf( - "route_table_id is %s; want %s", - attr["route_table_id"], - rts.Primary.Attributes["id"], - ) - } - - if attr["net_id"] != vpcRs.Primary.Attributes["id"] { - return fmt.Errorf( - "net_id is %s; want %s", - attr["net_id"], - vpcRs.Primary.Attributes["id"], - ) - } - // FIXME: Missing route_table_links on ReadRouteTables request - // if attr["route_table_links.0.subnet_id"] != subnetRs.Primary.Attributes["id"] { - // return fmt.Errorf( - // "subnet_id is %v; want %s", - // attr["route_table_link.0.subnet_id"], - // subnetRs.Primary.Attributes["id"], - // ) - // } - - return nil - } -} - -const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` +const testAcc_RouteTable_DataSource_Config = ` resource "outscale_net" "test" { ip_range = "172.16.0.0/16" @@ -96,10 +40,6 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` resource "outscale_subnet" "test" { ip_range = "172.16.0.0/24" net_id = outscale_net.test.id - - #tag { - # Name = "terraform-testacc-data-source" - #} } resource "outscale_route_table" "test" { @@ -116,7 +56,7 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` route_table_id = outscale_route_table.test.id } - data "outscale_route_table" "by_filter" { + data "outscale_route_table" "route_table" { filter { name = "route_table_ids" values = [outscale_route_table.test.id] @@ -125,8 +65,10 @@ const testAccDataSourceOutscaleOAPIRouteTableGroupConfig = ` depends_on = [outscale_route_table_link.a] } - data "outscale_route_table" "by_id" { - route_table_id = outscale_route_table.test.id - depends_on = [outscale_route_table_link.a] + data "outscale_route_tables" "route_tables" { + filter { + name = "route_table_ids" + values = [outscale_route_table.test.id] + } } ` diff --git a/outscale/data_source_outscale_route_tables_test.go b/outscale/data_source_outscale_route_tables_test.go deleted file mode 100644 index c48444646..000000000 --- a/outscale/data_source_outscale_route_tables_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIRouteTables_basic(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIRouteTablesGroupConfig, - 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"), - ), - }, - }, - }) -} - -const testAccDataSourceOutscaleOAPIRouteTablesGroupConfig = ` - resource "outscale_net" "test" { - ip_range = "172.16.0.0/16" - - tags { - key = "Name" - value = "terraform-testacc-data-source" - } - } - - resource "outscale_subnet" "test" { - ip_range = "172.16.0.0/24" - net_id = "${outscale_net.test.id}" - - tags { - key = "Name" - value = "terraform-testacc-data-source" - } - } - - resource "outscale_route_table" "test" { - net_id = "${outscale_net.test.id}" - - tags { - key = "Name" - value = "terraform-testacc-routetable-data-source" - } - } - - data "outscale_route_tables" "by_filter" { - filter { - name = "route_table_ids" - values = ["${outscale_route_table.test.id}"] - } - } - - data "outscale_route_tables" "by_id" { - route_table_id = ["${outscale_route_table.test.id}"] - } -` From 50b22c086710d39ab4083560bfbc91229cfbdebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:36 +0000 Subject: [PATCH 46/82] Improve security_group datasource --- .../data_source_outscale_security_group.go | 30 ++---------- .../data_source_outscale_security_groups.go | 47 +------------------ 2 files changed, 4 insertions(+), 73 deletions(-) diff --git a/outscale/data_source_outscale_security_group.go b/outscale/data_source_outscale_security_group.go index 0ebde0a43..fe331ec71 100644 --- a/outscale/data_source_outscale_security_group.go +++ b/outscale/data_source_outscale_security_group.go @@ -22,12 +22,10 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { "filter": dataSourceFiltersSchema(), "security_group_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "security_group_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "description": { @@ -80,7 +78,6 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, - // ValidateFunc: validateCIDRNetworkAddress, }, }, "prefix_list_ids": { @@ -133,7 +130,6 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, - // ValidateFunc: validateCIDRNetworkAddress, }, }, "prefix_list_ids": { @@ -160,23 +156,7 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { func dataSourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI req := oscgo.ReadSecurityGroupsRequest{} - - filters, filtersOk := d.GetOk("filter") - gn, gnOk := d.GetOk("security_group_name") - gid, gidOk := d.GetOk("security_group_id") - - var filter oscgo.FiltersSecurityGroup - if gnOk { - filter.SetSecurityGroupNames([]string{gn.(string)}) - req.SetFilters(filter) - } - - if gidOk { - filter.SetSecurityGroupIds([]string{gid.(string)}) - req.SetFilters(filter) - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleOAPIDataSourceSecurityGroupFilters(filters.(*schema.Set))) } @@ -205,12 +185,8 @@ func dataSourceOutscaleOAPISecurityGroupRead(d *schema.ResourceData, meta interf return fmt.Errorf("Error on SGStateRefresh: %s", errString) } - if resp.GetSecurityGroups() == nil || len(resp.GetSecurityGroups()) == 0 { - return fmt.Errorf("Unable to find Security Group") - } - - if len(resp.GetSecurityGroups()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetSecurityGroups()), "Security Group"); err != nil { + return err } sg := resp.GetSecurityGroups()[0] diff --git a/outscale/data_source_outscale_security_groups.go b/outscale/data_source_outscale_security_groups.go index 1a398e4c2..1dc1839ef 100644 --- a/outscale/data_source_outscale_security_groups.go +++ b/outscale/data_source_outscale_security_groups.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "strings" "time" @@ -20,20 +19,6 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "security_group_names": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "security_group_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "security_groups": { Type: schema.TypeList, Computed: true, @@ -97,7 +82,6 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, - // ValidateFunc: validateCIDRNetworkAddress, }, }, "prefix_list_ids": { @@ -150,7 +134,6 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, - // ValidateFunc: validateCIDRNetworkAddress, }, }, "prefix_list_ids": { @@ -179,32 +162,8 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { func dataSourceOutscaleOAPISecurityGroupsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadSecurityGroupsRequest{} - - filters, filtersOk := d.GetOk("filter") - gn, gnOk := d.GetOk("security_group_names") - gid, gidOk := d.GetOk("security_group_ids") - var filter oscgo.FiltersSecurityGroup - if gnOk { - var g []string - for _, v := range gn.([]interface{}) { - g = append(g, v.(string)) - } - filter.SetSecurityGroupNames(g) - req.SetFilters(filter) - } - - if gidOk { - var g []string - for _, v := range gid.([]interface{}) { - g = append(g, v.(string)) - } - filter.SetSecurityGroupIds(g) - req.SetFilters(filter) - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.SetFilters(buildOutscaleOAPIDataSourceSecurityGroupFilters(filters.(*schema.Set))) } @@ -253,9 +212,6 @@ func dataSourceOutscaleOAPISecurityGroupsRead(d *schema.ResourceData, meta inter s["outbound_rules"] = flattenOAPISecurityGroupRule(v.GetOutboundRules()) sg[k] = s } - - log.Printf("[DEBUG] security_groups %+v", sg) - d.SetId(resource.UniqueId()) err = d.Set("security_groups", sg) @@ -277,7 +233,6 @@ func flattenOAPISecurityGroupRule(p []oscgo.SecurityGroupRule) []map[string]inte if v.GetToPortRange() != 0 { ip["to_port_range"] = v.GetToPortRange() } - if v.GetIpRanges() != nil && len(v.GetIpRanges()) > 0 { ip["ip_ranges"] = v.GetIpRanges() } From d12093606345f8ac5b8c11675e8bd3aeaffd2b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:36 +0000 Subject: [PATCH 47/82] Merge security_group datasource testacc --- ...ata_source_outscale_security_group_test.go | 122 +++++------------- ...ta_source_outscale_security_groups_test.go | 77 ----------- 2 files changed, 30 insertions(+), 169 deletions(-) delete mode 100644 outscale/data_source_outscale_security_groups_test.go diff --git a/outscale/data_source_outscale_security_group_test.go b/outscale/data_source_outscale_security_group_test.go index 2998474ea..b30544c2e 100644 --- a/outscale/data_source_outscale_security_group_test.go +++ b/outscale/data_source_outscale_security_group_test.go @@ -6,124 +6,62 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccDataSourceOutscaleOAPISecurityGroup_basic(t *testing.T) { +func TestAcc_SecurityGroup_DataSource(t *testing.T) { t.Parallel() rInt := acctest.RandInt() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt), - Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_id"), - //testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_filter"), - ), - }, - }, - }) -} + dataSourceName := "data.outscale_security_group.sg" + dataSourcesName := "data.outscale_security_groups.sgs" -func TestAccDataSourceOutscaleOAPISecurityGroupPublic(t *testing.T) { - t.Parallel() - rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISecurityGroupPublicConfig(rInt), + Config: testAcc_SecurityGroup_DataSource_Config(rInt), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISecurityGroupCheck("data.outscale_security_group.by_filter_public"), + resource.TestCheckResourceAttr(dataSourcesName, "security_groups.#", "2"), + + resource.TestCheckResourceAttr(dataSourceName, "description", "Used in the terraform acceptance tests datasource"), ), }, }, }) } -func testAccDataSourceOutscaleOAPISecurityGroupCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - SGRs, ok := s.RootModule().Resources["outscale_security_group.test"] - if !ok { - return fmt.Errorf("can't find outscale_security_group.test in state") - } - - attr := rs.Primary.Attributes - - if attr["security_group_id"] != SGRs.Primary.Attributes["id"] { - return fmt.Errorf( - "security_group_id is %s; want %s", - attr["security_group_id"], - SGRs.Primary.Attributes["id"], - ) - } - - //TODO: validate tags - // if attr["tag.Name"] != "tf-acctest" { - // return fmt.Errorf("bad Name tag %s", attr["tag.Name"]) - // } - - return nil - } -} - -func testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt int) string { +func testAcc_SecurityGroup_DataSource_Config(rInt int) string { return fmt.Sprintf(` - resource "outscale_net" "vpc" { - ip_range = "10.0.0.0/16" - tags { - key = "Name" - value = "testacc-sec-group-ds" - } - } - resource "outscale_security_group" "test" { - net_id = "${outscale_net.vpc.id}" - description = "Used in the terraform acceptance tests" - security_group_name = "test-%d" - #tag = { - # Name = "tf-acctest" - # Seed = "%d" - #} - } - - data "outscale_security_group" "by_id" { - security_group_id = "${outscale_security_group.test.id}" + description = "Used in the terraform acceptance tests datasource" + security_group_name = "test-1-%[1]d" + tag = { + Name = "tf-acctest" + Seed = "%[1]d" + } } - #data "outscale_security_group" "by_filter" { - # filter { - # name = "security_group_names" - # values = ["${outscale_security_group.test.security_group_name}"] - # } - #}`, rInt, rInt) -} - -func testAccDataSourceOutscaleOAPISecurityGroupPublicConfig(rInt int) string { - return fmt.Sprintf(` - resource "outscale_security_group" "test" { - description = "Used in the terraform acceptance tests" - security_group_name = "test-%d" + resource "outscale_security_group" "test2" { + description = "Used in the terraform acceptance tests datasource" + security_group_name = "test-2-%[1]d" tag = { Name = "tf-acctest" - Seed = "%d" + Seed = "%[1]d" } } - data "outscale_security_group" "by_filter_public" { + data "outscale_security_group" "sg" { filter { - name = "security_group_names" - - // name = "group_name" - values = ["${outscale_security_group.test.security_group_name}"] + name = "security_group_ids" + values = [outscale_security_group.test.security_group_id] + } + } + + data "outscale_security_groups" "sgs" { + filter { + name = "security_group_ids" + values = [outscale_security_group.test.security_group_id, outscale_security_group.test2.security_group_id] } - }`, rInt, rInt) + }`, + rInt) } diff --git a/outscale/data_source_outscale_security_groups_test.go b/outscale/data_source_outscale_security_groups_test.go deleted file mode 100644 index 0496733bd..000000000 --- a/outscale/data_source_outscale_security_groups_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPISecurityGroups_vpc(t *testing.T) { - rInt := acctest.RandInt() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPISecurityGroupConfigVPC(rInt), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "data.outscale_security_groups.by_id", "security_groups.#", "3"), - resource.TestCheckResourceAttr( - "data.outscale_security_groups.by_filter", "security_groups.#", "1"), - ), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPISecurityGroupConfigVPC(rInt int) string { - return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - } - - resource "outscale_security_group" "test" { - net_id = "${outscale_net.outscale_net.id}" - description = "Used in the terraform acceptance tests" - security_group_name = "test-1-%[1]d" - tag = { - Name = "tf-acctest" - Seed = "%[1]d" - } - } - - resource "outscale_security_group" "test2" { - net_id = "${outscale_net.outscale_net.id}" - description = "Used in the terraform acceptance tests" - security_group_name = "test-2-%[1]d" - tag = { - Name = "tf-acctest" - Seed = "%[1]d" - } - } - - resource "outscale_security_group" "test3" { - net_id = "${outscale_net.outscale_net.id}" - description = "Used in the terraform acceptance tests" - security_group_name = "test-3-%[1]d" - tag = { - Name = "tf-acctest" - Seed = "%[1]d" - } - } - - data "outscale_security_groups" "by_id" { - security_group_ids = ["${outscale_security_group.test.id}", "${outscale_security_group.test2.id}", "${outscale_security_group.test3.id}"] - } - - data "outscale_security_groups" "by_filter" { - filter { - name = "security_group_names" - values = ["${outscale_security_group.test.security_group_name}"] - } - } - `, rInt) -} From 8a0d1c8ec30cf17e87edf6275402ec833987b3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:46 +0000 Subject: [PATCH 48/82] Improve server_certificate datasource --- ...data_source_outscale_server_certificate.go | 28 ++++--------------- ...ata_source_outscale_server_certificates.go | 16 +++-------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/outscale/data_source_outscale_server_certificate.go b/outscale/data_source_outscale_server_certificate.go index 34de402a1..f29bb8cb5 100644 --- a/outscale/data_source_outscale_server_certificate.go +++ b/outscale/data_source_outscale_server_certificate.go @@ -48,24 +48,15 @@ func datasourceOutscaleOAPIServerCertificate() *schema.Resource { func datasourceOutscaleOAPIServerCertificateRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - - if !filtersOk { - return fmt.Errorf("filters must be assigned") - } - - // Build up search parameters - params := oscgo.ReadServerCertificatesRequest{} - - if filtersOk { - params.Filters = buildOutscaleOSCAPIDataSourceServerCertificateFilters(filters.(*schema.Set)) + req := oscgo.ReadServerCertificatesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOSCAPIDataSourceServerCertificateFilters(filters.(*schema.Set)) } var resp oscgo.ReadServerCertificatesResponse err := resource.Retry(120*time.Second, func() *resource.RetryError { var err error - rp, httpResp, err := conn.ServerCertificateApi.ReadServerCertificates(context.Background()).ReadServerCertificatesRequest(params).Execute() + rp, httpResp, err := conn.ServerCertificateApi.ReadServerCertificates(context.Background()).ReadServerCertificatesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -76,19 +67,12 @@ func datasourceOutscaleOAPIServerCertificateRead(d *schema.ResourceData, meta in if err != nil { return fmt.Errorf("[DEBUG] Error reading Server Certificate id (%s)", utils.GetErrorResponse(err)) } - - if !resp.HasServerCertificates() || len(resp.GetServerCertificates()) == 0 { - return fmt.Errorf("Error reading Server Certificate: Server Certificates is not found with the seatch criteria") - } - - if len(resp.GetServerCertificates()) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetServerCertificates()), "Server Certificate"); err != nil { + return err } result := resp.GetServerCertificates()[0] - log.Printf("[DEBUG] Setting Server Certificate id (%s)", err) - d.Set("expiration_date", result.GetExpirationDate()) d.Set("name", result.GetName()) d.Set("orn", result.GetOrn()) diff --git a/outscale/data_source_outscale_server_certificates.go b/outscale/data_source_outscale_server_certificates.go index 47f1f7594..112120154 100644 --- a/outscale/data_source_outscale_server_certificates.go +++ b/outscale/data_source_outscale_server_certificates.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -59,20 +58,15 @@ func datasourceOutscaleOAPIServerCertificates() *schema.Resource { func datasourceOutscaleOAPIServerCertificatesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - - // Build up search parameters - params := oscgo.ReadServerCertificatesRequest{} - - if filtersOk { - params.Filters = buildOutscaleOSCAPIDataSourceServerCertificateFilters(filters.(*schema.Set)) + req := oscgo.ReadServerCertificatesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOSCAPIDataSourceServerCertificateFilters(filters.(*schema.Set)) } var resp oscgo.ReadServerCertificatesResponse var err error err = resource.Retry(120*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.ServerCertificateApi.ReadServerCertificates(context.Background()).ReadServerCertificatesRequest(params).Execute() + rp, httpResp, err := conn.ServerCertificateApi.ReadServerCertificates(context.Background()).ReadServerCertificatesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -85,8 +79,6 @@ func datasourceOutscaleOAPIServerCertificatesRead(d *schema.ResourceData, meta i errString = err.Error() return fmt.Errorf("[DEBUG] Error reading Server Certificates (%s)", errString) } - - log.Printf("[DEBUG] Setting Server Certificates id (%s)", err) d.Set("server_certificates", flattenServerCertificates(resp.GetServerCertificates())) d.SetId(resource.UniqueId()) return nil From 4960a8f8f2bfe12a1f04bda2b2a6ce02eafd3a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:26:46 +0000 Subject: [PATCH 49/82] Merge server_certificate datasource testacc --- ...source_outscale_server_certificate_test.go | 77 ++++++----- ...ource_outscale_server_certificates_test.go | 124 ------------------ 2 files changed, 46 insertions(+), 155 deletions(-) delete mode 100644 outscale/data_source_outscale_server_certificates_test.go diff --git a/outscale/data_source_outscale_server_certificate_test.go b/outscale/data_source_outscale_server_certificate_test.go index 1ff4be750..8ee31718d 100644 --- a/outscale/data_source_outscale_server_certificate_test.go +++ b/outscale/data_source_outscale_server_certificate_test.go @@ -8,10 +8,53 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPIServerCertificateDatasource_basic(t *testing.T) { +func TestAcc_ServerCertificate_Datasource(t *testing.T) { t.Parallel() rName := acctest.RandomWithPrefix("acc-test") - body := `-----BEGIN CERTIFICATE----- + dataSourceName := "data.outscale_server_certificate.test" + dataSourcesName := "data.outscale_server_certificates.test" + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAcc_ServerCertificate_Datasource_Config(rName, body, private), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourcesName, "server_certificates.#"), + + resource.TestCheckResourceAttrSet(dataSourceName, "path"), + ), + }, + }, + }) +} + +func testAcc_ServerCertificate_Datasource_Config(name, body, privateKey string) string { + return fmt.Sprintf(` +resource "outscale_server_certificate" "test" { + name = %[1]q + body = %[2]q + private_key = %[3]q + path = "/datasource/" +} + +data "outscale_server_certificate" "test" { + filter { + name = "paths" + values = [outscale_server_certificate.test.path] + } +} + +data "outscale_server_certificates" "test" { + filter { + name = "paths" + values = [outscale_server_certificate.test.path] + } +} + `, name, body, privateKey) +} + +var body = `-----BEGIN CERTIFICATE----- MIIFETCCAvkCFE1QlISgW8h5/akhNlZzb+or8HgYMA0GCSqGSIb3DQEBCwUAMEUx CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl cm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjEwOTA5MDAyNDQzWhcNMzEwOTA3MDAy @@ -42,7 +85,7 @@ zz2wyUFLztD3nO3US8tPSz/I5kXWGpOrPt+UcUPQEGzu5WQ+ZOeD+mQQMCVv0wiz nmS35ug= -----END CERTIFICATE----- ` - private := `-----BEGIN PRIVATE KEY----- +var private = `-----BEGIN PRIVATE KEY----- MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDThPt5Q3OR20wO VxanOC7/FKD3xm+GcMHvmznbw5eDDTxQUz0amoZi7XbFu3TbPQ8mYEEk/LuqbcOn Y60u4NwBMvpAlOLQpfnG+4tOYGe5Kgd7kRxsw7HZgdHoeL2FS2XozgTbLgvFzlNC @@ -94,31 +137,3 @@ mUsRJKg0Iz5dk/1xIAWlhOdcx8tKIXrOY9tv7470XVZcVWXzzcKhOSzZwDNkiAn7 kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y 0UFH3oBALPqPwDIt0F+wjSaY2bcmCjo= -----END PRIVATE KEY-----` - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPIServerCertificateDatasourceConfig(rName, body, private), - }, - }, - }) -} - -func testAccOutscaleOAPIServerCertificateDatasourceConfig(name, body, privateKey string) string { - return fmt.Sprintf(` -resource "outscale_server_certificate" "test" { - name = %[1]q - body = %[2]q - private_key = %[3]q -} - -data "outscale_server_certificates" "test" { - filter { - name = "paths" - values = [outscale_server_certificate.test.path] - } -} - `, name, body, privateKey) -} diff --git a/outscale/data_source_outscale_server_certificates_test.go b/outscale/data_source_outscale_server_certificates_test.go deleted file mode 100644 index af0fddf6e..000000000 --- a/outscale/data_source_outscale_server_certificates_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPIServerCertificatesDatasource_basic(t *testing.T) { - t.Parallel() - rName := acctest.RandomWithPrefix("acc-test") - body := `-----BEGIN CERTIFICATE----- -MIIFETCCAvkCFE1QlISgW8h5/akhNlZzb+or8HgYMA0GCSqGSIb3DQEBCwUAMEUx -CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl -cm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjEwOTA5MDAyNDQzWhcNMzEwOTA3MDAy -NDQzWjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UE -CgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIICIjANBgkqhkiG9w0BAQEFAAOC -Ag8AMIICCgKCAgEA04T7eUNzkdtMDlcWpzgu/xSg98ZvhnDB75s528OXgw08UFM9 -GpqGYu12xbt02z0PJmBBJPy7qm3Dp2OtLuDcATL6QJTi0KX5xvuLTmBnuSoHe5Ec -bMOx2YHR6Hi9hUtl6M4E2y4Lxc5TQonIHtBprTWb4B5SFVdjgh8PFPHWJ8/YCM53 -RoUOsPnGb61cfStsK0zd3iUXOiIDDrN8EaMZi4ykqdBL2eztKWf6DSUTzK6sLZJu -MHK8Q5psryKO68gUx8pbwHGSEf+UxhsC1Bik+HJBH8OvULvB8OpBP4IixI0RHT3K -atrv6z+gl3X7606jaRxs4hlKrfORGK6SB6xloi+ptfXSKB1+6L0I2gjcIbpNvM+h -Dsvp1oly4H/QGA/g24dQgVuoB4hetZ5U+IQU231CJAOVLrw958ln746KN5wtQ8ur -IFkMRKb2X4ccAmLQroOxZGxv9MgvpQIJCdC18/fkZdEMKTGK6TmrcvPZ9A8tLYzn -yQcOvJ4r6Yh5Z6TUJWSjPqMPYZQgb2NBSGP8MBuQ67BHMBSO5F+wM+PPURw3clwl -qVJHXN1OLakmwxY2jsrZRxX8P2Q9Nkd/vRWmA6z4TlzEQxaKcJUHgsjbW5sl/FJ1 -h/E4CUfCReBXSF2ByWRcMkkAtcWQhzBMWJzAsNUltK4HgT8yY2CUMVSwTXcCAwEA -ATANBgkqhkiG9w0BAQsFAAOCAgEAiDGXtRVWfMvytjRmG7OeDuPvnKEcNSXyUARj -o4vq6z3SOVpfv4gG98p0aT3Xoi3yyWW+zATySOfgVTQkDVtHsBy98k2Z6/jP4Bsi -ryOuxhz4JR9hCyyNq3/RlIKcdTpcKIY0MC+xfVSyAXJXvX+MuGOPqB7/AF842Pyv -vn0Vfkk3K7gMTDITgp7+XVfjX+PF/pjeJ8p4yrSmhUAylPat1oNWtOiEDV/OMaQD -PGAFSEU7+07jz6fQSXjXE8u+uWZ9CUP3F5aRws0kold65aAamfCNXeckEuvsrIrB -hCAXFh06z/amaxR3Sg1pxxx3QNuwRp7KP79eu6Y+1erIwKYqfo/T7lEJn7i+CHJQ -M0veJi5Saoe1mZpq6/fBSnaEtDOw/yQ8+eMe37fiB/jdYb2L3FabkwUJH6Do3BkN -V4WVjjwuT0MHPLJUrsoKDd37GkDsrbhrp/MbgITy1bZWdqaYf0fzDCy+cyUwpWLf -T4ELtBlg7+Hl+1ysiPU2voq1COBiz5MGHNbVj3FI0SteOjFZXMcvfhQ//bksk5Kb -8hpaM5fMheQj6iaLhsW6u4qIJUd4hclrACMwZUIFOSlXs6HZBkmUfB/4XBn5Vas3 -zz2wyUFLztD3nO3US8tPSz/I5kXWGpOrPt+UcUPQEGzu5WQ+ZOeD+mQQMCVv0wiz -nmS35ug= ------END CERTIFICATE----- -` - private := `-----BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDThPt5Q3OR20wO -VxanOC7/FKD3xm+GcMHvmznbw5eDDTxQUz0amoZi7XbFu3TbPQ8mYEEk/LuqbcOn -Y60u4NwBMvpAlOLQpfnG+4tOYGe5Kgd7kRxsw7HZgdHoeL2FS2XozgTbLgvFzlNC -icge0GmtNZvgHlIVV2OCHw8U8dYnz9gIzndGhQ6w+cZvrVx9K2wrTN3eJRc6IgMO -s3wRoxmLjKSp0EvZ7O0pZ/oNJRPMrqwtkm4wcrxDmmyvIo7ryBTHylvAcZIR/5TG -GwLUGKT4ckEfw69Qu8Hw6kE/giLEjREdPcpq2u/rP6CXdfvrTqNpHGziGUqt85EY -rpIHrGWiL6m19dIoHX7ovQjaCNwhuk28z6EOy+nWiXLgf9AYD+Dbh1CBW6gHiF61 -nlT4hBTbfUIkA5UuvD3nyWfvjoo3nC1Dy6sgWQxEpvZfhxwCYtCug7FkbG/0yC+l -AgkJ0LXz9+Rl0QwpMYrpOaty89n0Dy0tjOfJBw68nivpiHlnpNQlZKM+ow9hlCBv -Y0FIY/wwG5DrsEcwFI7kX7Az489RHDdyXCWpUkdc3U4tqSbDFjaOytlHFfw/ZD02 -R3+9FaYDrPhOXMRDFopwlQeCyNtbmyX8UnWH8TgJR8JF4FdIXYHJZFwySQC1xZCH -MExYnMCw1SW0rgeBPzJjYJQxVLBNdwIDAQABAoICAGPC7tCMza9XXRHOZXLM/u10 -D0+NmgAwomeeMLXEFGvNDEteVw17IDL8iO5NsZnNvJ1+/HqzcNe7GXKTgpT/nQQ7 -xOg80JVUEvCUp2l58rHUbt8K2/s4eWN65UPd3pVFsHUS5htyJj9PRtm1HlvaNF1r -UW9tHY3PP7GZcIWSYk04rE3LA1qRWxKBW+REQcEPf98US/iASeozLHn8kWHIKT42 -QVuOUJgiNOE4lykn+aSqJa8Ax1O2abEA3o3joMD4B0UL3iZv6lLu1n5xMu5SCUzc -pnaS1tcfFyPHeKq5eCh32ECQai3nwQyVX+rPzNd4qX3j2D7zatOMczzO6TURTIVM -m7giyp3csPRVjPVYfne8rGnj2gooMKVXaddumQbEEQDcpLMPcnflwKyIux+gE6aM -EYNKknFePTyL6k8gnFtd6wZRu4HD2fvHP1oPjOaSq/8/k5PDyKt8il2P37DEQMFb -z/UWsqGKyRd+Z0vmbEb7OiiD8dfV/2LEixxT+x9UHttWFCZVFOj5jL5lpUVnQyn9 -gAkeX6B16XvNtClGriqppp/u0I9txbzX4kQI2bEHyBGc6lk/hEuCW2ndmW5CyBEy -d+AlkfK/sobglkMNHPzJdGp1tKxzLjc5oDICvojvRW3mcCS4ztEoHnkbArDQ1YQf -7DR5H8WDIZhNqFcRfM+xAoIBAQDvGDT/c1K0hJ+Nwd65UNm+A4cECO3LeDtu22J6 -QZlwWCyO/ooT65AEg/Ws8Vj5Cavhaiqhy05p6zDKN92E5MKiyzYJAaw7HLzT/i9s -+MOL41oNhReLAhX3MvO5xfMKDupQdDjNYews8XfqDfm9Oq3t9WR8IAlKVXL5c27W -oz1/8nMpcDXSAdyxCJOZefYKeAlCflRLKlHfNEYEcugf0XOM62HiJjXgrtqDi3LX -MlmxVeKypYBMMR19YY18Ds0skoGLK+aBombmhoboqxnpCdypJ6CHS4rRVWtOVQ1d -K0N86tMLanOKBUBdF044yEs3RZ1isnxG+zF3ghP8E1vnkxlLAoIBAQDieaUmph7g -y+XHU3rxS5LDdPDvhcrQ8o/sK0VvSEBEM2L57jf6lX8mOpJHwgDQmlQrFywEojSY -PFR/Fu8UXh1yUK0JIKdjdTC4IEdvATi23t66B6HxcXRMZEjG0aKlDDLYNXs5oi+n -zSdfXHTXvahcE+ST7srrW8a8rGnOg4gNioXyhRLYJgieVmOP1vdXaGmyFIp0dizk -a/J1rRzmAKuWRszmMPWaRI5+zj4ZUM7SNXxuXqB1s2MtDLAGXayTPNpQxATjrbnJ -X3EgUVCL79NnDzz7sBMn+sfqjojO1TEr7/O/efnn0R7rJtapmXRpyOMAWl7nQMxi -msxChlO2mA0FAoIBAQDHMZu11xZoXrWvHH26VqmRrM6nhejXQ2wAh7YbtNtoxY0Z -9OaEghSSLn5XfxtpH62bNyAde4vwookbcD+VoCCoEDUMe+BJvz9yPqq0VuxTdy5n -ZSKgJTS3pjN36nr5PkPok2tfcN2a8/G7hbky9dhCD9ePsgELdPU87fbBy25JUmyv -cVTlibebplGR5BIf1rGgPC9uD+v10U8kFbdeCtoB5Xi/OKZaclKKlXsv3jrri2o6 -+7dPwvuWodeGK660G7rhf8mi5vJjzGBJJ4OGqzizlNgg38bfcBLeR+3CWXD4eYsq -T53Ct21QIUKB/BzuB4l/2MPBPzWPI0gTEu3WmK7RAoIBABTcqcbupIeGoMsEuJ2D -nahdnFgkFfO7dGCH9+RxXmIp7aMiO4vcu5K08Ialq1eL79bsUoS2wGuJmyr93NYe -eU3vepENrf2ubOd5Kbti/Gt0CkZOr69DCTiEQGP4KahUgFaETq6XbxZhApB5PtYk -xV5+Ap9R7uVRVfRJWZHJcf31VbNqaLr6fe6//HnijnRBzQK3e62QuT/tZa9LXA8f -3q6AJR3LQsSMLigmLXg9hl+8x5KPKu7MsIUU1x4vANerUl0AQYcLmMKhBRW6B9Zs -KCglMjPpG0qigknsCVQsNVRbzTNFNC0TiWqV8E49MYkRFUASEw3wXSN0KP6zywBV -71UCggEBAJjscscguJ2gjTHZQsivc4iLLYcnAwidZ5f0uJmmP/sYMPV5f2q45z3a -mUsRJKg0Iz5dk/1xIAWlhOdcx8tKIXrOY9tv7470XVZcVWXzzcKhOSzZwDNkiAn7 -50cHJKC1zgOZGkkpLobc9gugW8mPGt3IKn+SSlXEVBIk7gRARZcwgUVJHkArYAMw -9ihgZo3p8dmceFwmN/LSqDCGwWbsQ9lvthMx1F7hkqmLM7Y7AOZTPCYxTjwkfOds -kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y -0UFH3oBALPqPwDIt0F+wjSaY2bcmCjo= ------END PRIVATE KEY-----` - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPIServerCertificatesDatasourceConfig(rName, body, private), - }, - }, - }) -} - -func testAccOutscaleOAPIServerCertificatesDatasourceConfig(name, body, privateKey string) string { - return fmt.Sprintf(` -resource "outscale_server_certificate" "test" { - name = %[1]q - body = %[2]q - private_key = %[3]q -} - -data "outscale_server_certificates" "test" { - filter { - name = "paths" - values = [outscale_server_certificate.test.path] - } - } - `, name, body, privateKey) -} From 9d47ff7ac59eb14591352184403d0f1efa4b2d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:02 +0000 Subject: [PATCH 50/82] Improve snapshot_export_task datasource --- ...ta_source_outscale_snapshot_export_task.go | 28 ++++++------------- ...a_source_outscale_snapshot_export_tasks.go | 19 +++---------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/outscale/data_source_outscale_snapshot_export_task.go b/outscale/data_source_outscale_snapshot_export_task.go index cfa586f64..e97a8ae07 100644 --- a/outscale/data_source_outscale_snapshot_export_task.go +++ b/outscale/data_source_outscale_snapshot_export_task.go @@ -26,11 +26,6 @@ func dataSourceOutscaleOAPISnapshotExportTask() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "dry_run": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, "osu_export": { Type: schema.TypeList, Computed: true, @@ -82,21 +77,15 @@ func dataSourceOutscaleOAPISnapshotExportTask() *schema.Resource { func dataSourceOAPISnapshotExportTaskRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - - filtersReq := &oscgo.FiltersExportTask{} - if filtersOk { - filtersReq = buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(filters.(*schema.Set)) + req := oscgo.ReadSnapshotExportTasksRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(filters.(*schema.Set))) } - var resp oscgo.ReadSnapshotExportTasksResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { rp, httpResp, err := conn.SnapshotApi.ReadSnapshotExportTasks(context.Background()). - ReadSnapshotExportTasksRequest(oscgo.ReadSnapshotExportTasksRequest{ - Filters: filtersReq, - }).Execute() + ReadSnapshotExportTasksRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -107,9 +96,8 @@ func dataSourceOAPISnapshotExportTaskRead(d *schema.ResourceData, meta interface if err != nil { return fmt.Errorf("Error reading task snapshot export %s", err) } - - if len(resp.GetSnapshotExportTasks()) == 0 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetSnapshotExportTasks()), "Snapshot Export Task"); err != nil { + return err } v := resp.GetSnapshotExportTasks()[0] @@ -149,7 +137,7 @@ func dataSourceOAPISnapshotExportTaskRead(d *schema.ResourceData, meta interface return nil } -func buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(set *schema.Set) *oscgo.FiltersExportTask { +func buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(set *schema.Set) oscgo.FiltersExportTask { var filters oscgo.FiltersExportTask for _, v := range set.List() { m := v.(map[string]interface{}) @@ -165,5 +153,5 @@ func buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(set *schema.Set) *os log.Printf("[Debug] Unknown Filter Name: %s.", name) } } - return &filters + return filters } diff --git a/outscale/data_source_outscale_snapshot_export_tasks.go b/outscale/data_source_outscale_snapshot_export_tasks.go index 39bcdc7a1..64b15f93e 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks.go +++ b/outscale/data_source_outscale_snapshot_export_tasks.go @@ -26,11 +26,6 @@ func dataSourceOutscaleOAPISnapshotExportTasks() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "dry_run": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, "snapshot_export_tasks": { Type: schema.TypeList, Computed: true, @@ -90,21 +85,16 @@ func dataSourceOutscaleOAPISnapshotExportTasks() *schema.Resource { func dataSourceOAPISnapshotExportTasksRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - - filtersReq := &oscgo.FiltersExportTask{} - if filtersOk { - filtersReq = buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(filters.(*schema.Set)) + req := oscgo.ReadSnapshotExportTasksRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOSCAPIDataSourceSnapshotExportTaskFilters(filters.(*schema.Set))) } var resp oscgo.ReadSnapshotExportTasksResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { rp, httpResp, err := conn.SnapshotApi.ReadSnapshotExportTasks(context.Background()). - ReadSnapshotExportTasksRequest(oscgo.ReadSnapshotExportTasksRequest{ - Filters: filtersReq, - }).Execute() + ReadSnapshotExportTasksRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -115,7 +105,6 @@ func dataSourceOAPISnapshotExportTasksRead(d *schema.ResourceData, meta interfac if err != nil { return fmt.Errorf("Error reading task image %s", err) } - if len(resp.GetSnapshotExportTasks()) == 0 { return fmt.Errorf("your query returned no results, please change your search criteria and try again") } From 18830d30b102c509ba928762fdbeaf95ddc48e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:02 +0000 Subject: [PATCH 51/82] Merge snapshot_export_task datasource testacc --- ...urce_outscale_snapshot_export_task_test.go | 49 +++++++--------- ...rce_outscale_snapshot_export_tasks_test.go | 57 ------------------- 2 files changed, 22 insertions(+), 84 deletions(-) delete mode 100644 outscale/data_source_outscale_snapshot_export_tasks_test.go diff --git a/outscale/data_source_outscale_snapshot_export_task_test.go b/outscale/data_source_outscale_snapshot_export_task_test.go index 93630d3e1..9ba6f3564 100644 --- a/outscale/data_source_outscale_snapshot_export_task_test.go +++ b/outscale/data_source_outscale_snapshot_export_task_test.go @@ -2,17 +2,19 @@ package outscale import ( "fmt" + "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPISnapshotExportTaskDataSource_basic(t *testing.T) { +func TestAcc_SnapshotExportTask_DataSource(t *testing.T) { t.Parallel() imageName := acctest.RandomWithPrefix("terraform-export-") + region := os.Getenv("OUTSCALE_REGION") + dataSourceName := "data.outscale_snapshot_export_task.export_task" + dataSourcesName := "data.outscale_snapshot_export_tasks.export_tasks" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -20,35 +22,21 @@ func TestAccOutscaleOAPISnapshotExportTaskDataSource_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(imageName), + Config: testAcc_SnapshotExportTask_DataSource_Config(region, imageName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleSnapshotExportTaskDataSourceID("data.outscale_snapshot_export_task.export_task"), + resource.TestCheckResourceAttrSet(dataSourcesName, "snapshot_export_tasks.#"), + resource.TestCheckResourceAttrSet(dataSourceName, "task_id"), ), }, }, }) } -func testAccCheckOutscaleSnapshotExportTaskDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("can't find Snapshot Export Task data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Snapshot Export Task data source ID not set") - } - return nil - } -} - -func testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(testName string) string { +func testAcc_SnapshotExportTask_DataSource_Config(region, testName string) string { var stringTemplate = ` resource "outscale_volume" "outscale_volume_snap" { - subregion_name = "eu-west-2a" - size = 10 + subregion_name = "%[1]a" + size = 1 } resource "outscale_snapshot" "outscale_snapshot" { @@ -56,12 +44,12 @@ func testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(testName string) stri } resource "outscale_snapshot_export_task" "outscale_snapshot_export_task" { - snapshot_id = outscale_snapshot.outscale_snapshot.snapshot_id + snapshot_id = outscale_snapshot.outscale_snapshot.snapshot_id osu_export { disk_image_format = "qcow2" - osu_bucket = "%s" + osu_bucket = "%[2]s" osu_prefix = "new-export" - } + } } data "outscale_snapshot_export_task" "export_task" { @@ -70,6 +58,13 @@ func testAccOutscaleOAPISnapshotExportTaskDataSourceConfig(testName string) stri values = [outscale_snapshot_export_task.outscale_snapshot_export_task.id] } } + + data "outscale_snapshot_export_tasks" "export_tasks" { + filter { + name = "task_ids" + values = [outscale_snapshot_export_task.outscale_snapshot_export_task.id] + } + } ` - return fmt.Sprintf(stringTemplate, testName) + return fmt.Sprintf(stringTemplate, region, testName) } diff --git a/outscale/data_source_outscale_snapshot_export_tasks_test.go b/outscale/data_source_outscale_snapshot_export_tasks_test.go deleted file mode 100644 index ca3b8d3c2..000000000 --- a/outscale/data_source_outscale_snapshot_export_tasks_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPISnapshotExportTasksDataSource_basic(t *testing.T) { - imageName := acctest.RandomWithPrefix("terraform-export") - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleOAPISnapshotExportTasksDataSourceConfig(imageName), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleSnapshotExportTaskDataSourceID("data.outscale_snapshot_export_tasks.export_tasks"), - ), - }, - }, - }) -} - -func testAccOutscaleOAPISnapshotExportTasksDataSourceConfig(testName string) string { - var stringTemplate = ` - resource "outscale_volume" "outscale_volume_snap" { - subregion_name = "eu-west-2a" - size = 10 - } - - resource "outscale_snapshot" "outscale_snapshot" { - volume_id = outscale_volume.outscale_volume_snap.volume_id - } - - resource "outscale_snapshot_export_task" "outscale_snapshot_export_task" { - snapshot_id = outscale_snapshot.outscale_snapshot.snapshot_id - osu_export { - disk_image_format = "qcow2" - osu_bucket = "%s" - osu_prefix = "new-export" - } - } - - data "outscale_snapshot_export_tasks" "export_tasks" { - filter { - name = "task_ids" - values = [outscale_snapshot_export_task.outscale_snapshot_export_task.id] - } - } - ` - return fmt.Sprintf(stringTemplate, testName) -} From 5a2785b27e96b623bc7c1c5bafb5b3ebde019e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:09 +0000 Subject: [PATCH 52/82] Improve snapshot datasource --- outscale/data_source_outscale_snapshot.go | 56 ++++------------------ outscale/data_source_outscale_snapshots.go | 52 ++------------------ 2 files changed, 12 insertions(+), 96 deletions(-) diff --git a/outscale/data_source_outscale_snapshot.go b/outscale/data_source_outscale_snapshot.go index 99f50f683..48e6672d3 100644 --- a/outscale/data_source_outscale_snapshot.go +++ b/outscale/data_source_outscale_snapshot.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "strconv" "time" @@ -19,7 +18,6 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { Read: dataSourceOutscaleOAPISnapshotRead, Schema: map[string]*schema.Schema{ - //selection criteria "filter": dataSourceFiltersSchema(), "permissions_to_create_volume": { Type: schema.TypeList, @@ -38,8 +36,6 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { }, }, }, - - //Computed values returned "progress": { Type: schema.TypeInt, Computed: true, @@ -50,7 +46,6 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { }, "snapshot_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "volume_id": { @@ -64,7 +59,6 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { "account_id": { Type: schema.TypeString, Computed: true, - Optional: true, }, "account_alias": { Type: schema.TypeString, @@ -89,41 +83,14 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { func dataSourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - restorableUsers, restorableUsersOk := d.GetOk("permission_to_create_volume") - filters, filtersOk := d.GetOk("filter") - snapshotIds, snapshotIdsOk := d.GetOk("snapshot_id") - owners, ownersOk := d.GetOk("account_id") - - if restorableUsers == false && !filtersOk && snapshotIds == false && !ownersOk { - return fmt.Errorf("One of snapshot_ids, filters, restorable_by_user_ids, or owners must be assigned") - } - - params := oscgo.ReadSnapshotsRequest{ - Filters: &oscgo.FiltersSnapshot{}, - } - - filter := oscgo.FiltersSnapshot{} - if restorableUsersOk { - filter.SetPermissionsToCreateVolumeAccountIds(utils.InterfaceSliceToStringSlice(restorableUsers.([]interface{}))) - params.SetFilters(filter) - } - if filtersOk { - buildOutscaleOapiSnapshootDataSourceFilters(filters.(*schema.Set), params.Filters) - } - if ownersOk { - filter.SetAccountIds([]string{owners.(string)}) - params.SetFilters(filter) + req := oscgo.ReadSnapshotsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOapiSnapshootDataSourceFilters(filters.(*schema.Set))) } - if snapshotIdsOk { - filter.SetSnapshotIds([]string{snapshotIds.(string)}) - params.SetFilters(filter) - } - var resp oscgo.ReadSnapshotsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.SnapshotApi.ReadSnapshots(context.Background()).ReadSnapshotsRequest(params).Execute() + rp, httpResp, err := conn.SnapshotApi.ReadSnapshots(context.Background()).ReadSnapshotsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -133,17 +100,10 @@ func dataSourceOutscaleOAPISnapshotRead(d *schema.ResourceData, meta interface{} if err != nil { return err } - - if len(resp.GetSnapshots()) < 1 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - if len(resp.GetSnapshots()) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetSnapshots()), "Snapshot"); err != nil { + return err } - snapshot := resp.GetSnapshots()[0] - - //Single Snapshot found so set to state return snapshotOAPIDescriptionAttributes(d, &snapshot) } @@ -189,8 +149,8 @@ func snapshotOAPIDescriptionAttributes(d *schema.ResourceData, snapshot *oscgo.S return d.Set("tags", tagsOSCAPIToMap(snapshot.GetTags())) } -func buildOutscaleOapiSnapshootDataSourceFilters(set *schema.Set, filter *oscgo.FiltersSnapshot) *oscgo.FiltersSnapshot { - +func buildOutscaleOapiSnapshootDataSourceFilters(set *schema.Set) oscgo.FiltersSnapshot { + filter := oscgo.FiltersSnapshot{} for _, v := range set.List() { m := v.(map[string]interface{}) var values []string diff --git a/outscale/data_source_outscale_snapshots.go b/outscale/data_source_outscale_snapshots.go index d08b9af57..b38306f21 100644 --- a/outscale/data_source_outscale_snapshots.go +++ b/outscale/data_source_outscale_snapshots.go @@ -17,24 +17,7 @@ func dataSourceOutscaleOAPISnapshots() *schema.Resource { Read: dataSourceOutscaleOAPISnapshotsRead, Schema: map[string]*schema.Schema{ - //selection criteria "filter": dataSourceFiltersSchema(), - "account_id": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "snapshot_id": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "permission_to_create_volume": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - //Computed values returned "snapshots": { Type: schema.TypeList, Computed: true, @@ -107,40 +90,14 @@ func dataSourceOutscaleOAPISnapshots() *schema.Resource { func dataSourceOutscaleOAPISnapshotsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - restorableUsers, restorableUsersOk := d.GetOk("permission_to_create_volume") - filters, filtersOk := d.GetOk("filter") - snapshotIds, snapshotIdsOk := d.GetOk("snapshot_id") - owners, ownersOk := d.GetOk("account_id") - - if restorableUsers == false && !filtersOk && snapshotIds == false && !ownersOk { - return fmt.Errorf("One of snapshot_ids, filters, restorable_by_user_ids, or owners must be assigned") + req := oscgo.ReadSnapshotsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOapiSnapshootDataSourceFilters(filters.(*schema.Set))) } - - params := oscgo.ReadSnapshotsRequest{ - Filters: &oscgo.FiltersSnapshot{}, - } - filter := oscgo.FiltersSnapshot{} - if restorableUsersOk { - filter.SetPermissionsToCreateVolumeAccountIds(utils.InterfaceSliceToStringSlice(restorableUsers.([]interface{}))) - params.SetFilters(filter) - } - if filtersOk { - buildOutscaleOapiSnapshootDataSourceFilters(filters.(*schema.Set), params.Filters) - } - if ownersOk { - filter.SetAccountIds(utils.InterfaceSliceToStringSlice(owners.([]interface{}))) - params.SetFilters(filter) - } - if snapshotIdsOk { - filter.SetSnapshotIds(utils.InterfaceSliceToStringSlice(snapshotIds.([]interface{}))) - params.SetFilters(filter) - } - var resp oscgo.ReadSnapshotsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.SnapshotApi.ReadSnapshots(context.Background()).ReadSnapshotsRequest(params).Execute() + rp, httpResp, err := conn.SnapshotApi.ReadSnapshots(context.Background()).ReadSnapshotsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -181,6 +138,5 @@ func dataSourceOutscaleOAPISnapshotsRead(d *schema.ResourceData, meta interface{ } d.SetId(resource.UniqueId()) - //Single Snapshot found so set to state return d.Set("snapshots", snapshots) } From 25fc57618ab8da0a687b0b88643be1f3fbab3e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:09 +0000 Subject: [PATCH 53/82] Merge snapshot datasource testacc --- .../data_source_outscale_snapshot_test.go | 80 +++++-------------- .../data_source_outscale_snapshots_test.go | 37 --------- 2 files changed, 22 insertions(+), 95 deletions(-) delete mode 100644 outscale/data_source_outscale_snapshots_test.go diff --git a/outscale/data_source_outscale_snapshot_test.go b/outscale/data_source_outscale_snapshot_test.go index 4e668155a..fd9139acd 100644 --- a/outscale/data_source_outscale_snapshot_test.go +++ b/outscale/data_source_outscale_snapshot_test.go @@ -6,62 +6,30 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPISnapshotDataSource_basic(t *testing.T) { +func TestAcc_Snapshot_DataSource(t *testing.T) { t.Parallel() region := os.Getenv("OUTSCALE_REGION") - + dataSourceName := "data.outscale_snapshot.snapshot" + dataSourcesName := "data.outscale_snapshots.snapshot" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISnapshotDataSourceConfig(region), + Config: testAcc_Snapshot_DataSource_Config(region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotDataSourceID("data.outscale_snapshot.snapshot"), - resource.TestCheckResourceAttr("data.outscale_snapshot.snapshot", "volume_size", "1"), - ), - }, - }, - }) -} + resource.TestCheckResourceAttrSet(dataSourcesName, "snapshots.#"), -func TestAccOutscaleOAPISnapshotDataSource_multipleFilters(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPISnapshotDataSourceConfigWithMultipleFilters(region), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISnapshotDataSourceID("data.outscale_snapshot.snapshot"), - resource.TestCheckResourceAttr("data.outscale_snapshot.snapshot", "volume_size", "10"), + resource.TestCheckResourceAttr(dataSourceName, "volume_size", "1"), ), }, }, }) } -func testAccCheckOutscaleOAPISnapshotDataSourceID(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find snapshot data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Snapshot data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPISnapshotDataSourceConfig(region string) string { +func testAcc_Snapshot_DataSource_Config(region string) string { return fmt.Sprintf(` resource "outscale_volume" "example" { subregion_name = "%sa" @@ -69,32 +37,28 @@ func testAccCheckOutscaleOAPISnapshotDataSourceConfig(region string) string { } resource "outscale_snapshot" "snapshot" { - volume_id = "${outscale_volume.example.id}" + volume_id = outscale_volume.example.id } data "outscale_snapshot" "snapshot" { - snapshot_id = "${outscale_snapshot.snapshot.id}" - } - `, region) -} - -func testAccCheckOutscaleOAPISnapshotDataSourceConfigWithMultipleFilters(region string) string { - return fmt.Sprintf(` - resource "outscale_volume" "external1" { - subregion_name = "%sa" - size = 10 - } - - resource "outscale_snapshot" "snapshot" { - volume_id = "${outscale_volume.external1.id}" + filter { + name = "volume_ids" + values = [outscale_snapshot.snapshot.volume_id] + } + filter { + name = "volume_sizes" + values = [outscale_snapshot.snapshot.volume_size] + } } - data "outscale_snapshot" "snapshot" { - snapshot_id = "${outscale_snapshot.snapshot.id}" - + data "outscale_snapshots" "snapshot" { + filter { + name = "volume_ids" + values = [outscale_snapshot.snapshot.volume_id] + } filter { name = "volume_sizes" - values = ["10"] + values = [outscale_snapshot.snapshot.volume_size] } } `, region) diff --git a/outscale/data_source_outscale_snapshots_test.go b/outscale/data_source_outscale_snapshots_test.go deleted file mode 100644 index e7d3e7504..000000000 --- a/outscale/data_source_outscale_snapshots_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPISnapshotsDataSource_basic(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPISnapshotsDataSourceConfig, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_snapshots.outscale_snapshots", "snapshots.#", "1"), - ), - }, - }, - }) -} - -const testAccCheckOutscaleOAPISnapshotsDataSourceConfig = ` - resource "outscale_volume" "example" { - subregion_name = "eu-west-2a" - size = 1 - } - - resource "outscale_snapshot" "snapshot" { - volume_id = "${outscale_volume.example.id}" - } - - data "outscale_snapshots" "outscale_snapshots" { - snapshot_id = ["${outscale_snapshot.snapshot.id}"] - } -` From 6712e04af494d786b18b7e3a5fee8d1e34489af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:14 +0000 Subject: [PATCH 54/82] Improve subnet datasource --- outscale/data_source_outscale_subnet.go | 19 +++---------------- outscale/data_source_outscale_subnets.go | 22 +--------------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/outscale/data_source_outscale_subnet.go b/outscale/data_source_outscale_subnet.go index 90b86ed58..ce02193f4 100644 --- a/outscale/data_source_outscale_subnet.go +++ b/outscale/data_source_outscale_subnet.go @@ -31,7 +31,6 @@ func dataSourceOutscaleOAPISubnet() *schema.Resource { }, "subnet_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "state": { @@ -61,16 +60,8 @@ func dataSourceOutscaleOAPISubnet() *schema.Resource { func dataSourceOutscaleOAPISubnetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadSubnetsRequest{} - - if id := d.Get("subnet_id"); id != "" { - req.Filters = &oscgo.FiltersSubnet{SubnetIds: &[]string{id.(string)}} - } - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPISubnetDataSourceFilters(filters.(*schema.Set)) } @@ -91,12 +82,8 @@ func dataSourceOutscaleOAPISubnetRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("[DEBUG] Error reading Subnet (%s)", errString) } - if len(resp.GetSubnets()) == 0 { - return fmt.Errorf("no matching subnet found") - } - - if len(resp.GetSubnets()) > 1 { - return fmt.Errorf("multiple subnets matched; use additional constraints to reduce matches to a single subnet") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetSubnets()), "Subnet"); err != nil { + return err } subnet := resp.GetSubnets()[0] diff --git a/outscale/data_source_outscale_subnets.go b/outscale/data_source_outscale_subnets.go index da058afd7..456dcfe90 100644 --- a/outscale/data_source_outscale_subnets.go +++ b/outscale/data_source_outscale_subnets.go @@ -18,13 +18,6 @@ func dataSourceOutscaleOAPISubnets() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "subnet_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "subnets": { Type: schema.TypeList, Computed: true, @@ -74,20 +67,8 @@ func dataSourceOutscaleOAPISubnets() *schema.Resource { func dataSourceOutscaleOAPISubnetsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - req := oscgo.ReadSubnetsRequest{} - - if id := d.Get("subnet_ids"); id != "" { - var ids []string - for _, v := range id.([]interface{}) { - ids = append(ids, v.(string)) - } - req.SetFilters(oscgo.FiltersSubnet{SubnetIds: &ids}) - } - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { req.Filters = buildOutscaleOAPISubnetDataSourceFilters(filters.(*schema.Set)) } @@ -106,7 +87,6 @@ func dataSourceOutscaleOAPISubnetsRead(d *schema.ResourceData, meta interface{}) if err != nil { errString = err.Error() - return fmt.Errorf("[DEBUG] Error reading Subnet (%s)", errString) } From de8005754958e7f284af38ca185fd3bf90ba0213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:15 +0000 Subject: [PATCH 55/82] Merge subnet datasource testacc --- outscale/data_source_outscale_subnet_test.go | 125 +++++------------- outscale/data_source_outscale_subnets_test.go | 111 ---------------- 2 files changed, 34 insertions(+), 202 deletions(-) delete mode 100644 outscale/data_source_outscale_subnets_test.go diff --git a/outscale/data_source_outscale_subnet_test.go b/outscale/data_source_outscale_subnet_test.go index 754ada1c9..0ff2ffad0 100644 --- a/outscale/data_source_outscale_subnet_test.go +++ b/outscale/data_source_outscale_subnet_test.go @@ -2,108 +2,38 @@ package outscale import ( "fmt" + "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccDataSourceOutscaleOAPISubnet(t *testing.T) { +func TestAcc_Subnets_DataSource(t *testing.T) { t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPISubnetConfig, - Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_id"), - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_filter"), - ), - }, - }, - }) -} + region := fmt.Sprintf("%sa", os.Getenv("OUTSCALE_REGION")) + dataSourcesName := "data.outscale_subnets.subnets" + dataSourceName := "data.outscale_subnet.subnet" -func TestAccDataSourceOutscaleOAPISubnet_withAvailableIpsCountsFilter(t *testing.T) { - t.Parallel() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter(), + Config: testAcc_Subnet_DataSource_Config(region), Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPISubnetCheck("data.outscale_subnet.by_filter"), + resource.TestCheckResourceAttrSet(dataSourceName, "subnet_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "ip_range"), + + resource.TestCheckResourceAttr(dataSourcesName, "subnets.#", "2"), ), }, }, }) } -func testAccDataSourceOutscaleOAPISubnetCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - subnetRs, ok := s.RootModule().Resources["outscale_subnet.outscale_subnet"] - if !ok { - return fmt.Errorf("can't find outscale_subnet.outscale_subnet in state") - } - - attr := rs.Primary.Attributes - - if attr["id"] != subnetRs.Primary.Attributes["id"] { - return fmt.Errorf( - "id is %s; want %s", - attr["id"], - subnetRs.Primary.Attributes["id"], - ) - } - - if attr["ip_range"] != "10.0.0.0/16" { - return fmt.Errorf("bad ip_range %s", attr["ip_range"]) - } - if attr["subregion_name"] != "eu-west-2a" { - return fmt.Errorf("bad subregion_name %s", attr["subregion_name"]) - } - - return nil - } -} - -const testAccDataSourceOutscaleOAPISubnetConfig = ` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - tags { - key = "Name" - value = "testacc-subet-ds" - } - } - - resource "outscale_subnet" "outscale_subnet" { - net_id = outscale_net.outscale_net.net_id - ip_range = "10.0.0.0/16" - subregion_name = "eu-west-2a" - } - - data "outscale_subnet" "by_id" { - subnet_id = outscale_subnet.outscale_subnet.id - } - - data "outscale_subnet" "by_filter" { - filter { - name = "subnet_ids" - values = [outscale_subnet.outscale_subnet.id] - } - } -` - -func testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter() string { - return ` - resource "outscale_net" "outscale_net" { +func testAcc_Subnet_DataSource_Config(region string) string { + return fmt.Sprintf(` + resource "outscale_net" "net" { ip_range = "10.0.0.0/16" tags { key = "Name" @@ -111,17 +41,30 @@ func testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter() string { } } - resource "outscale_subnet" "outscale_subnet" { - subregion_name = "eu-west-2a" - ip_range = "10.0.0.0/16" - net_id = outscale_net.outscale_net.net_id + resource "outscale_subnet" "sub1" { + subregion_name = "%[1]s" + ip_range = "10.0.1.0/24" + net_id = outscale_net.net.net_id + } + + resource "outscale_subnet" "sub2" { + subregion_name = "%[1]s" + ip_range = "10.0.2.0/24" + net_id = outscale_net.net.net_id + } + + data "outscale_subnet" "subnet" { + filter { + name = "subnet_ids" + values = [outscale_subnet.sub1.id] + } } - data "outscale_subnet" "by_filter" { + data "outscale_subnets" "subnets" { filter { - name = "available_ips_counts" - values = [outscale_subnet.outscale_subnet.available_ips_count] + name = "net_ids" + values = [outscale_subnet.sub1.net_id, outscale_subnet.sub2.net_id] } } - ` + `, region) } diff --git a/outscale/data_source_outscale_subnets_test.go b/outscale/data_source_outscale_subnets_test.go deleted file mode 100644 index 9ae22955e..000000000 --- a/outscale/data_source_outscale_subnets_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccDataSourceOutscaleOAPISubnets(t *testing.T) { - t.Parallel() - rInt := utils.RandIntRange(16, 31) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPISubnetsConfig(rInt), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.outscale_subnets.by_filter", "subnets.#", "1"), - ), - }, - }, - }) -} - -func TestAccDataSourceOutscaleOAPISubnets_withAvailableIpsCountsFilter(t *testing.T) { - t.Parallel() - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPISubnetsWithAvailableIpsCountsFilter(), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPISubnetsConfig(rInt int) string { - return fmt.Sprintf(` - resource "outscale_net" "net" { - ip_range = "172.%[1]d.123.0/24" - - tags { - key = "Name" - value = "testacc-subets-ds" - } - } - - resource "outscale_subnet" "subnet" { - ip_range = "172.%[1]d.123.0/24" - subregion_name = "eu-west-2a" - net_id = "${outscale_net.net.id}" - - tags { - key = "name" - value = "terraform-subnet" - } - } - - data "outscale_subnets" "by_filter" { - filter { - name = "subnet_ids" - values = ["${outscale_subnet.subnet.id}"] - } - } - `, rInt) -} - -func testAccDataSourceOutscaleOAPISubnetsWithAvailableIpsCountsFilter() string { - return ` - resource "outscale_net" "outscale_net1" { - ip_range = "10.0.0.0/16" - tags { - key = "Name" - value = "Net1" - } - } - - resource "outscale_net" "outscale_net2" { - ip_range = "10.0.0.0/16" - tags { - key = "Name" - value = "Net1" - } - } - - resource "outscale_subnet" "sub1" { - subregion_name = "eu-west-2a" - ip_range = "10.0.0.0/16" - net_id = outscale_net.outscale_net1.net_id - } - - resource "outscale_subnet" "sub2" { - subregion_name = "eu-west-2a" - ip_range = "10.0.0.0/16" - net_id = outscale_net.outscale_net2.net_id - } - - - data "outscale_subnets" "by_filter" { - filter { - name = "available_ips_counts" - values = ["${outscale_subnet.sub1.available_ips_count}", "${outscale_subnet.sub2.available_ips_count}"] - } - } - ` -} From 47bf5f916c75d5ef441b9ea522e27fbb6c2d2a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:20 +0000 Subject: [PATCH 56/82] Improve tag datasource --- outscale/data_source_outscale_tag.go | 23 ++++++----------------- outscale/data_source_outscale_tags.go | 20 +++++++++----------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/outscale/data_source_outscale_tag.go b/outscale/data_source_outscale_tag.go index d795a4012..62a491118 100644 --- a/outscale/data_source_outscale_tag.go +++ b/outscale/data_source_outscale_tag.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -40,21 +39,16 @@ func dataSourceOutscaleOAPITag() *schema.Resource { func dataSourceOutscaleOAPITagRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - // Build up search parameters - params := oscgo.ReadTagsRequest{} - - filters, filtersOk := d.GetOk("filter") - - if filtersOk { - params.SetFilters(oapiBuildOutscaleDataSourceFilters(filters.(*schema.Set))) + req := oscgo.ReadTagsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(oapiBuildOutscaleDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadTagsResponse var err error err = resource.Retry(60*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.TagApi.ReadTags(context.Background()).ReadTagsRequest(params).Execute() + rp, httpResp, err := conn.TagApi.ReadTags(context.Background()).ReadTagsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -66,13 +60,8 @@ func dataSourceOutscaleOAPITagRead(d *schema.ResourceData, meta interface{}) err return err } - if len(resp.GetTags()) < 1 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - - if len(resp.GetTags()) > 1 { - return fmt.Errorf("your query returned more than one result, Please try a more " + - "specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetTags()), "Tag"); err != nil { + return err } tag := resp.GetTags()[0] diff --git a/outscale/data_source_outscale_tags.go b/outscale/data_source_outscale_tags.go index e85915801..03c05770c 100644 --- a/outscale/data_source_outscale_tags.go +++ b/outscale/data_source_outscale_tags.go @@ -2,6 +2,7 @@ package outscale import ( "context" + "errors" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -46,31 +47,28 @@ func dataSourceOutscaleOAPITags() *schema.Resource { func dataSourceOutscaleOAPITagsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - // Build up search parameters - params := oscgo.ReadTagsRequest{} - filters, filtersOk := d.GetOk("filter") - - if filtersOk { - params.SetFilters(oapiBuildOutscaleDataSourceFilters(filters.(*schema.Set))) + req := oscgo.ReadTagsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(oapiBuildOutscaleDataSourceFilters(filters.(*schema.Set))) } - var resp oscgo.ReadTagsResponse var err error - err = resource.Retry(60*time.Second, func() *resource.RetryError { - rp, httpResp, err := conn.TagApi.ReadTags(context.Background()).ReadTagsRequest(params).Execute() + rp, httpResp, err := conn.TagApi.ReadTags(context.Background()).ReadTagsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } resp = rp return nil }) - if err != nil { return err } + if len(resp.GetTags()) < 1 { + return errors.New("Your query returned no results. Please change your search criteria and try again") + } + if err := d.Set("tags", oapiTagsDescToList(resp.GetTags())); err != nil { return err } From 29d9917f66d3f05645ac4b29334843a093d1ce88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:21 +0000 Subject: [PATCH 57/82] Merge tag datasource testacc --- outscale/data_source_outscale_tag_test.go | 49 ++++++++++++---------- outscale/data_source_outscale_tags_test.go | 31 -------------- 2 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 outscale/data_source_outscale_tags_test.go diff --git a/outscale/data_source_outscale_tag_test.go b/outscale/data_source_outscale_tag_test.go index 9a3fcfe2d..3ad7c3666 100644 --- a/outscale/data_source_outscale_tag_test.go +++ b/outscale/data_source_outscale_tag_test.go @@ -2,28 +2,27 @@ package outscale import ( "fmt" - "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPITagDataSource(t *testing.T) { - omi := os.Getenv("OUTSCALE_IMAGEID") +func TestAcc_Tag_DataSource(t *testing.T) { + dataSourceName := "data.outscale_tag.vg" + dataSourcesName := "data.outscale_tags.vg" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOAPITagDataSourceConfig(omi, "tinav4.c2r2p2"), + Config: testAcc_Tag_DataSource_Config(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "data.outscale_tag.web", "key", "Name"), - resource.TestCheckResourceAttr( - "data.outscale_tag.web", "value", "test-vm"), - resource.TestCheckResourceAttr( - "data.outscale_tag.web", "resource_type", "vm"), + resource.TestCheckResourceAttr(dataSourceName, "key", "name"), + resource.TestCheckResourceAttr(dataSourceName, "value", "test acc"), + resource.TestCheckResourceAttr(dataSourceName, "resource_type", "virtual-private-gateway"), + + resource.TestCheckResourceAttrSet(dataSourcesName, "tags.#"), ), }, }, @@ -31,24 +30,28 @@ func TestAccOutscaleOAPITagDataSource(t *testing.T) { } // Lookup based on InstanceID -func testAccOAPITagDataSourceConfig(omi, vmType string) string { +func testAcc_Tag_DataSource_Config() string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - - tags { - key = "Name" - value = "test-vm" - } + resource "outscale_virtual_gateway" "vg" { + connection_type = "ipsec.1" + + tags { + key = "name" + value = "test acc" } + } - data "outscale_tag" "web" { + data "outscale_tag" "vg" { filter { name = "resource_ids" - values = [outscale_vm.basic.id] + values = [outscale_virtual_gateway.vg.id] + } + } + data "outscale_tags" "vg" { + filter { + name = "resource_type" + values = [outscale_virtual_gateway.vg.id] } } - `, omi, vmType) + `) } diff --git a/outscale/data_source_outscale_tags_test.go b/outscale/data_source_outscale_tags_test.go deleted file mode 100644 index 2f378531e..000000000 --- a/outscale/data_source_outscale_tags_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package outscale - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPITagsDataSource_basic(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOAPITagsDataSourceConfig(), - }, - }, - }) -} - -// Lookup based on InstanceID -func testAccOAPITagsDataSourceConfig() string { - return ` - data "outscale_tags" "web" { - filter { - name = "resource_type" - values = ["instance"] - } - } - ` -} From 7ecb7a528cfce1dab9e0a42ddf3f645a46542fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:32 +0000 Subject: [PATCH 58/82] Improve virtual_gateway datasource --- .../data_source_outscale_virtual_gateway.go | 36 +++++-------------- .../data_source_outscale_virtual_gateways.go | 26 ++++---------- 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/outscale/data_source_outscale_virtual_gateway.go b/outscale/data_source_outscale_virtual_gateway.go index c9bda9ede..635671212 100644 --- a/outscale/data_source_outscale_virtual_gateway.go +++ b/outscale/data_source_outscale_virtual_gateway.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -22,17 +21,14 @@ func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { "filter": dataSourceFiltersSchema(), "virtual_gateway_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, "state": { Type: schema.TypeString, - Optional: true, Computed: true, }, "connection_type": { Type: schema.TypeString, - Optional: true, Computed: true, }, "net_to_virtual_gateway_links": { @@ -62,29 +58,16 @@ func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { func dataSourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - virtualId, vpnOk := d.GetOk("virtual_gateway_id") - - if !filtersOk && !vpnOk { - return fmt.Errorf("One of virtual_gateway_id or filter must be assigned") - } - - params := oscgo.ReadVirtualGatewaysRequest{} - - if vpnOk { - params.SetFilters(oscgo.FiltersVirtualGateway{VirtualGatewayIds: &[]string{virtualId.(string)}}) - } - - if filtersOk { - params.SetFilters(buildOutscaleAPIVirtualGatewayFilters(filters.(*schema.Set))) + req := oscgo.ReadVirtualGatewaysRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleAPIVirtualGatewayFilters(filters.(*schema.Set))) } var resp oscgo.ReadVirtualGatewaysResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VirtualGatewayApi.ReadVirtualGateways(context.Background()).ReadVirtualGatewaysRequest(params).Execute() + rp, httpResp, err := conn.VirtualGatewayApi.ReadVirtualGateways(context.Background()).ReadVirtualGatewaysRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -95,13 +78,10 @@ func dataSourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta inter if err != nil { return err } - if resp.GetVirtualGateways() == nil || len(resp.GetVirtualGateways()) == 0 { - return fmt.Errorf("no matching virtual gateway found: %#v", params) - } - if len(resp.GetVirtualGateways()) > 1 { - return fmt.Errorf("multiple virtual gateways matched; use additional constraints to reduce matches to a single virtual gateway") - } + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetVirtualGateways()), "Virtual Gateway"); err != nil { + return err + } vgw := resp.GetVirtualGateways()[0] d.SetId(vgw.GetVirtualGatewayId()) @@ -115,7 +95,7 @@ func dataSourceOutscaleOAPIVirtualGatewayRead(d *schema.ResourceData, meta inter vs[k] = vp } - + d.Set("virtual_gateway_id", vgw.GetVirtualGatewayId()) d.Set("net_to_virtual_gateway_links", vs) d.Set("state", aws.StringValue(vgw.State)) d.Set("connection_type", vgw.ConnectionType) diff --git a/outscale/data_source_outscale_virtual_gateways.go b/outscale/data_source_outscale_virtual_gateways.go index f79f8cc0d..d2cfb7ea3 100644 --- a/outscale/data_source_outscale_virtual_gateways.go +++ b/outscale/data_source_outscale_virtual_gateways.go @@ -17,12 +17,6 @@ func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "virtual_gateway_id": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "virtual_gateways": { Type: schema.TypeList, Computed: true, @@ -70,25 +64,17 @@ func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { func dataSourceOutscaleOAPIVirtualGatewaysRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI + req := oscgo.ReadVirtualGatewaysRequest{} - filter, filtersOk := d.GetOk("filter") - _, vpnOk := d.GetOk("virtual_gateway_id") - - if !filtersOk && !vpnOk { - return fmt.Errorf("One of virtual_gateway_id or filter must be assigned") - } - - params := oscgo.ReadVirtualGatewaysRequest{} - - if filtersOk { - params.SetFilters(buildOutscaleAPIVirtualGatewayFilters(filter.(*schema.Set))) + if filter, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleAPIVirtualGatewayFilters(filter.(*schema.Set))) } var resp oscgo.ReadVirtualGatewaysResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VirtualGatewayApi.ReadVirtualGateways(context.Background()).ReadVirtualGatewaysRequest(params).Execute() + rp, httpResp, err := conn.VirtualGatewayApi.ReadVirtualGateways(context.Background()).ReadVirtualGatewaysRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -99,8 +85,8 @@ func dataSourceOutscaleOAPIVirtualGatewaysRead(d *schema.ResourceData, meta inte if err != nil { return err } - if resp.GetVirtualGateways() == nil || len(resp.GetVirtualGateways()) == 0 { - return fmt.Errorf("no matching VPN gateway found: %#v", params) + if !resp.HasVirtualGateways() || len(resp.GetVirtualGateways()) < 1 { + return fmt.Errorf("your query returned no results, please change your search criteria and try again") } vpns := make([]map[string]interface{}, len(resp.GetVirtualGateways())) From 23551b2a3c0e6ee4584f9b267c4c51ff1940a312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:33 +0000 Subject: [PATCH 59/82] Merge virtual_gateway datasource testacc --- ...ta_source_outscale_virtual_gateway_test.go | 31 ++++++++------- ...a_source_outscale_virtual_gateways_test.go | 39 ------------------- 2 files changed, 18 insertions(+), 52 deletions(-) delete mode 100644 outscale/data_source_outscale_virtual_gateways_test.go diff --git a/outscale/data_source_outscale_virtual_gateway_test.go b/outscale/data_source_outscale_virtual_gateway_test.go index 6396d1ae5..a889c5a9a 100644 --- a/outscale/data_source_outscale_virtual_gateway_test.go +++ b/outscale/data_source_outscale_virtual_gateway_test.go @@ -4,14 +4,13 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIVirtualGateway_unattached(t *testing.T) { - //t.Skip() +func TestAcc_VirtualGateway_DataSource(t *testing.T) { t.Parallel() - rInt := acctest.RandInt() + dataSourceName := "data.outscale_virtual_gateway.vg" + dataSourcesName := "data.outscale_virtual_gateways.vgs" resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -20,27 +19,33 @@ func TestAccDataSourceOutscaleOAPIVirtualGateway_unattached(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVirtualGatewayUnattachedConfig(rInt), + Config: testAcc_VirtualGateway_DataSource_Config(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair( - "data.outscale_virtual_gateway.test_by_id", "id", - "outscale_virtual_gateway.unattached", "id"), - resource.TestCheckResourceAttrSet("data.outscale_virtual_gateway.test_by_id", "state"), - resource.TestCheckNoResourceAttr("data.outscale_virtual_gateway.test_by_id", "attached_vpc_id"), + resource.TestCheckResourceAttr(dataSourcesName, "virtual_gateways.#", "1"), + resource.TestCheckResourceAttrSet(dataSourceName, "virtual_gateway_id"), ), }, }, }) } -func testAccDataSourceOutscaleOAPIVirtualGatewayUnattachedConfig(rInt int) string { +func testAcc_VirtualGateway_DataSource_Config() string { return fmt.Sprintf(` resource "outscale_virtual_gateway" "unattached" { connection_type = "ipsec.1" } - data "outscale_virtual_gateway" "test_by_id" { - virtual_gateway_id = "${outscale_virtual_gateway.unattached.id}" + data "outscale_virtual_gateway" "vg" { + filter { + name = "virtual_gateway_ids" + values = [outscale_virtual_gateway.unattached.id] + } + } + data "outscale_virtual_gateways" "vgs" { + filter { + name = "virtual_gateway_ids" + values = [outscale_virtual_gateway.unattached.id] + } } `) } diff --git a/outscale/data_source_outscale_virtual_gateways_test.go b/outscale/data_source_outscale_virtual_gateways_test.go deleted file mode 100644 index adee51913..000000000 --- a/outscale/data_source_outscale_virtual_gateways_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIVpnGateways_unattached(t *testing.T) { - //t.Skip() - t.Parallel() - rInt := acctest.RandInt() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIVpnGatewaysUnattachedConfig(rInt), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIVpnGatewaysUnattachedConfig(rInt int) string { - return fmt.Sprintf(` - resource "outscale_virtual_gateway" "unattached" { - connection_type = "ipsec.1" - } - - data "outscale_virtual_gateways" "test_by_id" { - virtual_gateway_id = ["${outscale_virtual_gateway.unattached.id}"] - } - `) -} From 76351787e2ae5ccc7b77864772cb3266fe4d5d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:38 +0000 Subject: [PATCH 60/82] Improve vm datasource --- outscale/data_source_outscale_vm.go | 36 ++++++---------------------- outscale/data_source_outscale_vms.go | 21 ++++------------ 2 files changed, 11 insertions(+), 46 deletions(-) diff --git a/outscale/data_source_outscale_vm.go b/outscale/data_source_outscale_vm.go index 6942f7ced..d3aaa0d2d 100644 --- a/outscale/data_source_outscale_vm.go +++ b/outscale/data_source_outscale_vm.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "errors" "fmt" "log" "time" @@ -23,26 +22,13 @@ func dataSourceOutscaleOAPIVM() *schema.Resource { func dataSourceOutscaleOAPIVMRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - instanceID, instanceIDOk := d.GetOk("vm_id") - - if !filtersOk && !instanceIDOk { - return fmt.Errorf("One of filters, or instance_id must be assigned") - } - // Build up search parameters - params := oscgo.ReadVmsRequest{} - if filtersOk { - params.Filters = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) - } - if instanceIDOk { - params.Filters.VmIds = &[]string{instanceID.(string)} + req := oscgo.ReadVmsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) } - - log.Printf("[DEBUG] ReadVmsRequest -> %+v\n", params) - var resp oscgo.ReadVmsResponse err := resource.Retry(30*time.Second, func() *resource.RetryError { - rp, httpResp, err := client.VmApi.ReadVms(context.Background()).ReadVmsRequest(params).Execute() + rp, httpResp, err := client.VmApi.ReadVms(context.Background()).ReadVmsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -68,15 +54,9 @@ func dataSourceOutscaleOAPIVMRead(d *schema.ResourceData, meta interface{}) erro } var vm oscgo.Vm - if len(filteredVms) < 1 { - return errors.New("Your query returned no results. Please change your search criteria and try again") - } - - if len(filteredVms) > 1 { - return errors.New("Your query returned more than one result. Please try a more " + - "specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(filteredVms), "Vm"); err != nil { + return err } - vm = filteredVms[0] // Populate vm attribute fields with the returned vm @@ -305,7 +285,7 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { }, "device_name": { Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, @@ -438,12 +418,10 @@ func getOApiVMAttributesSchema() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - "is_source_dest_checked": { Type: schema.TypeBool, Computed: true, }, - "subnet_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_vms.go b/outscale/data_source_outscale_vms.go index cd1ec795d..683ba9a25 100644 --- a/outscale/data_source_outscale_vms.go +++ b/outscale/data_source_outscale_vms.go @@ -64,26 +64,13 @@ func datasourceOutscaleOApiVMSSchema() map[string]*schema.Schema { func dataSourceOutscaleOApiVMSRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - vmID, vmIDOk := d.GetOk("vm_id") - - if !filtersOk && !vmIDOk { - return fmt.Errorf("One of filters, and vm ID must be assigned") - } - - // Build up search parameters - params := oscgo.ReadVmsRequest{} - if filtersOk { - params.Filters = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) - } - if vmIDOk { - params.Filters.VmIds = &[]string{vmID.(string)} + req := oscgo.ReadVmsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOAPIDataSourceVMFilters(filters.(*schema.Set)) } - var resp oscgo.ReadVmsResponse err := resource.Retry(30*time.Second, func() *resource.RetryError { - rp, httpResp, err := client.VmApi.ReadVms(context.Background()).ReadVmsRequest(params).Execute() + rp, httpResp, err := client.VmApi.ReadVms(context.Background()).ReadVmsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 9a7d2787cbd3ecd43d30bf6d35eafb67fcd6cddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:38 +0000 Subject: [PATCH 61/82] Merge vm datasource testacc --- outscale/data_source_outscale_vm_test.go | 81 ++++++++++++++--------- outscale/data_source_outscale_vms_test.go | 46 ------------- 2 files changed, 48 insertions(+), 79 deletions(-) delete mode 100644 outscale/data_source_outscale_vms_test.go diff --git a/outscale/data_source_outscale_vm_test.go b/outscale/data_source_outscale_vm_test.go index 468dfd50d..df7dc50ac 100644 --- a/outscale/data_source_outscale_vm_test.go +++ b/outscale/data_source_outscale_vm_test.go @@ -8,61 +8,76 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccOutscaleOAPIVMDataSource_basic(t *testing.T) { +func TestAcc_VM_DataSource(t *testing.T) { t.Parallel() omi := os.Getenv("OUTSCALE_IMAGEID") - datasourcceName := "data.outscale_vm.basic_web" - + vmType := "tinav4.c2r2p2" + dataSourceVmName := "data.outscale_vm.vm" + dataSourcesVmName := "data.outscale_vms.vms" + dataSourceVmStateName := "data.outscale_vm_state.state" + dataSourcesVmStateName := "data.outscale_vm_states.state" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOAPIVMDataSourceConfig(omi, "tinav4.c2r2p2"), + Config: testAcc_VM_DataSource_Config(omi, vmType), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(datasourcceName, "image_id", omi), - resource.TestCheckResourceAttr(datasourcceName, "vm_type", "tinav4.c2r2p2"), - resource.TestCheckResourceAttr(datasourcceName, "tags.#", "1"), + resource.TestCheckResourceAttr(dataSourceVmName, "image_id", omi), + resource.TestCheckResourceAttr(dataSourceVmName, "vm_type", vmType), + resource.TestCheckResourceAttr(dataSourceVmName, "tags.#", "1"), + + resource.TestCheckResourceAttr(dataSourcesVmName, "vms.0.image_id", omi), + resource.TestCheckResourceAttr(dataSourcesVmName, "vms.0.vm_type", vmType), + + resource.TestCheckResourceAttrSet(dataSourceVmStateName, "vm_id"), + + resource.TestCheckResourceAttr(dataSourcesVmStateName, "vm_states.#", "1"), ), }, }, }) } -func testAccOAPIVMDataSourceConfig(omi, vmType string) string { +func testAcc_VM_DataSource_Config(omi, vmType string) string { return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" + resource "outscale_vm" "basic" { + image_id = "%s" + vm_type = "%s" + keypair_name = "terraform-basic" - tags { - key = "Name" - value = "testacc-vm-ds" - } + tags { + key = "name" + value = "test acc" } + } - resource "outscale_subnet" "outscale_subnet" { - net_id = outscale_net.outscale_net.net_id - ip_range = "10.0.0.0/24" - subregion_name = "eu-west-2a" + data "outscale_vms" "vms" { + filter { + name = "vm_ids" + values = [outscale_vm.basic.id] } + } + + data "outscale_vm" "vm" { + filter { + name = "vm_ids" + values = [outscale_vm.basic.id] + } + } - resource "outscale_vm" "outscale_vm" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - subnet_id = outscale_subnet.outscale_subnet.subnet_id - - tags { - key = "name" - value = "Terraform-VM" - } + data "outscale_vm_state" "state" { + filter { + name = "vm_ids" + values = [outscale_vm.basic.id] } + } - data "outscale_vm" "basic_web" { - filter { - name = "vm_ids" - values = [outscale_vm.outscale_vm.vm_id] - } + data "outscale_vm_states" "state" { + filter { + name = "vm_ids" + values = [outscale_vm.basic.id] } + } `, omi, vmType) } diff --git a/outscale/data_source_outscale_vms_test.go b/outscale/data_source_outscale_vms_test.go deleted file mode 100644 index 151c397dc..000000000 --- a/outscale/data_source_outscale_vms_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPIVMSDataSource_basic(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOAPIVMSDataSourceConfig(omi, "tinav4.c2r2p2"), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "data.outscale_vms.basic_web", "vms.0.image_id", omi), - resource.TestCheckResourceAttr( - "data.outscale_vms.basic_web", "vms.0.vm_type", "tinav4.c2r2p2"), - ), - }, - }, - }) -} - -func testAccOAPIVMSDataSourceConfig(omi, vmType string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - } - - data "outscale_vms" "basic_web" { - filter { - name = "vm_ids" - values = [outscale_vm.basic.id] - } - }`, omi, vmType) -} From 4f1fe43a7748242a0df0f387d1f924090380b2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:50 +0000 Subject: [PATCH 62/82] Improve volume datasource --- outscale/data_source_outscale_volume.go | 44 ++++++------------------ outscale/data_source_outscale_volumes.go | 31 ++--------------- 2 files changed, 13 insertions(+), 62 deletions(-) diff --git a/outscale/data_source_outscale_volume.go b/outscale/data_source_outscale_volume.go index bfcc16806..f8fcedf69 100644 --- a/outscale/data_source_outscale_volume.go +++ b/outscale/data_source_outscale_volume.go @@ -2,14 +2,12 @@ package outscale import ( "context" - "fmt" "log" "time" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/spf13/cast" - "github.com/davecgh/go-spew/spew" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-outscale/utils" @@ -82,11 +80,11 @@ func datasourceOutscaleOAPIVolume() *schema.Resource { "tags": dataSourceTagsSchema(), "volume_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "request_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, }, } @@ -95,25 +93,17 @@ func datasourceOutscaleOAPIVolume() *schema.Resource { func datasourceOAPIVolumeRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - filters, filtersOk := d.GetOk("filter") - volumeIds, VolumeIdsOk := d.GetOk("volume_id") - - params := oscgo.ReadVolumesRequest{ - Filters: &oscgo.FiltersVolume{}, - } - if VolumeIdsOk { - params.Filters.SetVolumeIds([]string{volumeIds.(string)}) - } + req := oscgo.ReadVolumesRequest{} - if filtersOk { - params.SetFilters(buildOutscaleOSCAPIDataSourceVolumesFilters(filters.(*schema.Set))) + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOSCAPIDataSourceVolumesFilters(filters.(*schema.Set))) } var resp oscgo.ReadVolumesResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VolumeApi.ReadVolumes(context.Background()).ReadVolumesRequest(params).Execute() + rp, httpResp, err := conn.VolumeApi.ReadVolumes(context.Background()).ReadVolumesRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -124,26 +114,12 @@ func datasourceOAPIVolumeRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } + volumes := resp.GetVolumes() - log.Printf("Found These Volumes %s", spew.Sdump(resp.Volumes)) - - filteredVolumes := resp.GetVolumes()[:] - - var volume oscgo.Volume - if len(filteredVolumes) < 1 { - return fmt.Errorf("your query returned no results, please change your search criteria and try again") - } - - if len(filteredVolumes) > 1 { - return fmt.Errorf("your query returned more than one result, please try a more " + - "specific search criteria") + if err = utils.IsResponseEmptyOrMutiple(len(volumes), "Access Key"); err != nil { + return err } - - // Query returned single result. - volume = filteredVolumes[0] - log.Printf("[DEBUG] outscale_volume - Single Volume found: %s", volume.GetVolumeId()) - return volumeOAPIDescriptionAttributes(d, &volume) - + return volumeOAPIDescriptionAttributes(d, &volumes[0]) } func volumeOAPIDescriptionAttributes(d *schema.ResourceData, volume *oscgo.Volume) error { diff --git a/outscale/data_source_outscale_volumes.go b/outscale/data_source_outscale_volumes.go index 87ab838af..ef6d02148 100644 --- a/outscale/data_source_outscale_volumes.go +++ b/outscale/data_source_outscale_volumes.go @@ -3,13 +3,11 @@ package outscale import ( "context" "fmt" - "log" "time" oscgo "github.com/outscale/osc-sdk-go/v2" "github.com/terraform-providers/terraform-provider-outscale/utils" - "github.com/davecgh/go-spew/spew" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -20,10 +18,6 @@ func datasourceOutscaleOAPIVolumes() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "volume_id": { - Type: schema.TypeString, - Optional: true, - }, "volumes": { Type: schema.TypeList, Computed: true, @@ -95,7 +89,7 @@ func datasourceOutscaleOAPIVolumes() *schema.Resource { }, "request_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, }, } @@ -103,26 +97,11 @@ func datasourceOutscaleOAPIVolumes() *schema.Resource { func datasourceOAPIVolumesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI + params := oscgo.ReadVolumesRequest{} - filters, filtersOk := d.GetOk("filter") - volumeIds, volumeIdsOk := d.GetOk("volume_id") - params := oscgo.ReadVolumesRequest{ - Filters: &oscgo.FiltersVolume{}, - } - - if volumeIdsOk { - volIDs := utils.InterfaceSliceToStringSlice(volumeIds.([]interface{})) - filter := oscgo.FiltersVolume{} - filter.SetVolumeIds(volIDs) - params.SetFilters(filter) - } - - if filtersOk { + if filters, filtersOk := d.GetOk("filter"); filtersOk { params.SetFilters(buildOutscaleOSCAPIDataSourceVolumesFilters(filters.(*schema.Set))) } - - log.Printf("LOG____ params: %#+v\n", params.GetFilters()) - var resp oscgo.ReadVolumesResponse var err error @@ -137,15 +116,11 @@ func datasourceOAPIVolumesRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } - - log.Printf("Found These Volumes %s", spew.Sdump(resp.GetVolumes())) - volumes := resp.GetVolumes() if len(volumes) < 1 { return fmt.Errorf("your query returned no results, please change your search criteria and try again") } - if err := d.Set("volumes", getOAPIVolumes(volumes)); err != nil { return err } From a5b856db8c6811391ae80a0510c5455a5f940bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:50 +0000 Subject: [PATCH 63/82] Merge volume datasource testacc --- outscale/data_source_outscale_volume_test.go | 126 +++++------ outscale/data_source_outscale_volumes_test.go | 207 ------------------ 2 files changed, 52 insertions(+), 281 deletions(-) delete mode 100644 outscale/data_source_outscale_volumes_test.go diff --git a/outscale/data_source_outscale_volume_test.go b/outscale/data_source_outscale_volume_test.go index 66d7949eb..770815981 100644 --- a/outscale/data_source_outscale_volume_test.go +++ b/outscale/data_source_outscale_volume_test.go @@ -6,109 +6,87 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPIVolumeDataSource_basic(t *testing.T) { +func TestAcc_Volume_DataSource(t *testing.T) { t.Parallel() region := os.Getenv("OUTSCALE_REGION") - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfig(region), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volume.ebs_volume"), - resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "size", "10"), - resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "volume_type", "standard"), - ), - }, - }, - }) -} - -func TestAccOutscaleOAPIVolumeDataSource_filterByTags(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") + dataSourceName := "data.outscale_volume.volume" + dataSourcesName := "data.outscale_volumes.volumes" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfigFilterByTags(region), + Config: testAcc_Volume_DataSource_Config(region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volume.ebs_volume"), - resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "size", "10"), - resource.TestCheckResourceAttr("data.outscale_volume.ebs_volume", "volume_type", "standard"), + resource.TestCheckResourceAttr(dataSourceName, "size", "2"), + resource.TestCheckResourceAttr(dataSourceName, "volume_type", "standard"), + + resource.TestCheckResourceAttr(dataSourcesName, "volumes.#", "2"), ), }, }, }) } -func testAccCheckOutscaleOAPIVolumeDataSourceID(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Can't find Volume data source: %s", n) +func testAcc_Volume_DataSource_Config(region string) string { + return fmt.Sprintf(` + resource "outscale_volume" "vol" { + subregion_name = "%[1]sa" + volume_type = "standard" + size = 2 + + tags { + key = "Name" + value = "volume-standard-1" } + } - if rs.Primary.ID == "" { - return fmt.Errorf("Volume data source ID not set") + resource "outscale_volume" "vol2" { + subregion_name = "%[1]sa" + size = 4 +# iops = 100 +# volume_type = "io1" + volume_type = "gp2" + tags { + key = "type" + value = "io1" } - return nil } -} - -func testAccCheckOutscaleOAPIVolumeDataSourceConfig(region string) string { - return fmt.Sprintf(` - resource "outscale_volume" "example" { - subregion_name = "%sa" - volume_type = "standard" - size = 10 - tags { - key = "Name" - value = "External Volume" - } + data "outscale_volume" "volume" { + filter { + name = "tag_values" + values = ["volume-standard-1"] } - - data "outscale_volume" "ebs_volume" { - filter { - name = "volume_ids" - values = ["${outscale_volume.example.id}"] - } + filter { + name = "volume_ids" + values = [outscale_volume.vol.id] } - `, region) -} - -func testAccCheckOutscaleOAPIVolumeDataSourceConfigFilterByTags(region string) string { - return fmt.Sprintf(` - resource "outscale_volume" "example" { - subregion_name = "%sa" - volume_type = "standard" - size = 10 - - tags { - key = "Name" - value = "volume-io1-2" - } + filter { + name = "volume_sizes" + values = [outscale_volume.vol.size] } + } - data "outscale_volume" "ebs_volume" { - filter { - name = "tags" - values = ["Name=volume-io1-2"] - } + data "outscale_volumes" "volumes" { + filter { + name = "volume_ids" + values = [outscale_volume.vol.volume_id, outscale_volume.vol2.volume_id] + } - filter { - name = "volume_ids" - values = ["${outscale_volume.example.id}"] - } + filter { + name = "volume_sizes" + values = [outscale_volume.vol.size, outscale_volume.vol2.size] + } + filter { + name = "volume_types" + values = [outscale_volume.vol.volume_type, outscale_volume.vol2.volume_type] } + } `, region) } diff --git a/outscale/data_source_outscale_volumes_test.go b/outscale/data_source_outscale_volumes_test.go deleted file mode 100644 index afa98d601..000000000 --- a/outscale/data_source_outscale_volumes_test.go +++ /dev/null @@ -1,207 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccOutscaleOAPIVolumesDataSource_multipleFilters(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIVolumeDataSourceConfigWithMultipleFilters(region), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("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"), - ), - }, - }, - }) -} - -func TestAccOutscaleOAPIVolumeDataSource_multipleVIdsFilters(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter(region), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), - resource.TestCheckResourceAttr("data.outscale_volumes.outscale_volumes", "volumes.0.size", "40"), - ), - }, - }, - }) -} - -func TestAccOutscaleOAPIVolumesDataSource_withVM(t *testing.T) { - t.Parallel() - region := os.Getenv("OUTSCALE_REGION") - omi := os.Getenv("OUTSCALE_IMAGEID") - keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, omi, keypair, sgId), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIVolumeDataSourceID("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"), - ), - }, - }, - }) -} - -func testAccCheckOutscaleOAPIVolumeDataSourceConfigWithMultipleFilters(region string) string { - return fmt.Sprintf(` - resource "outscale_volume" "external" { - subregion_name = "%sa" - volume_type = "standard" - size = 1 - - tags { - key = "Name" - value = "tf-acc-test-ebs-volume-test" - } - } - - data "outscale_volumes" "ebs_volume" { - filter { - name = "volume_sizes" - values = ["${outscale_volume.external.size}"] - } - - filter { - name = "volume_types" - values = ["${outscale_volume.external.volume_type}"] - } - } - `, region) -} - -func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter(region string) string { - return fmt.Sprintf(` - resource "outscale_volume" "outscale_volume" { - subregion_name = "%[1]sa" - size = 40 - } - - resource "outscale_volume" "outscale_volume2" { - subregion_name = "%[1]sa" - size = 40 - } - - data "outscale_volumes" "outscale_volumes" { - filter { - name = "volume_ids" - values = ["${outscale_volume.outscale_volume.volume_id}", "${outscale_volume.outscale_volume2.volume_id}"] - } - } - `, region) -} - -func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keypair, sgId string) string { - return fmt.Sprintf(` - resource "outscale_volume" "outscale_volume" { - subregion_name = "%[1]sa" - volume_type = "standard" - size = 25 - tags { - key = "Name" - value = "volume-standard-1" - } - } - - resource "outscale_volume" "outscale_volume2" { - subregion_name = "%[1]sa" - volume_type = "standard" - size = 13 - tags { - key = "Name" - value = "volume-standard-2" - } - } - - resource "outscale_volume" "outscale_volume3" { - subregion_name = "%[1]sa" - size = 40 - iops = 100 - volume_type = "io1" - tags { - key = "type" - value = "io1" - } - } - - resource "outscale_net" "net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-security-group-rs" - } - } - - resource "outscale_security_group" "sg" { - security_group_name = "%[3]s" - description = "Used in the terraform acceptance tests" - - tags { - key = "Name" - value = "tf-acc-test" - } - - net_id = "${outscale_net.net.id}" - } - - resource "outscale_vm" "outscale_vm" { - image_id = "%[2]s" - keypair_name = "%[3]s" - security_group_ids = ["%[4]s"] - vm_type = "tinav4.c2r2p2" - } - - resource "outscale_volumes_link" "outscale_volumes_link" { - device_name = "/dev/xvdc" - volume_id = "${outscale_volume.outscale_volume.id}" - vm_id = "${outscale_vm.outscale_vm.id}" - } - - resource "outscale_volumes_link" "outscale_volumes_link_2" { - device_name = "/dev/xvdd" - volume_id = "${outscale_volume.outscale_volume2.id}" - vm_id = "${outscale_vm.outscale_vm.id}" - } - - resource "outscale_volumes_link" "outscale_volumes_link_3" { - device_name = "/dev/xvde" - volume_id = "${outscale_volume.outscale_volume3.id}" - vm_id = "${outscale_vm.outscale_vm.id}" - } - - data "outscale_volumes" "outscale_volumes" { - filter { - name = "link_volume_vm_ids" - values = ["${outscale_vm.outscale_vm.vm_id}"] - } - } - `, region, imageID, keypair, sgId) -} From 0a55822a0f72877ed445a288af4e47cf369f3204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:58 +0000 Subject: [PATCH 64/82] Improve vpn_connection datasource --- .../data_source_outscale_vpn_connection.go | 34 ++++--------------- .../data_source_outscale_vpn_connections.go | 30 +++------------- 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/outscale/data_source_outscale_vpn_connection.go b/outscale/data_source_outscale_vpn_connection.go index 0124e191e..478d32f7a 100644 --- a/outscale/data_source_outscale_vpn_connection.go +++ b/outscale/data_source_outscale_vpn_connection.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "fmt" "log" "time" @@ -21,7 +20,7 @@ func dataSourceOutscaleVPNConnection() *schema.Resource { "filter": dataSourceFiltersSchema(), "vpn_connection_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "client_gateway_id": { Type: schema.TypeString, @@ -106,30 +105,15 @@ func dataSourceOutscaleVPNConnection() *schema.Resource { func dataSourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - vpnConnectionID, vpnConnectionOk := d.GetOk("vpn_connection_id") - - if !filtersOk && !vpnConnectionOk { - return fmt.Errorf("One of filters, or vpn_connection_id must be assigned") - } - - params := oscgo.ReadVpnConnectionsRequest{} - - if vpnConnectionOk { - params.Filters = &oscgo.FiltersVpnConnection{ - VpnConnectionIds: &[]string{vpnConnectionID.(string)}, - } - } - - if filtersOk { - params.Filters = buildOutscaleDataSourceVPNConnectionFilters(filters.(*schema.Set)) + req := oscgo.ReadVpnConnectionsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleDataSourceVPNConnectionFilters(filters.(*schema.Set)) } var resp oscgo.ReadVpnConnectionsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VpnConnectionApi.ReadVpnConnections(context.Background()).ReadVpnConnectionsRequest(params).Execute() + rp, httpResp, err := conn.VpnConnectionApi.ReadVpnConnections(context.Background()).ReadVpnConnectionsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -140,12 +124,8 @@ func dataSourceOutscaleVPNConnectionRead(d *schema.ResourceData, meta interface{ return err } - if len(resp.GetVpnConnections()) == 0 { - return fmt.Errorf("Unable to find Client Gateway") - } - - if len(resp.GetVpnConnections()) > 1 { - return fmt.Errorf("multiple results returned, please use a more specific criteria in your query") + if err = utils.IsResponseEmptyOrMutiple(len(resp.GetVpnConnections()), "Vpn Connection"); err != nil { + return err } vpnConnection := resp.GetVpnConnections()[0] diff --git a/outscale/data_source_outscale_vpn_connections.go b/outscale/data_source_outscale_vpn_connections.go index 4320adc61..e18b43542 100644 --- a/outscale/data_source_outscale_vpn_connections.go +++ b/outscale/data_source_outscale_vpn_connections.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -18,11 +17,6 @@ func dataSourceOutscaleVPNConnections() *schema.Resource { Schema: map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "vpn_connection_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "vpn_connections": { Type: schema.TypeList, Computed: true, @@ -118,31 +112,15 @@ func dataSourceOutscaleVPNConnections() *schema.Resource { func dataSourceOutscaleVPNConnectionsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - vpnConnectionIDs, vpnConnectionOk := d.GetOk("vpn_connection_ids") - - if !filtersOk && !vpnConnectionOk { - return fmt.Errorf("One of filters, or vpn_connection_ids must be assigned") - } - - log.Printf("vpnConnectionIDs: %#+v\n", vpnConnectionIDs) - params := oscgo.ReadVpnConnectionsRequest{} - - if vpnConnectionOk { - params.Filters = &oscgo.FiltersVpnConnection{ - VpnConnectionIds: utils.InterfaceSliceToStringSlicePtr(vpnConnectionIDs.([]interface{})), - } - } - - if filtersOk { - params.Filters = buildOutscaleDataSourceVPNConnectionFilters(filters.(*schema.Set)) + req := oscgo.ReadVpnConnectionsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleDataSourceVPNConnectionFilters(filters.(*schema.Set)) } var resp oscgo.ReadVpnConnectionsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VpnConnectionApi.ReadVpnConnections(context.Background()).ReadVpnConnectionsRequest(params).Execute() + rp, httpResp, err := conn.VpnConnectionApi.ReadVpnConnections(context.Background()).ReadVpnConnectionsRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 03c8254f18c8036a34ce1219599ebe678b46679d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:27:58 +0000 Subject: [PATCH 65/82] Merge vpn_connection datasource testacc --- ...ata_source_outscale_vpn_connection_test.go | 66 ++++--------- ...ta_source_outscale_vpn_connections_test.go | 96 ------------------- 2 files changed, 17 insertions(+), 145 deletions(-) delete mode 100644 outscale/data_source_outscale_vpn_connections_test.go diff --git a/outscale/data_source_outscale_vpn_connection_test.go b/outscale/data_source_outscale_vpn_connection_test.go index 1203f9d38..a065d7a1d 100644 --- a/outscale/data_source_outscale_vpn_connection_test.go +++ b/outscale/data_source_outscale_vpn_connection_test.go @@ -8,37 +8,28 @@ import ( "github.com/terraform-providers/terraform-provider-outscale/utils" ) -func TestAccOutscaleVPNConnectionDataSource_basic(t *testing.T) { +func TestAcc_VPNConnection_DataSource(t *testing.T) { t.Parallel() publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) + dataSourceName := "data.outscale_vpn_connection.test" + dataSourcesName := "data.outscale_vpn_connections.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleVPNConnectionDataSourceConfigBasic(publicIP), + Config: testAcc_VPNConnection_DataSource_Config(publicIP), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "vpn_connection_id"), + resource.TestCheckResourceAttr(dataSourcesName, "vpn_connections.#", "1"), + ), }, }, }) } -func TestAccOutscaleVPNConnectionDataSource_withFilters(t *testing.T) { - t.Parallel() - publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleVPNConnectionDataSourceConfigWithFilters(publicIP), - }, - }, - }) -} - -func testAccOutscaleVPNConnectionDataSourceConfigBasic(publicIP string) string { +func testAcc_VPNConnection_DataSource_Config(publicIP string) string { return fmt.Sprintf(` resource "outscale_virtual_gateway" "virtual_gateway" { connection_type = "ipsec.1" @@ -51,46 +42,23 @@ func testAccOutscaleVPNConnectionDataSourceConfigBasic(publicIP string) string { } resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" + client_gateway_id = outscale_client_gateway.customer_gateway.id + virtual_gateway_id = outscale_virtual_gateway.virtual_gateway.id connection_type = "ipsec.1" static_routes_only = true - - tags { - key = "Name" - value = "test-VPN" - } } data "outscale_vpn_connection" "test" { - vpn_connection_id = "${outscale_vpn_connection.foo.id}" - } - `, publicIP) -} - -func testAccOutscaleVPNConnectionDataSourceConfigWithFilters(publicIP string) string { - return fmt.Sprintf(` - resource "outscale_virtual_gateway" "virtual_gateway" { - connection_type = "ipsec.1" - } - - resource "outscale_client_gateway" "customer_gateway" { - bgp_asn = 3 - public_ip = "%s" - connection_type = "ipsec.1" - } - - resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" - connection_type = "ipsec.1" - static_routes_only = true + filter { + name = "vpn_connection_ids" + values = [outscale_vpn_connection.foo.id] + } } - data "outscale_vpn_connection" "test" { + data "outscale_vpn_connections" "test" { filter { name = "vpn_connection_ids" - values = ["${outscale_vpn_connection.foo.id}"] + values = [outscale_vpn_connection.foo.id] } } `, publicIP) diff --git a/outscale/data_source_outscale_vpn_connections_test.go b/outscale/data_source_outscale_vpn_connections_test.go deleted file mode 100644 index cf9d67f47..000000000 --- a/outscale/data_source_outscale_vpn_connections_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package outscale - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/terraform-providers/terraform-provider-outscale/utils" -) - -func TestAccOutscaleVPNConnectionsDataSource_basic(t *testing.T) { - t.Parallel() - publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleVPNConnectionsDataSourceConfigBasic(publicIP), - }, - }, - }) -} - -func TestAccOutscaleVPNConnectionsDataSource_withFilters(t *testing.T) { - t.Parallel() - publicIP := fmt.Sprintf("172.0.0.%d", utils.RandIntRange(1, 255)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccOutscaleVPNConnectionsDataSourceConfigWithFilters(publicIP), - }, - }, - }) -} - -func testAccOutscaleVPNConnectionsDataSourceConfigBasic(publicIP string) string { - return fmt.Sprintf(` - resource "outscale_virtual_gateway" "virtual_gateway" { - connection_type = "ipsec.1" - } - - resource "outscale_client_gateway" "customer_gateway" { - bgp_asn = 3 - public_ip = "%s" - connection_type = "ipsec.1" - } - - resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" - connection_type = "ipsec.1" - static_routes_only = true - - tags { - key = "Name" - value = "test-VPN" - } - } - - data "outscale_vpn_connections" "test" { - vpn_connection_ids = ["${outscale_vpn_connection.foo.id}"] - } - `, publicIP) -} - -func testAccOutscaleVPNConnectionsDataSourceConfigWithFilters(publicIP string) string { - return fmt.Sprintf(` - resource "outscale_virtual_gateway" "virtual_gateway" { - connection_type = "ipsec.1" - } - - resource "outscale_client_gateway" "customer_gateway" { - bgp_asn = 3 - public_ip = "%s" - connection_type = "ipsec.1" - } - - resource "outscale_vpn_connection" "foo" { - client_gateway_id = "${outscale_client_gateway.customer_gateway.id}" - virtual_gateway_id = "${outscale_virtual_gateway.virtual_gateway.id}" - connection_type = "ipsec.1" - } - - data "outscale_vpn_connections" "test" { - filter { - name = "vpn_connection_ids" - values = ["${outscale_vpn_connection.foo.id}"] - } - } - `, publicIP) -} From 32670706b88e7e4e443975d576c6b43de1c529db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:29:27 +0000 Subject: [PATCH 66/82] Improve subregions datasource --- outscale/data_source_outscale_subregions.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/outscale/data_source_outscale_subregions.go b/outscale/data_source_outscale_subregions.go index c9d4c2a9c..981475880 100644 --- a/outscale/data_source_outscale_subregions.go +++ b/outscale/data_source_outscale_subregions.go @@ -53,16 +53,10 @@ func dataSourceOutscaleOAPISubregions() *schema.Resource { func dataSourceOutscaleOAPISubregionsRead(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)) + req := oscgo.ReadSubregionsRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.Filters = buildOutscaleOAPIDataSourceSubregionsFilters(filters.(*schema.Set)) } - - req := oscgo.ReadSubregionsRequest{Filters: filtersReq} - var resp oscgo.ReadSubregionsResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { @@ -73,11 +67,9 @@ func dataSourceOutscaleOAPISubregionsRead(d *schema.ResourceData, meta interface resp = rp return nil }) - if err != nil { return err } - subregions := resp.GetSubregions() return resourceDataAttrSetter(d, func(set AttributeSetter) error { From c30f45d422c98ad00711dec7b7a003d6b7e29ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:29:27 +0000 Subject: [PATCH 67/82] Improve subregions datasource testacc --- .../data_source_outscale_subregions_test.go | 45 ++++++------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/outscale/data_source_outscale_subregions_test.go b/outscale/data_source_outscale_subregions_test.go index f4b72cf15..5a18aad1b 100644 --- a/outscale/data_source_outscale_subregions_test.go +++ b/outscale/data_source_outscale_subregions_test.go @@ -2,16 +2,16 @@ package outscale import ( "fmt" + "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPISubregionsDataSource_Basic(t *testing.T) { +func TestAcc_Subregions_DataSource(t *testing.T) { t.Parallel() - subregionName := "eu-west-2b" - + subregionName := fmt.Sprintf("%sb", os.Getenv("OUTSCALE_REGION")) + dataSourcesName := "data.outscale_subregions.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -19,49 +19,33 @@ func TestAccOutscaleOAPISubregionsDataSource_Basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISubregionsDataSourceConfig(subregionName), + Config: testAcc_Subregions_DataSource_Config(subregionName), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubregionsDataSourceID("data.outscale_subregions.test"), + resource.TestCheckResourceAttr(dataSourcesName, "subregions.#", "1"), ), }, }, }) } -func TestAccOutscaleOAPISubregionsDataSource_All(t *testing.T) { +func TestAcc_Subregions_DataSource_All(t *testing.T) { t.Parallel() + dataSourcesName := "data.outscale_subregions.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPISubregionsDataSourceConfigAll, + Config: testAcc_Subregions_DataSource_All_Config, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPISubregionsDataSourceID("data.outscale_subregions.test"), + resource.TestCheckResourceAttrSet(dataSourcesName, "subregions.#"), ), }, }, }) } -func testAccCheckOutscaleOAPISubregionsDataSourceID(n string) resource.TestCheckFunc { - // Wait for IAM role - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("can't find subregions data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("subregions data source ID not set") - } - return nil - } -} - -func testAccCheckOutscaleOAPISubregionsDataSourceConfig(subregionName string) string { +func testAcc_Subregions_DataSource_Config(subregionName string) string { return fmt.Sprintf(` data "outscale_subregions" "test" { filter { @@ -72,7 +56,6 @@ func testAccCheckOutscaleOAPISubregionsDataSourceConfig(subregionName string) st `, subregionName) } -var testAccCheckOutscaleOAPISubregionsDataSourceConfigAll = ` - data "outscale_subregions" "test" { - } +var testAcc_Subregions_DataSource_All_Config = ` + data "outscale_subregions" "test" {} ` From 9622f100179d80ea84eb61014bf4fbfbd7f371b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:29:43 +0000 Subject: [PATCH 68/82] Improve vm_types datasource --- outscale/data_source_outscale_vm_types.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/outscale/data_source_outscale_vm_types.go b/outscale/data_source_outscale_vm_types.go index 73cd4f046..a319e0253 100644 --- a/outscale/data_source_outscale_vm_types.go +++ b/outscale/data_source_outscale_vm_types.go @@ -65,14 +65,10 @@ func dataSourceOutscaleOAPIVMTypes() *schema.Resource { func dataSourceOutscaleOAPIVMTypesRead(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)) + req := oscgo.ReadVmTypesRequest{} + if filter, filterOk := d.GetOk("filter"); filterOk { + req.SetFilters(buildOutscaleOAPIDataSourceVMTypesFilters(filter.(*schema.Set))) } - req := oscgo.ReadVmTypesRequest{Filters: &filtersReq} var resp oscgo.ReadVmTypesResponse var err error From 998ec006b4d27f826988d1ef685642947749741e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:29:43 +0000 Subject: [PATCH 69/82] Improve vm_types datasource testacc --- .../data_source_outscale_vm_types_test.go | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/outscale/data_source_outscale_vm_types_test.go b/outscale/data_source_outscale_vm_types_test.go index 41fbbd3fa..ed02970e4 100644 --- a/outscale/data_source_outscale_vm_types_test.go +++ b/outscale/data_source_outscale_vm_types_test.go @@ -2,15 +2,15 @@ package outscale import ( "fmt" - "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIVMTypes_basic(t *testing.T) { +func TestAcc_VMTypes_DataSource(t *testing.T) { t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") + dataSourcesName := "data.outscale_vm_types.vm_types" + dataSourcesAllName := "data.outscale_vm_types.all-types" resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -19,20 +19,18 @@ func TestAccDataSourceOutscaleOAPIVMTypes_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIVMTypesConfig(omi, "tinav4.c1r1p1"), + Config: testAcc_VMTypes_DataSource_Config(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourcesName, "vm_types.#"), + resource.TestCheckResourceAttrSet(dataSourcesAllName, "vm_types.#"), + ), }, }, }) } -func testAccDataSourceOutscaleOAPIVMTypesConfig(omi, vmType string) string { +func testAcc_VMTypes_DataSource_Config() string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - } - data "outscale_vm_types" "vm_types" { filter { name = "bsu_optimized" @@ -41,5 +39,5 @@ func testAccDataSourceOutscaleOAPIVMTypesConfig(omi, vmType string) string { } data "outscale_vm_types" "all-types" { } - `, omi, vmType) + `) } From f4690bdf7814e23f9b492803afeabf15553fb07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:30:15 +0000 Subject: [PATCH 70/82] Improve net_access_point_services datasource --- ...urce_outscale_net_access_point_services.go | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/outscale/data_source_outscale_net_access_point_services.go b/outscale/data_source_outscale_net_access_point_services.go index 006768976..259fd5f46 100644 --- a/outscale/data_source_outscale_net_access_point_services.go +++ b/outscale/data_source_outscale_net_access_point_services.go @@ -2,6 +2,7 @@ package outscale import ( "context" + "fmt" "log" "time" @@ -48,18 +49,12 @@ func dataSourceOutscaleOAPINetAccessPointServices() *schema.Resource { func dataSourceOutscaleOAPINetAccessPointServicesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - - filtersReq := oscgo.FiltersService{} - if filtersOk { - filtersReq = buildOutscaleDataSourcesNAPSFilters(filters.(*schema.Set)) + req := oscgo.ReadNetAccessPointServicesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleDataSourcesNAPSFilters(filters.(*schema.Set))) } - req := oscgo.ReadNetAccessPointServicesRequest{Filters: &filtersReq} - var resp oscgo.ReadNetAccessPointServicesResponse var err error - err = resource.Retry(20*time.Second, func() *resource.RetryError { rp, httpResp, err := conn.NetAccessPointApi.ReadNetAccessPointServices( context.Background()). @@ -74,10 +69,11 @@ func dataSourceOutscaleOAPINetAccessPointServicesRead(d *schema.ResourceData, me if err != nil { return err } - - naps := resp.GetServices()[:] + if resp.GetServices() == nil || len(resp.GetServices()) == 0 { + return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") + } + naps := resp.GetServices() nap_ret := make([]map[string]interface{}, len(naps)) - for k, v := range naps { n := make(map[string]interface{}) n["ip_ranges"] = v.GetIpRanges() From e8cc6cfb9625db8529f0f73139e700e982592daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:30:15 +0000 Subject: [PATCH 71/82] Improve net_access_point_services datasource testacc --- ...outscale_net_access_point_services_test.go | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 f75f4d153..ca409b0a0 100644 --- a/outscale/data_source_outscale_net_access_point_services_test.go +++ b/outscale/data_source_outscale_net_access_point_services_test.go @@ -8,10 +8,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPINetAccessPointServices_basic(t *testing.T) { +func TestAcc_NetAccessPointServices_DataSource(t *testing.T) { t.Parallel() serviceName := fmt.Sprintf("com.outscale.%s.api", os.Getenv("OUTSCALE_REGION")) - + dataSourcesName := "data.outscale_net_access_point_services.services" + dataSourcesAllName := "data.outscale_net_access_point_services.all" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -19,13 +20,17 @@ func TestAccDataSourceOutscaleOAPINetAccessPointServices_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(serviceName, serviceName), + Config: testAcc_NetAccessPointServices_DataSource_Config(serviceName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourcesName, "services.#", "1"), + resource.TestCheckResourceAttrSet(dataSourcesAllName, "services.#"), + ), }, }, }) } -func testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(sName, sName2 string) string { +func testAcc_NetAccessPointServices_DataSource_Config(sName string) string { return fmt.Sprintf(` resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" @@ -38,7 +43,7 @@ func testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(sName, sName2 str resource "outscale_net_access_point" "net_access_point_1" { net_id = outscale_net.outscale_net.net_id route_table_ids = [outscale_route_table.route_table-1.route_table_id] - service_name = "%s" + service_name = "%[1]s" tags { key = "name" value = "terraform-Net-Access-Point" @@ -46,14 +51,14 @@ func testAccDataSourceOutscaleOAPINetAccessPointServicesConfig(sName, sName2 str } - data "outscale_net_access_point_services" "all-services" { + data "outscale_net_access_point_services" "services" { filter { name = "service_names" - values = [ "%s"] + values = [ "%[1]s"] } } - data "outscale_net_access_point_services" "all-services2" { } + data "outscale_net_access_point_services" "all" { } - `, sName, sName2) + `, sName) } From 2a853e8558193d14eaa5ca2aee163a15969b8a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:32:36 +0000 Subject: [PATCH 72/82] Improve flexible_gpu_catalog datasource testacc --- ...data_source_outscale_flexible_gpu_catalog_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/outscale/data_source_outscale_flexible_gpu_catalog_test.go b/outscale/data_source_outscale_flexible_gpu_catalog_test.go index 3dbd40487..8ce0b430d 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog_test.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog_test.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIFlexibleGpuCatalog_basic(t *testing.T) { - +func TestAcc_FlexibleGpuCatalog_DataSource(t *testing.T) { + dataSourceName := "data.outscale_flexible_gpu_catalog.catalog-fGPU" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -16,13 +16,17 @@ func TestAccDataSourceOutscaleOAPIFlexibleGpuCatalog_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIFlexibleGpuCatalogConfig(), + Config: testAcc_FlexibleGpuCatalog_DataSource_Config(), + Check: resource.ComposeTestCheckFunc( + // data source validations + resource.TestCheckResourceAttrSet(dataSourceName, "flexible_gpu_catalog.#"), + ), }, }, }) } -func testAccDataSourceOutscaleOAPIFlexibleGpuCatalogConfig() string { +func testAcc_FlexibleGpuCatalog_DataSource_Config() string { return fmt.Sprintf(` data "outscale_flexible_gpu_catalog" "catalog-fGPU" { } `) From 89549fec5e00fadf2cfd6dbf94732d6baeeeb411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:33:09 +0000 Subject: [PATCH 73/82] Improve public_catalog datasource testacc --- outscale/data_source_outscale_public_catalog_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/outscale/data_source_outscale_public_catalog_test.go b/outscale/data_source_outscale_public_catalog_test.go index 4a69a930f..b664871da 100644 --- a/outscale/data_source_outscale_public_catalog_test.go +++ b/outscale/data_source_outscale_public_catalog_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccDataSourceOutscaleOAPIPublicCatalog_basic(t *testing.T) { +func TestAcc_PublicCatalog_DataSource(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -16,13 +16,13 @@ func TestAccDataSourceOutscaleOAPIPublicCatalog_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceOutscaleOAPIPublicCatalogConfig(), + Config: testAcc_PublicCatalog_DataSource_Config(), }, }, }) } -func testAccDataSourceOutscaleOAPIPublicCatalogConfig() string { +func testAcc_PublicCatalog_DataSource_Config() string { return fmt.Sprintf(` data "outscale_public_catalog" "catalog" { } `) From f0eca4739d1f438dd53ab1075cdc18c3a548c246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:33:53 +0000 Subject: [PATCH 74/82] Improve vm_state datasource --- outscale/data_source_outscale_vm_state.go | 43 +++++----------------- outscale/data_source_outscale_vm_states.go | 28 ++------------ 2 files changed, 13 insertions(+), 58 deletions(-) diff --git a/outscale/data_source_outscale_vm_state.go b/outscale/data_source_outscale_vm_state.go index 9d50cf35e..2ef6d43de 100644 --- a/outscale/data_source_outscale_vm_state.go +++ b/outscale/data_source_outscale_vm_state.go @@ -2,8 +2,6 @@ package outscale import ( "context" - "errors" - "fmt" "log" "time" @@ -70,7 +68,7 @@ func getVMStateAttrsSchema() map[string]*schema.Schema { }, "vm_id": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "vm_state": { Type: schema.TypeString, @@ -81,30 +79,16 @@ func getVMStateAttrsSchema() map[string]*schema.Schema { func dataSourceOutscaleOAPIVMStateRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - instanceID, instanceIDOk := d.GetOk("vm_id") - - if !instanceIDOk && !filtersOk { - return errors.New("vm_id or filter must be set") + req := oscgo.ReadVmsStateRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) } - - params := oscgo.ReadVmsStateRequest{} - if filtersOk { - params.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) - } - if instanceIDOk { - filter := oscgo.FiltersVmsState{} - filter.SetVmIds([]string{instanceID.(string)}) - params.SetFilters(filter) - } - - params.SetAllVms(false) + req.SetAllVms(false) var resp oscgo.ReadVmsStateResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VmApi.ReadVmsState(context.Background()).ReadVmsStateRequest(params).Execute() + rp, httpResp, err := conn.VmApi.ReadVmsState(context.Background()).ReadVmsStateRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } @@ -116,21 +100,13 @@ func dataSourceOutscaleOAPIVMStateRead(d *schema.ResourceData, meta interface{}) return err } - filteredStates := resp.GetVmStates()[:] + filteredStates := resp.GetVmStates() var state oscgo.VmStates - if len(filteredStates) < 1 { - return fmt.Errorf("Your query returned no results. Please change your search criteria and try again") - } - - if len(filteredStates) > 1 { - return fmt.Errorf("Your query returned more than one result. Please try a more " + - "specific search criteria.") + if err = utils.IsResponseEmptyOrMutiple(len(filteredStates), "Vm State"); err != nil { + return err } - state = filteredStates[0] - - log.Printf("[DEBUG] outscale_oapi_vm_state - Single State found: %s", state.GetVmId()) return vmStateDataAttrSetter(d, &state) } @@ -198,7 +174,6 @@ func buildOutscaleOAPIDataSourceVMStateFilters(set *schema.Set) oscgo.FiltersVms filters.SetVmIds(filterValues) case "vm_states": filters.SetVmStates(filterValues) - default: log.Printf("[Debug] Unknown Filter Name: %s.", name) } diff --git a/outscale/data_source_outscale_vm_states.go b/outscale/data_source_outscale_vm_states.go index afc779aab..8d3f8d7b4 100644 --- a/outscale/data_source_outscale_vm_states.go +++ b/outscale/data_source_outscale_vm_states.go @@ -2,7 +2,6 @@ package outscale import ( "context" - "errors" "fmt" "time" @@ -23,11 +22,6 @@ func dataSourceOutscaleOAPIVMStates() *schema.Resource { func getOAPIVMStatesDataSourceSchema() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ "filter": dataSourceFiltersSchema(), - "vm_ids": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "vm_states": { Type: schema.TypeList, Computed: true, @@ -46,29 +40,15 @@ func getOAPIVMStatesDataSourceSchema() map[string]*schema.Schema { func dataSourceOutscaleOAPIVMStatesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - filters, filtersOk := d.GetOk("filter") - instanceIds, instanceIdsOk := d.GetOk("vm_ids") - - if !instanceIdsOk && !filtersOk { - return errors.New("vm_id or filter must be set") + req := oscgo.ReadVmsStateRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) } - - params := oscgo.ReadVmsStateRequest{} - if filtersOk { - params.SetFilters(buildOutscaleOAPIDataSourceVMStateFilters(filters.(*schema.Set))) - } - if instanceIdsOk { - filter := oscgo.FiltersVmsState{} - filter.SetVmIds(utils.InterfaceSliceToStringSlice(instanceIds.([]interface{}))) - params.SetFilters(filter) - } - var resp oscgo.ReadVmsStateResponse var err error err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.VmApi.ReadVmsState(context.Background()).ReadVmsStateRequest(params).Execute() + rp, httpResp, err := conn.VmApi.ReadVmsState(context.Background()).ReadVmsStateRequest(req).Execute() if err != nil { return utils.CheckThrottling(httpResp, err) } From 4b37785593b2e4d81a33430b0b196cd0dd08f388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:33:54 +0000 Subject: [PATCH 75/82] Remove vm_state datasource testacc --- .../data_source_outscale_vm_state_test.go | 71 ------------------- .../data_source_outscale_vm_states_test.go | 38 ---------- 2 files changed, 109 deletions(-) delete mode 100644 outscale/data_source_outscale_vm_state_test.go delete mode 100644 outscale/data_source_outscale_vm_states_test.go diff --git a/outscale/data_source_outscale_vm_state_test.go b/outscale/data_source_outscale_vm_state_test.go deleted file mode 100644 index 7478e03c0..000000000 --- a/outscale/data_source_outscale_vm_state_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccDataSourceOutscaleOAPIVmState(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIVmStateConfig(omi, "tinav4.c2r2p2"), - Check: resource.ComposeTestCheckFunc( - testAccDataSourceOutscaleOAPIVMStateCheck("data.outscale_vm_state.state"), - ), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIVMStateCheck(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] - - if !ok { - return fmt.Errorf("root module has no resource called %s", name) - } - - vm, ok := s.RootModule().Resources["outscale_vm.basic"] - if !ok { - return fmt.Errorf("can't find outscale_public_ip.test in state") - } - - state := rs.Primary.Attributes - - if state["vm_id"] != vm.Primary.Attributes["vm_id"] { - return fmt.Errorf( - "vm_id is %s; want %s", - state["vm_id"], - vm.Primary.Attributes["vm_id"], - ) - } - return nil - } -} - -func testAccDataSourceOutscaleOAPIVmStateConfig(omi, vmType string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - } - - data "outscale_vm_state" "state" { - filter { - name = "vm_ids" - values = [outscale_vm.basic.id] - } - } - `, omi, vmType) -} diff --git a/outscale/data_source_outscale_vm_states_test.go b/outscale/data_source_outscale_vm_states_test.go deleted file mode 100644 index 751d6ba86..000000000 --- a/outscale/data_source_outscale_vm_states_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccDataSourceOutscaleOAPIVMStates(t *testing.T) { - t.Parallel() - omi := os.Getenv("OUTSCALE_IMAGEID") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccDataSourceOutscaleOAPIVMStatesConfig(omi, "tinav4.c2r2p2"), - }, - }, - }) -} - -func testAccDataSourceOutscaleOAPIVMStatesConfig(omi, vmType string) string { - return fmt.Sprintf(` - resource "outscale_vm" "basic" { - image_id = "%s" - vm_type = "%s" - keypair_name = "terraform-basic" - } - - data "outscale_vm_states" "state" { - vm_ids = [outscale_vm.basic.id] - } - `, omi, vmType) -} From f3bcddc824cff89f4dd0ee8f1a08d9b118b12d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:35:14 +0000 Subject: [PATCH 76/82] Improve regions datasource testacc --- outscale/data_source_outscale_regions_test.go | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/outscale/data_source_outscale_regions_test.go b/outscale/data_source_outscale_regions_test.go index 53ccd7cc4..abfae44c0 100644 --- a/outscale/data_source_outscale_regions_test.go +++ b/outscale/data_source_outscale_regions_test.go @@ -1,45 +1,28 @@ package outscale import ( - "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccOutscaleOAPIRegionsDataSource_basic(t *testing.T) { +func TestAcc_Regions_DataSource(t *testing.T) { t.Parallel() + dataSourcesName := "data.outscale_regions.regions" resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIRegionsDataSourceConfig, + Config: testAcc_Regions_DataSource_Config, Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIRegionsDataSourceID("data.outscale_regions.regions"), + resource.TestCheckResourceAttrSet(dataSourcesName, "regions.#"), ), }, }, }) } -func testAccCheckOutscaleOAPIRegionsDataSourceID(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("can't find regions data source: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("regions data source ID not set") - } - return nil - } -} - -var testAccCheckOutscaleOAPIRegionsDataSourceConfig = ` +var testAcc_Regions_DataSource_Config = ` data "outscale_regions" "regions" {} ` From 3148b8337b20c1c74fb377ba90d0e117dc5e9657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:36:18 +0000 Subject: [PATCH 77/82] Improve load_balancer_listener_rule datasource --- ...ce_outscale_load_balancer_listener_rule.go | 69 +++++++------------ ...e_outscale_load_balancer_listener_rules.go | 54 +++------------ 2 files changed, 34 insertions(+), 89 deletions(-) diff --git a/outscale/data_source_outscale_load_balancer_listener_rule.go b/outscale/data_source_outscale_load_balancer_listener_rule.go index 72e79f2a8..3ded989ed 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rule.go +++ b/outscale/data_source_outscale_load_balancer_listener_rule.go @@ -15,6 +15,7 @@ import ( func attrLBListenerRule() map[string]*schema.Schema { return map[string]*schema.Schema{ + "filter": dataSourceFiltersSchema(), "action": { Type: schema.TypeString, Computed: true, @@ -25,7 +26,6 @@ func attrLBListenerRule() map[string]*schema.Schema { }, "listener_rule_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "path_pattern": { @@ -65,44 +65,9 @@ func dataSourceOutscaleOAPILoadBalancerLDRule() *schema.Resource { func dataSourceOutscaleOAPILoadBalancerLDRuleRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - - lrNamei, nameOk := d.GetOk("listener_rule_name") - filters, filtersOk := d.GetOk("filter") - filter := &oscgo.FiltersListenerRule{} - - if !nameOk && !filtersOk { - return fmt.Errorf("listener_rule_name must be assigned") - } - - if filtersOk { - set := filters.(*schema.Set) - - if set.Len() < 1 { - return fmt.Errorf("filter can't be empty") - } - for _, v := range set.List() { - m := v.(map[string]interface{}) - filterValues := make([]string, 0) - for _, e := range m["values"].([]interface{}) { - filterValues = append(filterValues, e.(string)) - } - - switch name := m["name"].(string); name { - case "listener_rule_name": - filter.ListenerRuleNames = &filterValues - default: - filter.ListenerRuleNames = &filterValues - log.Printf("[Debug] Unknown Filter Name: %s. default to 'load_balancer_name'", name) - } - } - } else { - filter = &oscgo.FiltersListenerRule{ - ListenerRuleNames: &[]string{lrNamei.(string)}, - } - } - - req := oscgo.ReadListenerRulesRequest{ - Filters: filter, + req := oscgo.ReadListenerRulesRequest{} + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPILoadBalancerListenerRuleDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadListenerRulesResponse @@ -122,9 +87,10 @@ func dataSourceOutscaleOAPILoadBalancerLDRuleRead(d *schema.ResourceData, meta i return err } - if len(*resp.ListenerRules) < 1 { - return fmt.Errorf("can't find listener rule") + if err := utils.IsResponseEmptyOrMutiple(len(resp.GetListenerRules()), "Listener Rule"); err != nil { + return err } + lr := (*resp.ListenerRules)[0] if lr.Action != nil { d.Set("action", lr.Action) @@ -138,20 +104,17 @@ func dataSourceOutscaleOAPILoadBalancerLDRuleRead(d *schema.ResourceData, meta i if lr.PathPattern != nil { d.Set("path_pattern", lr.PathPattern) } - if lr.ListenerRuleId != nil { d.Set("listener_rule_id", lr.ListenerRuleId) } if lr.ListenerId != nil { d.Set("listener_id", lr.ListenerId) } - if lr.Priority != nil { d.Set("priority", lr.Priority) } else { fmt.Errorf("Malformated listener rule") } - if lr.VmIds != nil { d.Set("vm_ids", utils.StringSlicePtrToInterfaceSlice(lr.VmIds)) } else { @@ -162,3 +125,21 @@ func dataSourceOutscaleOAPILoadBalancerLDRuleRead(d *schema.ResourceData, meta i return nil } + +func buildOutscaleOAPILoadBalancerListenerRuleDataSourceFilters(set *schema.Set) oscgo.FiltersListenerRule { + var filters oscgo.FiltersListenerRule + for _, v := range set.List() { + m := v.(map[string]interface{}) + var filterValues []string + for _, e := range m["values"].([]interface{}) { + filterValues = append(filterValues, e.(string)) + } + switch name := m["name"].(string); name { + case "listener_rule_name": + filters.ListenerRuleNames = &filterValues + default: + log.Printf("[Debug] Unknown Filter Name: %s. default to 'load_balancer_name'", name) + } + } + return filters +} diff --git a/outscale/data_source_outscale_load_balancer_listener_rules.go b/outscale/data_source_outscale_load_balancer_listener_rules.go index d14ce14bd..66595d113 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rules.go +++ b/outscale/data_source_outscale_load_balancer_listener_rules.go @@ -3,7 +3,6 @@ package outscale import ( "context" "fmt" - "log" "time" oscgo "github.com/outscale/osc-sdk-go/v2" @@ -30,7 +29,6 @@ func attrLBListenerRules() map[string]*schema.Schema { }, "listener_rule_name": { Type: schema.TypeString, - Optional: true, Computed: true, }, "path_pattern": { @@ -73,44 +71,10 @@ func dataSourceOutscaleOAPILoadBalancerLDRules() *schema.Resource { func dataSourceOutscaleOAPILoadBalancerLDRulesRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI + req := oscgo.ReadListenerRulesRequest{} - lrNamei, nameOk := d.GetOk("listener_rule_name") - filters, filtersOk := d.GetOk("filter") - filter := &oscgo.FiltersListenerRule{} - - if !nameOk && !filtersOk { - return fmt.Errorf("listener_rule_name must be assigned") - } - - if filtersOk { - set := filters.(*schema.Set) - - if set.Len() < 1 { - return fmt.Errorf("filter can't be empty") - } - for _, v := range set.List() { - m := v.(map[string]interface{}) - filterValues := make([]string, 0) - for _, e := range m["values"].([]interface{}) { - filterValues = append(filterValues, e.(string)) - } - - switch name := m["name"].(string); name { - case "listener_rule_name": - filter.ListenerRuleNames = &filterValues - default: - filter.ListenerRuleNames = &filterValues - log.Printf("[Debug] Unknown Filter Name: %s. default to 'load_balancer_name'", name) - } - } - } else { - filter = &oscgo.FiltersListenerRule{ - ListenerRuleNames: &[]string{lrNamei.(string)}, - } - } - - req := oscgo.ReadListenerRulesRequest{ - Filters: filter, + if filters, filtersOk := d.GetOk("filter"); filtersOk { + req.SetFilters(buildOutscaleOAPILoadBalancerListenerRuleDataSourceFilters(filters.(*schema.Set))) } var resp oscgo.ReadListenerRulesResponse @@ -130,14 +94,14 @@ func dataSourceOutscaleOAPILoadBalancerLDRulesRead(d *schema.ResourceData, meta return err } - lrs := *resp.ListenerRules - lrs_len := len(lrs) - if lrs_len < 1 { - return fmt.Errorf("can't find listener rule") + result := *resp.ListenerRules + result_len := len(result) + if result_len == 0 { + return fmt.Errorf("your query returned no results, please change your search criteria and try again") } - lrs_ret := make([]map[string]interface{}, lrs_len) - for k, lr := range lrs { + lrs_ret := make([]map[string]interface{}, result_len) + for k, lr := range result { l := make(map[string]interface{}) if lr.Action != nil { l["action"] = lr.Action From 35d139dce80ccbb26b518ebfa8c7d53512c3a83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 2 Feb 2023 15:40:21 +0000 Subject: [PATCH 78/82] Fix nic ressource testacc --- outscale/resource_outscale_nic_link_test.go | 2 - .../resource_outscale_nic_private_ip_test.go | 4 - outscale/resource_outscale_nic_test.go | 80 ++++++++++--------- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/outscale/resource_outscale_nic_link_test.go b/outscale/resource_outscale_nic_link_test.go index fa996a15c..e8b3a713f 100644 --- a/outscale/resource_outscale_nic_link_test.go +++ b/outscale/resource_outscale_nic_link_test.go @@ -18,7 +18,6 @@ import ( ) func TestAccOutscaleNicLink_Basic(t *testing.T) { - var conf oscgo.Nic omi := os.Getenv("OUTSCALE_IMAGEID") region := os.Getenv("OUTSCALE_REGION") rInt := acctest.RandInt() @@ -32,7 +31,6 @@ func TestAccOutscaleNicLink_Basic(t *testing.T) { { Config: testAccOutscaleNicLinkConfigBasic(rInt, omi, "tinav4.c2r2p2", region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("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_test.go b/outscale/resource_outscale_nic_private_ip_test.go index 739be3de0..6bb365f55 100644 --- a/outscale/resource_outscale_nic_private_ip_test.go +++ b/outscale/resource_outscale_nic_private_ip_test.go @@ -5,14 +5,11 @@ import ( "os" "testing" - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccOutscaleOAPINetworkInterfacePrivateIPBasic(t *testing.T) { region := os.Getenv("OUTSCALE_REGION") - var conf oscgo.Nic resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -23,7 +20,6 @@ func TestAccOutscaleOAPINetworkInterfacePrivateIPBasic(t *testing.T) { { Config: testAccOutscaleOAPINetworkInterfacePrivateIPConfigBasic(region), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("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")), diff --git a/outscale/resource_outscale_nic_test.go b/outscale/resource_outscale_nic_test.go index 869a3110c..a7e836af8 100644 --- a/outscale/resource_outscale_nic_test.go +++ b/outscale/resource_outscale_nic_test.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "os" - "reflect" + "strings" "testing" "time" @@ -17,7 +17,6 @@ import ( func TestAccOutscaleOAPIENI_basic(t *testing.T) { t.Parallel() - var conf oscgo.Nic subregion := os.Getenv("OUTSCALE_REGION") resource.Test(t, resource.TestCase{ @@ -29,16 +28,12 @@ func TestAccOutscaleOAPIENI_basic(t *testing.T) { { Config: testAccOutscaleOAPIENIConfig(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "2"), ), }, { Config: testAccOutscaleOAPIENIConfigUpdate(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), - testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "3"), ), }, @@ -46,15 +41,10 @@ func TestAccOutscaleOAPIENI_basic(t *testing.T) { }) } -func testAccCheckOutscaleOAPIENIExists(n string, res *oscgo.Nic) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("No ENI ID is set") +func testAccCheckOutscaleOAPINICDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "outscale_nic" { + continue } conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI @@ -74,35 +64,20 @@ func testAccCheckOutscaleOAPIENIExists(n string, res *oscgo.Nic) resource.TestCh }) if err != nil { + if strings.Contains(fmt.Sprint(err), "InvalidNetworkInterfaceID.NotFound") { + return nil + } errString := err.Error() return fmt.Errorf("Could not find network interface: %s", errString) } - if len(resp.GetNics()) != 1 || - resp.GetNics()[0].GetNicId() != rs.Primary.ID { - return fmt.Errorf("ENI not found") + if len(resp.GetNics()) > 0 { + return fmt.Errorf("Nic with id %s is not destroyed yet", rs.Primary.ID) } - - *res = resp.GetNics()[0] - - return nil } -} - -func testAccCheckOutscaleOAPIENIAttributes(conf *oscgo.Nic, suregion string) resource.TestCheckFunc { - return func(s *terraform.State) error { - - if !reflect.DeepEqual(conf.GetLinkNic(), oscgo.LinkNic{}) { - return fmt.Errorf("expected attachment to be nil") - } - if conf.GetSubregionName() != fmt.Sprintf("%sa", suregion) { - return fmt.Errorf("expected subregion_name to be %sa, but was %s", suregion, conf.GetSubregionName()) - } - - return nil - } + return nil } func testAccOutscaleOAPIENIConfig(subregion string) string { @@ -187,3 +162,36 @@ func testAccOutscaleOAPIENIConfigUpdate(subregion string) string { } `, subregion) } + +func testAccCheckOutscaleOAPIENIDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "outscale_nic" { + continue + } + + var resp oscgo.ReadNicsResponse + conn := testAccProvider.Meta().(*OutscaleClient).OSCAPI + req := oscgo.ReadNicsRequest{ + Filters: &oscgo.FiltersNic{NicIds: &[]string{rs.Primary.ID}}, + } + + var err error + err = resource.Retry(5*time.Minute, func() *resource.RetryError { + rp, httpResp, err := conn.NicApi.ReadNics(context.Background()).ReadNicsRequest(req).Execute() + if err != nil { + return utils.CheckThrottling(httpResp, err) + } + resp = rp + return nil + }) + + if err != nil { + return err + } + + if len(resp.GetNics()) != 0 { + return fmt.Errorf("Nic is not destroyed yet") + } + } + return nil +} From d5e4e826a91b4ce46c6b9e201069cd96630711ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Fri, 3 Mar 2023 14:59:37 +0000 Subject: [PATCH 79/82] Generating certificate during testacc --- outscale/data_source_outscale_ca_test.go | 68 ++++++---- ...source_outscale_server_certificate_test.go | 119 ++++------------- outscale/provider_test.go | 10 ++ .../resource_outscale_api_access_rule_test.go | 29 +++- outscale/resource_outscale_ca_test.go | 58 +++++--- ...source_outscale_server_certificate_test.go | 124 ++++-------------- .../eim-ssl-unix-line-endings.pem | 17 --- .../eim-ssl-windows-line-endings.pem.winfile | 17 --- 8 files changed, 172 insertions(+), 270 deletions(-) delete mode 100644 outscale/test-fixtures/eim-ssl-unix-line-endings.pem delete mode 100644 outscale/test-fixtures/eim-ssl-windows-line-endings.pem.winfile diff --git a/outscale/data_source_outscale_ca_test.go b/outscale/data_source_outscale_ca_test.go index dc70a04d4..315e5cb46 100644 --- a/outscale/data_source_outscale_ca_test.go +++ b/outscale/data_source_outscale_ca_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/terraform-providers/terraform-provider-outscale/utils" ) func TestAcc_Ca_DataSource(t *testing.T) { @@ -13,11 +12,12 @@ func TestAcc_Ca_DataSource(t *testing.T) { dataSourcesName := "data.outscale_cas.cas_data" dataSourcesAllName := "data.outscale_cas.all_cas" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ExternalProviders: providerScottwinklerShell(), Steps: []resource.TestStep{ { - Config: testAcc_Ca_DataSource_Config(utils.TestCaPem), + Config: testAcc_Ca_DataSource_Config(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "ca_fingerprint"), resource.TestCheckResourceAttrSet(dataSourceName, "ca_id"), @@ -33,35 +33,53 @@ func TestAcc_Ca_DataSource(t *testing.T) { }) } -func testAcc_Ca_DataSource_Config(ca_pem string) string { +func testAcc_Ca_DataSource_Config() string { return fmt.Sprintf(` + +resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout datasource_ca.key -days 2 -out datasource_ca.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"filename\": \"datasource_ca.pem\"}" + EOF + delete = "rm -f datasource_ca.pem datasource_ca.key" + } + working_directory = "${path.module}/." +} + resource "outscale_ca" "ca_test" { - ca_pem = %[1]q - description = "Ca testacc create" + ca_pem = file(shell_script.ca_gen.output.filename) + description = "Ca testacc create" } data "outscale_ca" "ca_data" { - filter { - name = "ca_ids" - values = [outscale_ca.ca_test.id] - } + filter { + name = "ca_ids" + values = [outscale_ca.ca_test.id] + } } data "outscale_cas" "cas_data" { - filter { - name = "ca_ids" - values = [outscale_ca.ca_test.id] - } - filter { - name = "descriptions" - values = [outscale_ca.ca_test.description] - } - filter { - name = "ca_fingerprints" - values = [outscale_ca.ca_test.ca_fingerprint] - } + filter { + name = "ca_ids" + values = [outscale_ca.ca_test.id] + } + filter { + name = "descriptions" + values = [outscale_ca.ca_test.description] + } + filter { + name = "ca_fingerprints" + values = [outscale_ca.ca_test.ca_fingerprint] + } } -data "outscale_cas" "all_cas" {} -`, ca_pem) +data "outscale_cas" "all_cas" { + depends_on = [ + outscale_ca.ca_test + ] +} +`) } diff --git a/outscale/data_source_outscale_server_certificate_test.go b/outscale/data_source_outscale_server_certificate_test.go index 8ee31718d..39ce879eb 100644 --- a/outscale/data_source_outscale_server_certificate_test.go +++ b/outscale/data_source_outscale_server_certificate_test.go @@ -14,14 +14,14 @@ func TestAcc_ServerCertificate_Datasource(t *testing.T) { dataSourceName := "data.outscale_server_certificate.test" dataSourcesName := "data.outscale_server_certificates.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ExternalProviders: providerScottwinklerShell(), Steps: []resource.TestStep{ { - Config: testAcc_ServerCertificate_Datasource_Config(rName, body, private), + Config: testAcc_ServerCertificate_Datasource_Config(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourcesName, "server_certificates.#"), - resource.TestCheckResourceAttrSet(dataSourceName, "path"), ), }, @@ -29,12 +29,29 @@ func TestAcc_ServerCertificate_Datasource(t *testing.T) { }) } -func testAcc_ServerCertificate_Datasource_Config(name, body, privateKey string) string { +func testAcc_ServerCertificate_Datasource_Config(name string) string { return fmt.Sprintf(` + + resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout resource_ca.key -days 2 -out resource_ca.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"certfile\": \"resource_ca.pem\", + \"keyfile\": \"resource_ca.key\"}" + EOF + delete = "rm -f resource_ca.pem resource_ca.key" + } + working_directory = "${path.module}/." + } + + + resource "outscale_server_certificate" "test" { - name = %[1]q - body = %[2]q - private_key = %[3]q + name = "%s" + body = file(shell_script.ca_gen.output.certfile) + private_key = file(shell_script.ca_gen.output.keyfile) path = "/datasource/" } @@ -51,89 +68,5 @@ data "outscale_server_certificates" "test" { values = [outscale_server_certificate.test.path] } } - `, name, body, privateKey) + `, name) } - -var body = `-----BEGIN CERTIFICATE----- -MIIFETCCAvkCFE1QlISgW8h5/akhNlZzb+or8HgYMA0GCSqGSIb3DQEBCwUAMEUx -CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl -cm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjEwOTA5MDAyNDQzWhcNMzEwOTA3MDAy -NDQzWjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UE -CgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIICIjANBgkqhkiG9w0BAQEFAAOC -Ag8AMIICCgKCAgEA04T7eUNzkdtMDlcWpzgu/xSg98ZvhnDB75s528OXgw08UFM9 -GpqGYu12xbt02z0PJmBBJPy7qm3Dp2OtLuDcATL6QJTi0KX5xvuLTmBnuSoHe5Ec -bMOx2YHR6Hi9hUtl6M4E2y4Lxc5TQonIHtBprTWb4B5SFVdjgh8PFPHWJ8/YCM53 -RoUOsPnGb61cfStsK0zd3iUXOiIDDrN8EaMZi4ykqdBL2eztKWf6DSUTzK6sLZJu -MHK8Q5psryKO68gUx8pbwHGSEf+UxhsC1Bik+HJBH8OvULvB8OpBP4IixI0RHT3K -atrv6z+gl3X7606jaRxs4hlKrfORGK6SB6xloi+ptfXSKB1+6L0I2gjcIbpNvM+h -Dsvp1oly4H/QGA/g24dQgVuoB4hetZ5U+IQU231CJAOVLrw958ln746KN5wtQ8ur -IFkMRKb2X4ccAmLQroOxZGxv9MgvpQIJCdC18/fkZdEMKTGK6TmrcvPZ9A8tLYzn -yQcOvJ4r6Yh5Z6TUJWSjPqMPYZQgb2NBSGP8MBuQ67BHMBSO5F+wM+PPURw3clwl -qVJHXN1OLakmwxY2jsrZRxX8P2Q9Nkd/vRWmA6z4TlzEQxaKcJUHgsjbW5sl/FJ1 -h/E4CUfCReBXSF2ByWRcMkkAtcWQhzBMWJzAsNUltK4HgT8yY2CUMVSwTXcCAwEA -ATANBgkqhkiG9w0BAQsFAAOCAgEAiDGXtRVWfMvytjRmG7OeDuPvnKEcNSXyUARj -o4vq6z3SOVpfv4gG98p0aT3Xoi3yyWW+zATySOfgVTQkDVtHsBy98k2Z6/jP4Bsi -ryOuxhz4JR9hCyyNq3/RlIKcdTpcKIY0MC+xfVSyAXJXvX+MuGOPqB7/AF842Pyv -vn0Vfkk3K7gMTDITgp7+XVfjX+PF/pjeJ8p4yrSmhUAylPat1oNWtOiEDV/OMaQD -PGAFSEU7+07jz6fQSXjXE8u+uWZ9CUP3F5aRws0kold65aAamfCNXeckEuvsrIrB -hCAXFh06z/amaxR3Sg1pxxx3QNuwRp7KP79eu6Y+1erIwKYqfo/T7lEJn7i+CHJQ -M0veJi5Saoe1mZpq6/fBSnaEtDOw/yQ8+eMe37fiB/jdYb2L3FabkwUJH6Do3BkN -V4WVjjwuT0MHPLJUrsoKDd37GkDsrbhrp/MbgITy1bZWdqaYf0fzDCy+cyUwpWLf -T4ELtBlg7+Hl+1ysiPU2voq1COBiz5MGHNbVj3FI0SteOjFZXMcvfhQ//bksk5Kb -8hpaM5fMheQj6iaLhsW6u4qIJUd4hclrACMwZUIFOSlXs6HZBkmUfB/4XBn5Vas3 -zz2wyUFLztD3nO3US8tPSz/I5kXWGpOrPt+UcUPQEGzu5WQ+ZOeD+mQQMCVv0wiz -nmS35ug= ------END CERTIFICATE----- -` -var private = `-----BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDThPt5Q3OR20wO -VxanOC7/FKD3xm+GcMHvmznbw5eDDTxQUz0amoZi7XbFu3TbPQ8mYEEk/LuqbcOn -Y60u4NwBMvpAlOLQpfnG+4tOYGe5Kgd7kRxsw7HZgdHoeL2FS2XozgTbLgvFzlNC -icge0GmtNZvgHlIVV2OCHw8U8dYnz9gIzndGhQ6w+cZvrVx9K2wrTN3eJRc6IgMO -s3wRoxmLjKSp0EvZ7O0pZ/oNJRPMrqwtkm4wcrxDmmyvIo7ryBTHylvAcZIR/5TG -GwLUGKT4ckEfw69Qu8Hw6kE/giLEjREdPcpq2u/rP6CXdfvrTqNpHGziGUqt85EY -rpIHrGWiL6m19dIoHX7ovQjaCNwhuk28z6EOy+nWiXLgf9AYD+Dbh1CBW6gHiF61 -nlT4hBTbfUIkA5UuvD3nyWfvjoo3nC1Dy6sgWQxEpvZfhxwCYtCug7FkbG/0yC+l -AgkJ0LXz9+Rl0QwpMYrpOaty89n0Dy0tjOfJBw68nivpiHlnpNQlZKM+ow9hlCBv -Y0FIY/wwG5DrsEcwFI7kX7Az489RHDdyXCWpUkdc3U4tqSbDFjaOytlHFfw/ZD02 -R3+9FaYDrPhOXMRDFopwlQeCyNtbmyX8UnWH8TgJR8JF4FdIXYHJZFwySQC1xZCH -MExYnMCw1SW0rgeBPzJjYJQxVLBNdwIDAQABAoICAGPC7tCMza9XXRHOZXLM/u10 -D0+NmgAwomeeMLXEFGvNDEteVw17IDL8iO5NsZnNvJ1+/HqzcNe7GXKTgpT/nQQ7 -xOg80JVUEvCUp2l58rHUbt8K2/s4eWN65UPd3pVFsHUS5htyJj9PRtm1HlvaNF1r -UW9tHY3PP7GZcIWSYk04rE3LA1qRWxKBW+REQcEPf98US/iASeozLHn8kWHIKT42 -QVuOUJgiNOE4lykn+aSqJa8Ax1O2abEA3o3joMD4B0UL3iZv6lLu1n5xMu5SCUzc -pnaS1tcfFyPHeKq5eCh32ECQai3nwQyVX+rPzNd4qX3j2D7zatOMczzO6TURTIVM -m7giyp3csPRVjPVYfne8rGnj2gooMKVXaddumQbEEQDcpLMPcnflwKyIux+gE6aM -EYNKknFePTyL6k8gnFtd6wZRu4HD2fvHP1oPjOaSq/8/k5PDyKt8il2P37DEQMFb -z/UWsqGKyRd+Z0vmbEb7OiiD8dfV/2LEixxT+x9UHttWFCZVFOj5jL5lpUVnQyn9 -gAkeX6B16XvNtClGriqppp/u0I9txbzX4kQI2bEHyBGc6lk/hEuCW2ndmW5CyBEy -d+AlkfK/sobglkMNHPzJdGp1tKxzLjc5oDICvojvRW3mcCS4ztEoHnkbArDQ1YQf -7DR5H8WDIZhNqFcRfM+xAoIBAQDvGDT/c1K0hJ+Nwd65UNm+A4cECO3LeDtu22J6 -QZlwWCyO/ooT65AEg/Ws8Vj5Cavhaiqhy05p6zDKN92E5MKiyzYJAaw7HLzT/i9s -+MOL41oNhReLAhX3MvO5xfMKDupQdDjNYews8XfqDfm9Oq3t9WR8IAlKVXL5c27W -oz1/8nMpcDXSAdyxCJOZefYKeAlCflRLKlHfNEYEcugf0XOM62HiJjXgrtqDi3LX -MlmxVeKypYBMMR19YY18Ds0skoGLK+aBombmhoboqxnpCdypJ6CHS4rRVWtOVQ1d -K0N86tMLanOKBUBdF044yEs3RZ1isnxG+zF3ghP8E1vnkxlLAoIBAQDieaUmph7g -y+XHU3rxS5LDdPDvhcrQ8o/sK0VvSEBEM2L57jf6lX8mOpJHwgDQmlQrFywEojSY -PFR/Fu8UXh1yUK0JIKdjdTC4IEdvATi23t66B6HxcXRMZEjG0aKlDDLYNXs5oi+n -zSdfXHTXvahcE+ST7srrW8a8rGnOg4gNioXyhRLYJgieVmOP1vdXaGmyFIp0dizk -a/J1rRzmAKuWRszmMPWaRI5+zj4ZUM7SNXxuXqB1s2MtDLAGXayTPNpQxATjrbnJ -X3EgUVCL79NnDzz7sBMn+sfqjojO1TEr7/O/efnn0R7rJtapmXRpyOMAWl7nQMxi -msxChlO2mA0FAoIBAQDHMZu11xZoXrWvHH26VqmRrM6nhejXQ2wAh7YbtNtoxY0Z -9OaEghSSLn5XfxtpH62bNyAde4vwookbcD+VoCCoEDUMe+BJvz9yPqq0VuxTdy5n -ZSKgJTS3pjN36nr5PkPok2tfcN2a8/G7hbky9dhCD9ePsgELdPU87fbBy25JUmyv -cVTlibebplGR5BIf1rGgPC9uD+v10U8kFbdeCtoB5Xi/OKZaclKKlXsv3jrri2o6 -+7dPwvuWodeGK660G7rhf8mi5vJjzGBJJ4OGqzizlNgg38bfcBLeR+3CWXD4eYsq -T53Ct21QIUKB/BzuB4l/2MPBPzWPI0gTEu3WmK7RAoIBABTcqcbupIeGoMsEuJ2D -nahdnFgkFfO7dGCH9+RxXmIp7aMiO4vcu5K08Ialq1eL79bsUoS2wGuJmyr93NYe -eU3vepENrf2ubOd5Kbti/Gt0CkZOr69DCTiEQGP4KahUgFaETq6XbxZhApB5PtYk -xV5+Ap9R7uVRVfRJWZHJcf31VbNqaLr6fe6//HnijnRBzQK3e62QuT/tZa9LXA8f -3q6AJR3LQsSMLigmLXg9hl+8x5KPKu7MsIUU1x4vANerUl0AQYcLmMKhBRW6B9Zs -KCglMjPpG0qigknsCVQsNVRbzTNFNC0TiWqV8E49MYkRFUASEw3wXSN0KP6zywBV -71UCggEBAJjscscguJ2gjTHZQsivc4iLLYcnAwidZ5f0uJmmP/sYMPV5f2q45z3a -mUsRJKg0Iz5dk/1xIAWlhOdcx8tKIXrOY9tv7470XVZcVWXzzcKhOSzZwDNkiAn7 -50cHJKC1zgOZGkkpLobc9gugW8mPGt3IKn+SSlXEVBIk7gRARZcwgUVJHkArYAMw -9ihgZo3p8dmceFwmN/LSqDCGwWbsQ9lvthMx1F7hkqmLM7Y7AOZTPCYxTjwkfOds -kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y -0UFH3oBALPqPwDIt0F+wjSaY2bcmCjo= ------END PRIVATE KEY-----` diff --git a/outscale/provider_test.go b/outscale/provider_test.go index bb90df7a3..0149102d8 100644 --- a/outscale/provider_test.go +++ b/outscale/provider_test.go @@ -4,6 +4,7 @@ import ( "os" "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -39,3 +40,12 @@ func testAccPreCheck(t *testing.T) { t.Fatal("`OUTSCALE_ACCESSKEYID`, `OUTSCALE_SECRETKEYID`, `OUTSCALE_REGION`, `OUTSCALE_ACCOUNT` and `OUTSCALE_IMAGEID` must be set for acceptance testing") } } + +func providerScottwinklerShell() map[string]resource.ExternalProvider { + return map[string]resource.ExternalProvider{ + "shell": { + VersionConstraint: "1.7.10", + Source: "scottwinkler/shell", + }, + } +} diff --git a/outscale/resource_outscale_api_access_rule_test.go b/outscale/resource_outscale_api_access_rule_test.go index 01c84c47f..a19b90d8f 100644 --- a/outscale/resource_outscale_api_access_rule_test.go +++ b/outscale/resource_outscale_api_access_rule_test.go @@ -17,12 +17,13 @@ func TestAccOutscaleOAPIApiAccessRule_basic(t *testing.T) { resourceName := "outscale_api_access_rule.rule_test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleApiAccessRuleDestroy, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ExternalProviders: providerScottwinklerShell(), + CheckDestroy: testAccCheckOutscaleApiAccessRuleDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIApiAccessRuleConfig(utils.TestCaPem), + Config: testAccOutscaleOAPIApiAccessRuleConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleApiAccessRuleExists(resourceName), ), @@ -115,10 +116,24 @@ func testAccCheckOutscaleApiAccessRuleDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIApiAccessRuleConfig(ca_pem string) string { +func testAccOutscaleOAPIApiAccessRuleConfig() string { return fmt.Sprintf(` + +resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout resource_apiaccessrule.key -days 2 -out resource_apiaccessrule.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"filename\": \"resource_apiaccessrule.pem\"}" + EOF + delete = "rm -f resource_apiaccessrule.pem resource_apiaccessrule.key" + } + working_directory = "${path.module}/." +} + resource "outscale_ca" "ca_rule" { - ca_pem = %[1]q + ca_pem = file(shell_script.ca_gen.output.filename) description = "Ca testacc create" } @@ -127,5 +142,5 @@ resource "outscale_api_access_rule" "rule_test" { ip_ranges = ["192.0.2.0/16"] description = "testing api access rule" } - `, ca_pem) + `) } diff --git a/outscale/resource_outscale_ca_test.go b/outscale/resource_outscale_ca_test.go index 8282c4be5..b642faf9a 100644 --- a/outscale/resource_outscale_ca_test.go +++ b/outscale/resource_outscale_ca_test.go @@ -17,18 +17,19 @@ func TestAccOutscaleOAPICa_basic(t *testing.T) { resourceName := "outscale_ca.ca_test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleCaDestroy, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ExternalProviders: providerScottwinklerShell(), + CheckDestroy: testAccCheckOutscaleCaDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPICaConfig(utils.TestCaPem), + Config: testAccOutscaleOAPICaConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resourceName), ), }, { - Config: testAccOutscaleOAPICaConfigUpdateDescription(utils.TestCaPem), + Config: testAccOutscaleOAPICaConfigUpdateDescription(), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleCaExists(resourceName), ), @@ -120,20 +121,47 @@ func testAccCheckOutscaleCaDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPICaConfig(ca_pem string) string { +func testAccOutscaleOAPICaConfig() string { return fmt.Sprintf(` + +resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout resource_ca.key -days 2 -out resource_ca.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"filename\": \"resource_ca.pem\"}" + EOF + delete = "rm -f resource_ca.pem resource_ca.key" + } + working_directory = "${path.module}/." +} + resource "outscale_ca" "ca_test" { - ca_pem = %[1]q - description = "Ca testacc create" + ca_pem = file(shell_script.ca_gen.output.filename) + description = "Ca testacc create" } - `, ca_pem) + `) } -func testAccOutscaleOAPICaConfigUpdateDescription(ca_pem string) string { +func testAccOutscaleOAPICaConfigUpdateDescription() string { return fmt.Sprintf(` -resource "outscale_ca" "ca_test" { - ca_pem = %[1]q - description = "Ca testacc update" -} - `, ca_pem) + resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout resource_ca.key -days 2 -out resource_ca.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"filename\": \"resource_ca.pem\"}" + EOF + delete = "rm -f resource_ca.pem resource_ca.key" + } + working_directory = "${path.module}/." + } + + resource "outscale_ca" "ca_test" { + ca_pem = file(shell_script.ca_gen.output.filename) + description = "Ca testacc update" + } + `) } diff --git a/outscale/resource_outscale_server_certificate_test.go b/outscale/resource_outscale_server_certificate_test.go index b15190365..5f55a58f2 100644 --- a/outscale/resource_outscale_server_certificate_test.go +++ b/outscale/resource_outscale_server_certificate_test.go @@ -18,103 +18,20 @@ func TestAccOutscaleOAPIServerCertificate_basic(t *testing.T) { resourceName := "outscale_server_certificate.test" rName := acctest.RandomWithPrefix("acc-test") rNameUpdated := acctest.RandomWithPrefix("acc-test") - body := `-----BEGIN CERTIFICATE----- -MIIFETCCAvkCFE1QlISgW8h5/akhNlZzb+or8HgYMA0GCSqGSIb3DQEBCwUAMEUx -CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl -cm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjEwOTA5MDAyNDQzWhcNMzEwOTA3MDAy -NDQzWjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UE -CgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIICIjANBgkqhkiG9w0BAQEFAAOC -Ag8AMIICCgKCAgEA04T7eUNzkdtMDlcWpzgu/xSg98ZvhnDB75s528OXgw08UFM9 -GpqGYu12xbt02z0PJmBBJPy7qm3Dp2OtLuDcATL6QJTi0KX5xvuLTmBnuSoHe5Ec -bMOx2YHR6Hi9hUtl6M4E2y4Lxc5TQonIHtBprTWb4B5SFVdjgh8PFPHWJ8/YCM53 -RoUOsPnGb61cfStsK0zd3iUXOiIDDrN8EaMZi4ykqdBL2eztKWf6DSUTzK6sLZJu -MHK8Q5psryKO68gUx8pbwHGSEf+UxhsC1Bik+HJBH8OvULvB8OpBP4IixI0RHT3K -atrv6z+gl3X7606jaRxs4hlKrfORGK6SB6xloi+ptfXSKB1+6L0I2gjcIbpNvM+h -Dsvp1oly4H/QGA/g24dQgVuoB4hetZ5U+IQU231CJAOVLrw958ln746KN5wtQ8ur -IFkMRKb2X4ccAmLQroOxZGxv9MgvpQIJCdC18/fkZdEMKTGK6TmrcvPZ9A8tLYzn -yQcOvJ4r6Yh5Z6TUJWSjPqMPYZQgb2NBSGP8MBuQ67BHMBSO5F+wM+PPURw3clwl -qVJHXN1OLakmwxY2jsrZRxX8P2Q9Nkd/vRWmA6z4TlzEQxaKcJUHgsjbW5sl/FJ1 -h/E4CUfCReBXSF2ByWRcMkkAtcWQhzBMWJzAsNUltK4HgT8yY2CUMVSwTXcCAwEA -ATANBgkqhkiG9w0BAQsFAAOCAgEAiDGXtRVWfMvytjRmG7OeDuPvnKEcNSXyUARj -o4vq6z3SOVpfv4gG98p0aT3Xoi3yyWW+zATySOfgVTQkDVtHsBy98k2Z6/jP4Bsi -ryOuxhz4JR9hCyyNq3/RlIKcdTpcKIY0MC+xfVSyAXJXvX+MuGOPqB7/AF842Pyv -vn0Vfkk3K7gMTDITgp7+XVfjX+PF/pjeJ8p4yrSmhUAylPat1oNWtOiEDV/OMaQD -PGAFSEU7+07jz6fQSXjXE8u+uWZ9CUP3F5aRws0kold65aAamfCNXeckEuvsrIrB -hCAXFh06z/amaxR3Sg1pxxx3QNuwRp7KP79eu6Y+1erIwKYqfo/T7lEJn7i+CHJQ -M0veJi5Saoe1mZpq6/fBSnaEtDOw/yQ8+eMe37fiB/jdYb2L3FabkwUJH6Do3BkN -V4WVjjwuT0MHPLJUrsoKDd37GkDsrbhrp/MbgITy1bZWdqaYf0fzDCy+cyUwpWLf -T4ELtBlg7+Hl+1ysiPU2voq1COBiz5MGHNbVj3FI0SteOjFZXMcvfhQ//bksk5Kb -8hpaM5fMheQj6iaLhsW6u4qIJUd4hclrACMwZUIFOSlXs6HZBkmUfB/4XBn5Vas3 -zz2wyUFLztD3nO3US8tPSz/I5kXWGpOrPt+UcUPQEGzu5WQ+ZOeD+mQQMCVv0wiz -nmS35ug= ------END CERTIFICATE----- -` - private := `-----BEGIN PRIVATE KEY----- -MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDThPt5Q3OR20wO -VxanOC7/FKD3xm+GcMHvmznbw5eDDTxQUz0amoZi7XbFu3TbPQ8mYEEk/LuqbcOn -Y60u4NwBMvpAlOLQpfnG+4tOYGe5Kgd7kRxsw7HZgdHoeL2FS2XozgTbLgvFzlNC -icge0GmtNZvgHlIVV2OCHw8U8dYnz9gIzndGhQ6w+cZvrVx9K2wrTN3eJRc6IgMO -s3wRoxmLjKSp0EvZ7O0pZ/oNJRPMrqwtkm4wcrxDmmyvIo7ryBTHylvAcZIR/5TG -GwLUGKT4ckEfw69Qu8Hw6kE/giLEjREdPcpq2u/rP6CXdfvrTqNpHGziGUqt85EY -rpIHrGWiL6m19dIoHX7ovQjaCNwhuk28z6EOy+nWiXLgf9AYD+Dbh1CBW6gHiF61 -nlT4hBTbfUIkA5UuvD3nyWfvjoo3nC1Dy6sgWQxEpvZfhxwCYtCug7FkbG/0yC+l -AgkJ0LXz9+Rl0QwpMYrpOaty89n0Dy0tjOfJBw68nivpiHlnpNQlZKM+ow9hlCBv -Y0FIY/wwG5DrsEcwFI7kX7Az489RHDdyXCWpUkdc3U4tqSbDFjaOytlHFfw/ZD02 -R3+9FaYDrPhOXMRDFopwlQeCyNtbmyX8UnWH8TgJR8JF4FdIXYHJZFwySQC1xZCH -MExYnMCw1SW0rgeBPzJjYJQxVLBNdwIDAQABAoICAGPC7tCMza9XXRHOZXLM/u10 -D0+NmgAwomeeMLXEFGvNDEteVw17IDL8iO5NsZnNvJ1+/HqzcNe7GXKTgpT/nQQ7 -xOg80JVUEvCUp2l58rHUbt8K2/s4eWN65UPd3pVFsHUS5htyJj9PRtm1HlvaNF1r -UW9tHY3PP7GZcIWSYk04rE3LA1qRWxKBW+REQcEPf98US/iASeozLHn8kWHIKT42 -QVuOUJgiNOE4lykn+aSqJa8Ax1O2abEA3o3joMD4B0UL3iZv6lLu1n5xMu5SCUzc -pnaS1tcfFyPHeKq5eCh32ECQai3nwQyVX+rPzNd4qX3j2D7zatOMczzO6TURTIVM -m7giyp3csPRVjPVYfne8rGnj2gooMKVXaddumQbEEQDcpLMPcnflwKyIux+gE6aM -EYNKknFePTyL6k8gnFtd6wZRu4HD2fvHP1oPjOaSq/8/k5PDyKt8il2P37DEQMFb -z/UWsqGKyRd+Z0vmbEb7OiiD8dfV/2LEixxT+x9UHttWFCZVFOj5jL5lpUVnQyn9 -gAkeX6B16XvNtClGriqppp/u0I9txbzX4kQI2bEHyBGc6lk/hEuCW2ndmW5CyBEy -d+AlkfK/sobglkMNHPzJdGp1tKxzLjc5oDICvojvRW3mcCS4ztEoHnkbArDQ1YQf -7DR5H8WDIZhNqFcRfM+xAoIBAQDvGDT/c1K0hJ+Nwd65UNm+A4cECO3LeDtu22J6 -QZlwWCyO/ooT65AEg/Ws8Vj5Cavhaiqhy05p6zDKN92E5MKiyzYJAaw7HLzT/i9s -+MOL41oNhReLAhX3MvO5xfMKDupQdDjNYews8XfqDfm9Oq3t9WR8IAlKVXL5c27W -oz1/8nMpcDXSAdyxCJOZefYKeAlCflRLKlHfNEYEcugf0XOM62HiJjXgrtqDi3LX -MlmxVeKypYBMMR19YY18Ds0skoGLK+aBombmhoboqxnpCdypJ6CHS4rRVWtOVQ1d -K0N86tMLanOKBUBdF044yEs3RZ1isnxG+zF3ghP8E1vnkxlLAoIBAQDieaUmph7g -y+XHU3rxS5LDdPDvhcrQ8o/sK0VvSEBEM2L57jf6lX8mOpJHwgDQmlQrFywEojSY -PFR/Fu8UXh1yUK0JIKdjdTC4IEdvATi23t66B6HxcXRMZEjG0aKlDDLYNXs5oi+n -zSdfXHTXvahcE+ST7srrW8a8rGnOg4gNioXyhRLYJgieVmOP1vdXaGmyFIp0dizk -a/J1rRzmAKuWRszmMPWaRI5+zj4ZUM7SNXxuXqB1s2MtDLAGXayTPNpQxATjrbnJ -X3EgUVCL79NnDzz7sBMn+sfqjojO1TEr7/O/efnn0R7rJtapmXRpyOMAWl7nQMxi -msxChlO2mA0FAoIBAQDHMZu11xZoXrWvHH26VqmRrM6nhejXQ2wAh7YbtNtoxY0Z -9OaEghSSLn5XfxtpH62bNyAde4vwookbcD+VoCCoEDUMe+BJvz9yPqq0VuxTdy5n -ZSKgJTS3pjN36nr5PkPok2tfcN2a8/G7hbky9dhCD9ePsgELdPU87fbBy25JUmyv -cVTlibebplGR5BIf1rGgPC9uD+v10U8kFbdeCtoB5Xi/OKZaclKKlXsv3jrri2o6 -+7dPwvuWodeGK660G7rhf8mi5vJjzGBJJ4OGqzizlNgg38bfcBLeR+3CWXD4eYsq -T53Ct21QIUKB/BzuB4l/2MPBPzWPI0gTEu3WmK7RAoIBABTcqcbupIeGoMsEuJ2D -nahdnFgkFfO7dGCH9+RxXmIp7aMiO4vcu5K08Ialq1eL79bsUoS2wGuJmyr93NYe -eU3vepENrf2ubOd5Kbti/Gt0CkZOr69DCTiEQGP4KahUgFaETq6XbxZhApB5PtYk -xV5+Ap9R7uVRVfRJWZHJcf31VbNqaLr6fe6//HnijnRBzQK3e62QuT/tZa9LXA8f -3q6AJR3LQsSMLigmLXg9hl+8x5KPKu7MsIUU1x4vANerUl0AQYcLmMKhBRW6B9Zs -KCglMjPpG0qigknsCVQsNVRbzTNFNC0TiWqV8E49MYkRFUASEw3wXSN0KP6zywBV -71UCggEBAJjscscguJ2gjTHZQsivc4iLLYcnAwidZ5f0uJmmP/sYMPV5f2q45z3a -mUsRJKg0Iz5dk/1xIAWlhOdcx8tKIXrOY9tv7470XVZcVWXzzcKhOSzZwDNkiAn7 -50cHJKC1zgOZGkkpLobc9gugW8mPGt3IKn+SSlXEVBIk7gRARZcwgUVJHkArYAMw -9ihgZo3p8dmceFwmN/LSqDCGwWbsQ9lvthMx1F7hkqmLM7Y7AOZTPCYxTjwkfOds -kbcI5Y2wveEgMqPSRya2OapYGiPeqYhg6JAGPRXtOfOq9IUDcPuc2emnihNpSa8y -0UFH3oBALPqPwDIt0F+wjSaY2bcmCjo= ------END PRIVATE KEY-----` - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckOutscaleServerCertificateDestroy, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ExternalProviders: providerScottwinklerShell(), + CheckDestroy: testAccCheckOutscaleServerCertificateDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIServerCertificateConfig(rName, body, private), + Config: testAccOutscaleOAPIServerCertificateConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleServerCertificateExists(resourceName), ), }, { - Config: testAccOutscaleOAPIServerCertificateConfig(rNameUpdated, body, private), + Config: testAccOutscaleOAPIServerCertificateConfig(rNameUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleServerCertificateExists(resourceName), ), @@ -208,12 +125,27 @@ func testAccCheckOutscaleServerCertificateDestroy(s *terraform.State) error { return nil } -func testAccOutscaleOAPIServerCertificateConfig(name, body, privateKey string) string { +func testAccOutscaleOAPIServerCertificateConfig(name string) string { return fmt.Sprintf(` -resource "outscale_server_certificate" "test" { - name = %[1]q - body = %[2]q - private_key = %[3]q -} - `, name, body, privateKey) + + resource "shell_script" "ca_gen" { + lifecycle_commands { + create = <<-EOF + openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout resource_ca.key -days 2 -out resource_ca.pem -subj '/CN=domain.com' + EOF + read = <<-EOF + echo "{\"certfile\": \"resource_ca.pem\", + \"keyfile\": \"resource_ca.key\"}" + EOF + delete = "rm -f resource_ca.pem resource_ca.key" + } + working_directory = "${path.module}/." + } + + resource "outscale_server_certificate" "test" { + name = "%s" + body = file(shell_script.ca_gen.output.certfile) + private_key = file(shell_script.ca_gen.output.keyfile) + } + `, name) } diff --git a/outscale/test-fixtures/eim-ssl-unix-line-endings.pem b/outscale/test-fixtures/eim-ssl-unix-line-endings.pem deleted file mode 100644 index dfe5dfef9..000000000 --- a/outscale/test-fixtures/eim-ssl-unix-line-endings.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICsDCCAhmgAwIBAgIJALv4a1OoLANVMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTcwNjIzMjIwMzM5WhcNMjcwNjIxMjIwMzM5WjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB -gQDKdH6BU9Q0xBVPfeX5NjCC/B2Pm3WsFGnTtRw4abkD+r4to9wDeYUgjH2yPCyo -nNOA8mNiCQgDTtaLfbA8LjBYoodt7rgaTO7C0ugRtmTNK96DmYxmf8Gs5ZS6eC3y -eaFv58d1w2mow7tv0+DRk8uXwzVfaaMxoalsCtlLznmZHwIDAQABo4GnMIGkMB0G -A1UdDgQWBBSIYDlh7ZAmL+QNtxQLYKMr/oCaVjB1BgNVHSMEbjBsgBSIYDlh7ZAm -L+QNtxQLYKMr/oCaVqFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt -U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJALv4a1Oo -LANVMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAip+7/4JWMTYG7kSK -U4lpK7BCMePw6GbYxlePUgqjnxyZmrYGOMQPZBeDuPpd309fc0tYQitxxF40EyWM -RL8zdRZE703D5x7vTN/sFO7leuAdOV9CE/XT6U5D4MP/c6lXHKMWzIOKQ9bYBbXW -FBoLzt+e4vrNHYMw+WTNDMnt4/A= ------END CERTIFICATE----- \ No newline at end of file diff --git a/outscale/test-fixtures/eim-ssl-windows-line-endings.pem.winfile b/outscale/test-fixtures/eim-ssl-windows-line-endings.pem.winfile deleted file mode 100644 index dfe5dfef9..000000000 --- a/outscale/test-fixtures/eim-ssl-windows-line-endings.pem.winfile +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICsDCCAhmgAwIBAgIJALv4a1OoLANVMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTcwNjIzMjIwMzM5WhcNMjcwNjIxMjIwMzM5WjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB -gQDKdH6BU9Q0xBVPfeX5NjCC/B2Pm3WsFGnTtRw4abkD+r4to9wDeYUgjH2yPCyo -nNOA8mNiCQgDTtaLfbA8LjBYoodt7rgaTO7C0ugRtmTNK96DmYxmf8Gs5ZS6eC3y -eaFv58d1w2mow7tv0+DRk8uXwzVfaaMxoalsCtlLznmZHwIDAQABo4GnMIGkMB0G -A1UdDgQWBBSIYDlh7ZAmL+QNtxQLYKMr/oCaVjB1BgNVHSMEbjBsgBSIYDlh7ZAm -L+QNtxQLYKMr/oCaVqFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt -U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJALv4a1Oo -LANVMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAip+7/4JWMTYG7kSK -U4lpK7BCMePw6GbYxlePUgqjnxyZmrYGOMQPZBeDuPpd309fc0tYQitxxF40EyWM -RL8zdRZE703D5x7vTN/sFO7leuAdOV9CE/XT6U5D4MP/c6lXHKMWzIOKQ9bYBbXW -FBoLzt+e4vrNHYMw+WTNDMnt4/A= ------END CERTIFICATE----- \ No newline at end of file From e591cfc5ac090256eb0472e7b838b76edbf34c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Mon, 13 Mar 2023 12:50:11 +0000 Subject: [PATCH 80/82] Set filter to required in datasource --- outscale/data_source_outscale_access_key.go | 2 +- outscale/data_source_outscale_access_keys.go | 2 +- outscale/data_source_outscale_api_access_rule.go | 2 +- outscale/data_source_outscale_api_access_rules.go | 2 +- outscale/data_source_outscale_ca.go | 2 +- outscale/data_source_outscale_cas.go | 2 +- outscale/data_source_outscale_client_gateway.go | 2 +- outscale/data_source_outscale_client_gateways.go | 2 +- outscale/data_source_outscale_dhcp_option.go | 2 +- outscale/data_source_outscale_dhcp_options.go | 2 +- outscale/data_source_outscale_flexible_gpu.go | 2 +- outscale/data_source_outscale_flexible_gpu_catalog.go | 2 +- outscale/data_source_outscale_flexible_gpus.go | 2 +- outscale/data_source_outscale_image.go | 2 +- outscale/data_source_outscale_image_export_task.go | 2 +- outscale/data_source_outscale_image_export_tasks.go | 2 +- outscale/data_source_outscale_images.go | 2 +- outscale/data_source_outscale_internet_service.go | 2 +- outscale/data_source_outscale_internet_services.go | 2 +- outscale/data_source_outscale_keypair.go | 2 +- outscale/data_source_outscale_keypairs.go | 2 +- outscale/data_source_outscale_load_balancer.go | 2 +- .../data_source_outscale_load_balancer_listener_rule.go | 6 +++--- outscale/data_source_outscale_nat_service.go | 2 +- outscale/data_source_outscale_nat_services.go | 2 +- outscale/data_source_outscale_net.go | 2 +- outscale/data_source_outscale_net_access_point.go | 2 +- outscale/data_source_outscale_net_access_point_services.go | 2 +- outscale/data_source_outscale_net_access_points.go | 2 +- outscale/data_source_outscale_net_peering.go | 2 +- outscale/data_source_outscale_net_peerings.go | 2 +- outscale/data_source_outscale_nets.go | 2 +- outscale/data_source_outscale_nic.go | 2 +- outscale/data_source_outscale_nics.go | 2 +- outscale/data_source_outscale_product_type.go | 2 +- outscale/data_source_outscale_product_types.go | 2 +- outscale/data_source_outscale_public_ip.go | 2 +- outscale/data_source_outscale_public_ips.go | 2 +- outscale/data_source_outscale_quota.go | 2 +- outscale/data_source_outscale_quotas.go | 2 +- outscale/data_source_outscale_route_table.go | 2 +- outscale/data_source_outscale_route_tables.go | 2 +- outscale/data_source_outscale_security_group.go | 2 +- outscale/data_source_outscale_security_groups.go | 2 +- outscale/data_source_outscale_server_certificate.go | 2 +- outscale/data_source_outscale_server_certificates.go | 2 +- outscale/data_source_outscale_snapshot.go | 2 +- outscale/data_source_outscale_snapshot_export_task.go | 2 +- outscale/data_source_outscale_snapshot_export_tasks.go | 2 +- outscale/data_source_outscale_snapshots.go | 2 +- outscale/data_source_outscale_subnet.go | 2 +- outscale/data_source_outscale_subnets.go | 2 +- outscale/data_source_outscale_subregions.go | 2 +- outscale/data_source_outscale_tag.go | 2 +- outscale/data_source_outscale_tags.go | 2 +- outscale/data_source_outscale_virtual_gateway.go | 2 +- outscale/data_source_outscale_virtual_gateways.go | 2 +- outscale/data_source_outscale_vm.go | 2 +- outscale/data_source_outscale_vm_state.go | 2 +- outscale/data_source_outscale_vm_states.go | 2 +- outscale/data_source_outscale_vm_types.go | 2 +- outscale/data_source_outscale_vms.go | 7 ++++--- outscale/data_source_outscale_volume.go | 2 +- outscale/data_source_outscale_volumes.go | 2 +- outscale/data_source_outscale_vpn_connection.go | 2 +- outscale/data_source_outscale_vpn_connections.go | 2 +- 66 files changed, 71 insertions(+), 70 deletions(-) diff --git a/outscale/data_source_outscale_access_key.go b/outscale/data_source_outscale_access_key.go index 35086350a..9695cfd83 100644 --- a/outscale/data_source_outscale_access_key.go +++ b/outscale/data_source_outscale_access_key.go @@ -16,7 +16,7 @@ func dataSourceOutscaleAccessKey() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleAccessKeyRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "access_key_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_access_keys.go b/outscale/data_source_outscale_access_keys.go index 125f018ca..3b777229b 100644 --- a/outscale/data_source_outscale_access_keys.go +++ b/outscale/data_source_outscale_access_keys.go @@ -16,7 +16,7 @@ func dataSourceOutscaleAccessKeys() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleAccessKeysRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "access_keys": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_api_access_rule.go b/outscale/data_source_outscale_api_access_rule.go index d1e0bad42..b1b45bd33 100644 --- a/outscale/data_source_outscale_api_access_rule.go +++ b/outscale/data_source_outscale_api_access_rule.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPIApiAccessRule() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPIApiAccessRuleRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "api_access_rule_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_api_access_rules.go b/outscale/data_source_outscale_api_access_rules.go index 4a21bbfdf..98868f221 100644 --- a/outscale/data_source_outscale_api_access_rules.go +++ b/outscale/data_source_outscale_api_access_rules.go @@ -15,7 +15,7 @@ func dataSourceOutscaleOAPIApiAccessRules() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPIApiAccessRulesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "api_access_rules": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_ca.go b/outscale/data_source_outscale_ca.go index 0268a34c0..476cbdc03 100644 --- a/outscale/data_source_outscale_ca.go +++ b/outscale/data_source_outscale_ca.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPICa() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPICaRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "ca_pem": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_cas.go b/outscale/data_source_outscale_cas.go index e51f1a612..6b73d5319 100644 --- a/outscale/data_source_outscale_cas.go +++ b/outscale/data_source_outscale_cas.go @@ -15,7 +15,7 @@ func dataSourceOutscaleOAPICas() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPICasRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "cas": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_client_gateway.go b/outscale/data_source_outscale_client_gateway.go index f6363d240..18452dbcd 100644 --- a/outscale/data_source_outscale_client_gateway.go +++ b/outscale/data_source_outscale_client_gateway.go @@ -16,7 +16,7 @@ func dataSourceOutscaleClientGateway() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleClientGatewayRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "bgp_asn": { Type: schema.TypeInt, Computed: true, diff --git a/outscale/data_source_outscale_client_gateways.go b/outscale/data_source_outscale_client_gateways.go index 304b82edd..dae64d415 100644 --- a/outscale/data_source_outscale_client_gateways.go +++ b/outscale/data_source_outscale_client_gateways.go @@ -16,7 +16,7 @@ func dataSourceOutscaleClientGateways() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleClientGatewaysRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "client_gateways": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_dhcp_option.go b/outscale/data_source_outscale_dhcp_option.go index c3f9784b2..c9212fd70 100644 --- a/outscale/data_source_outscale_dhcp_option.go +++ b/outscale/data_source_outscale_dhcp_option.go @@ -17,7 +17,7 @@ func dataSourceOutscaleDHCPOption() *schema.Resource { Read: dataSourceOutscaleDHCPOptionRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "dhcp_options_set_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_dhcp_options.go b/outscale/data_source_outscale_dhcp_options.go index 5853393ee..57fb422dd 100644 --- a/outscale/data_source_outscale_dhcp_options.go +++ b/outscale/data_source_outscale_dhcp_options.go @@ -17,7 +17,7 @@ func dataSourceOutscaleDHCPOptions() *schema.Resource { Read: dataSourceOutscaleDHCPOptionsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "dhcp_options": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_flexible_gpu.go b/outscale/data_source_outscale_flexible_gpu.go index b2e7e3571..fb3969860 100644 --- a/outscale/data_source_outscale_flexible_gpu.go +++ b/outscale/data_source_outscale_flexible_gpu.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIFlexibleGpu() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPIFlexibleGpuRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "request_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_flexible_gpu_catalog.go b/outscale/data_source_outscale_flexible_gpu_catalog.go index d1692ccc7..f1d89cb5d 100644 --- a/outscale/data_source_outscale_flexible_gpu_catalog.go +++ b/outscale/data_source_outscale_flexible_gpu_catalog.go @@ -15,7 +15,7 @@ func dataSourceOutscaleOAPIFlexibleGpuCatalog() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPIFlexibleGpuCatalogRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "flexible_gpu_catalog": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_flexible_gpus.go b/outscale/data_source_outscale_flexible_gpus.go index 2664e17f1..8798dfb95 100644 --- a/outscale/data_source_outscale_flexible_gpus.go +++ b/outscale/data_source_outscale_flexible_gpus.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIFlexibleGpus() *schema.Resource { Read: dataSourceOutscaleOAPIFlexibleGpusRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "flexible_gpus": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_image.go b/outscale/data_source_outscale_image.go index 045e3ebf5..8c77e80ba 100644 --- a/outscale/data_source_outscale_image.go +++ b/outscale/data_source_outscale_image.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPIImage() *schema.Resource { Read: dataSourceOutscaleOAPIImageRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "permission": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_image_export_task.go b/outscale/data_source_outscale_image_export_task.go index 4fd496f05..a848ffdf2 100644 --- a/outscale/data_source_outscale_image_export_task.go +++ b/outscale/data_source_outscale_image_export_task.go @@ -27,7 +27,7 @@ func dataSourceOutscaleOAPIImageExportTask() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "osu_export": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_image_export_tasks.go b/outscale/data_source_outscale_image_export_tasks.go index cac9b9ad2..dda8d245a 100644 --- a/outscale/data_source_outscale_image_export_tasks.go +++ b/outscale/data_source_outscale_image_export_tasks.go @@ -26,7 +26,7 @@ func dataSourceOutscaleOAPIImageExportTasks() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "image_export_tasks": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_images.go b/outscale/data_source_outscale_images.go index 2bbc88496..31355d21b 100644 --- a/outscale/data_source_outscale_images.go +++ b/outscale/data_source_outscale_images.go @@ -19,7 +19,7 @@ func dataSourceOutscaleOAPIImages() *schema.Resource { Read: dataSourceOutscaleOAPIImagesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "request_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_internet_service.go b/outscale/data_source_outscale_internet_service.go index 9989e0ef8..25bbf5939 100644 --- a/outscale/data_source_outscale_internet_service.go +++ b/outscale/data_source_outscale_internet_service.go @@ -17,7 +17,7 @@ func datasourceOutscaleOAPIInternetService() *schema.Resource { return &schema.Resource{ Read: datasourceOutscaleOAPIInternetServiceRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "state": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_internet_services.go b/outscale/data_source_outscale_internet_services.go index 4be2325c8..6b15a7221 100644 --- a/outscale/data_source_outscale_internet_services.go +++ b/outscale/data_source_outscale_internet_services.go @@ -16,7 +16,7 @@ func datasourceOutscaleOAPIInternetServices() *schema.Resource { return &schema.Resource{ Read: datasourceOutscaleOAPIInternetServicesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "internet_services": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_keypair.go b/outscale/data_source_outscale_keypair.go index 9699fc586..8a632dcd1 100644 --- a/outscale/data_source_outscale_keypair.go +++ b/outscale/data_source_outscale_keypair.go @@ -69,7 +69,7 @@ func datasourceOutscaleOAPIKeyPair() *schema.Resource { Read: datasourceOutscaleOApiKeyPairRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), // Attributes "keypair_name": { Type: schema.TypeString, diff --git a/outscale/data_source_outscale_keypairs.go b/outscale/data_source_outscale_keypairs.go index e775628f4..884d58f93 100644 --- a/outscale/data_source_outscale_keypairs.go +++ b/outscale/data_source_outscale_keypairs.go @@ -74,7 +74,7 @@ func datasourceOutscaleOAPIKeyPairs() *schema.Resource { Read: datasourceOutscaleOAPiKeyPairsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), // Attributes "keypairs": { Type: schema.TypeList, diff --git a/outscale/data_source_outscale_load_balancer.go b/outscale/data_source_outscale_load_balancer.go index 00e105fcc..5ed7877c8 100644 --- a/outscale/data_source_outscale_load_balancer.go +++ b/outscale/data_source_outscale_load_balancer.go @@ -167,7 +167,7 @@ func attrLBchema() map[string]*schema.Schema { func getDataSourceSchemas(attrsSchema map[string]*schema.Schema) map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), } for k, v := range attrsSchema { diff --git a/outscale/data_source_outscale_load_balancer_listener_rule.go b/outscale/data_source_outscale_load_balancer_listener_rule.go index 3ded989ed..fb28cf89b 100644 --- a/outscale/data_source_outscale_load_balancer_listener_rule.go +++ b/outscale/data_source_outscale_load_balancer_listener_rule.go @@ -13,9 +13,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func attrLBListenerRule() map[string]*schema.Schema { +func attrLBListenerRule(filterRequired bool) map[string]*schema.Schema { return map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(filterRequired), "action": { Type: schema.TypeString, Computed: true, @@ -59,7 +59,7 @@ func attrLBListenerRule() map[string]*schema.Schema { func dataSourceOutscaleOAPILoadBalancerLDRule() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPILoadBalancerLDRuleRead, - Schema: getDataSourceSchemas(attrLBListenerRule()), + Schema: getDataSourceSchemas(attrLBListenerRule(true)), } } diff --git a/outscale/data_source_outscale_nat_service.go b/outscale/data_source_outscale_nat_service.go index 4e5253e1f..b7e2dde19 100644 --- a/outscale/data_source_outscale_nat_service.go +++ b/outscale/data_source_outscale_nat_service.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPINatService() *schema.Resource { Read: dataSourceOutscaleOAPINatServiceRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "nat_service_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_nat_services.go b/outscale/data_source_outscale_nat_services.go index 24692210c..5fd96a368 100644 --- a/outscale/data_source_outscale_nat_services.go +++ b/outscale/data_source_outscale_nat_services.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPINatServices() *schema.Resource { Read: dataSourceOutscaleOAPINatServicesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "nat_services": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_net.go b/outscale/data_source_outscale_net.go index 7ff3df7c3..ae9c4e9bb 100644 --- a/outscale/data_source_outscale_net.go +++ b/outscale/data_source_outscale_net.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIVpc() *schema.Resource { Read: dataSourceOutscaleOAPIVpcRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "ip_range": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_net_access_point.go b/outscale/data_source_outscale_net_access_point.go index d975cd99a..daa7e0413 100644 --- a/outscale/data_source_outscale_net_access_point.go +++ b/outscale/data_source_outscale_net_access_point.go @@ -13,7 +13,7 @@ import ( func napdSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "net_access_point_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_net_access_point_services.go b/outscale/data_source_outscale_net_access_point_services.go index 259fd5f46..041c6d315 100644 --- a/outscale/data_source_outscale_net_access_point_services.go +++ b/outscale/data_source_outscale_net_access_point_services.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPINetAccessPointServices() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPINetAccessPointServicesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "services": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_net_access_points.go b/outscale/data_source_outscale_net_access_points.go index 2986f5aa3..d5a666057 100644 --- a/outscale/data_source_outscale_net_access_points.go +++ b/outscale/data_source_outscale_net_access_points.go @@ -15,7 +15,7 @@ import ( func napSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "net_access_points": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_net_peering.go b/outscale/data_source_outscale_net_peering.go index 31c6e3a32..1e88964fe 100644 --- a/outscale/data_source_outscale_net_peering.go +++ b/outscale/data_source_outscale_net_peering.go @@ -20,7 +20,7 @@ func dataSourceOutscaleOAPILinPeeringConnection() *schema.Resource { Read: dataSourceOutscaleOAPILinPeeringConnectionRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "accepter_net": vpcOAPIPeeringConnectionOptionsSchema(), "net_peering_id": { Type: schema.TypeString, diff --git a/outscale/data_source_outscale_net_peerings.go b/outscale/data_source_outscale_net_peerings.go index 4f137219f..87e40660d 100644 --- a/outscale/data_source_outscale_net_peerings.go +++ b/outscale/data_source_outscale_net_peerings.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPILinPeeringsConnection() *schema.Resource { Read: dataSourceOutscaleOAPILinPeeringsConnectionRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "net_peerings": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_nets.go b/outscale/data_source_outscale_nets.go index 7a472f2bb..f7f3c684b 100644 --- a/outscale/data_source_outscale_nets.go +++ b/outscale/data_source_outscale_nets.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIVpcs() *schema.Resource { Read: dataSourceOutscaleOAPIVpcsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "nets": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_nic.go b/outscale/data_source_outscale_nic.go index adb935263..9afd9ab2a 100644 --- a/outscale/data_source_outscale_nic.go +++ b/outscale/data_source_outscale_nic.go @@ -20,7 +20,7 @@ func dataSourceOutscaleOAPINic() *schema.Resource { Read: dataSourceOutscaleOAPINicRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "nic_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_nics.go b/outscale/data_source_outscale_nics.go index 1244f8418..415383f8e 100644 --- a/outscale/data_source_outscale_nics.go +++ b/outscale/data_source_outscale_nics.go @@ -23,7 +23,7 @@ func dataSourceOutscaleOAPINics() *schema.Resource { func getDSOAPINicsSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ // This is attribute part for schema Nic - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "nics": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_product_type.go b/outscale/data_source_outscale_product_type.go index 9ff1a2c52..93c7dc35a 100644 --- a/outscale/data_source_outscale_product_type.go +++ b/outscale/data_source_outscale_product_type.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPIProductType() *schema.Resource { Read: dataSourceOutscaleOAPIProductTypeRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "description": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_product_types.go b/outscale/data_source_outscale_product_types.go index c25e997ee..fa0bfecee 100644 --- a/outscale/data_source_outscale_product_types.go +++ b/outscale/data_source_outscale_product_types.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIProductTypes() *schema.Resource { Read: dataSourceOutscaleOAPIProductTypesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "product_types": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_public_ip.go b/outscale/data_source_outscale_public_ip.go index 387384605..bc3a2633a 100644 --- a/outscale/data_source_outscale_public_ip.go +++ b/outscale/data_source_outscale_public_ip.go @@ -24,7 +24,7 @@ func dataSourceOutscaleOAPIPublicIP() *schema.Resource { func getOAPIPublicIPDataSourceSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ // Attributes - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "public_ip_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_public_ips.go b/outscale/data_source_outscale_public_ips.go index 43155ebf5..af5c8c41b 100644 --- a/outscale/data_source_outscale_public_ips.go +++ b/outscale/data_source_outscale_public_ips.go @@ -22,7 +22,7 @@ func dataSourceOutscaleOAPIPublicIPS() *schema.Resource { func oapiGetPublicIPSDataSourceSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "public_ips": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_quota.go b/outscale/data_source_outscale_quota.go index 9bf4d8817..5e89393c9 100644 --- a/outscale/data_source_outscale_quota.go +++ b/outscale/data_source_outscale_quota.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPIQuota() *schema.Resource { Read: dataSourceOutscaleOAPIQuotaRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "name": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_quotas.go b/outscale/data_source_outscale_quotas.go index cd214ccc2..50e3dd5ca 100644 --- a/outscale/data_source_outscale_quotas.go +++ b/outscale/data_source_outscale_quotas.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIQuotas() *schema.Resource { Read: dataSourceOutscaleOAPIQuotasRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "quotas": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_route_table.go b/outscale/data_source_outscale_route_table.go index 2417eb481..178c1b672 100644 --- a/outscale/data_source_outscale_route_table.go +++ b/outscale/data_source_outscale_route_table.go @@ -19,7 +19,7 @@ func dataSourceOutscaleOAPIRouteTable() *schema.Resource { Read: dataSourceOutscaleOAPIRouteTableRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "route_table_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_route_tables.go b/outscale/data_source_outscale_route_tables.go index 2159b58c1..ee751e72b 100644 --- a/outscale/data_source_outscale_route_tables.go +++ b/outscale/data_source_outscale_route_tables.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPIRouteTables() *schema.Resource { Read: dataSourceOutscaleOAPIRouteTablesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "request_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_security_group.go b/outscale/data_source_outscale_security_group.go index fe331ec71..5c5879e9a 100644 --- a/outscale/data_source_outscale_security_group.go +++ b/outscale/data_source_outscale_security_group.go @@ -19,7 +19,7 @@ func dataSourceOutscaleOAPISecurityGroup() *schema.Resource { Read: dataSourceOutscaleOAPISecurityGroupRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "security_group_name": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_security_groups.go b/outscale/data_source_outscale_security_groups.go index 1dc1839ef..a856b868d 100644 --- a/outscale/data_source_outscale_security_groups.go +++ b/outscale/data_source_outscale_security_groups.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPISecurityGroups() *schema.Resource { Read: dataSourceOutscaleOAPISecurityGroupsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "security_groups": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_server_certificate.go b/outscale/data_source_outscale_server_certificate.go index f29bb8cb5..fb308c386 100644 --- a/outscale/data_source_outscale_server_certificate.go +++ b/outscale/data_source_outscale_server_certificate.go @@ -17,7 +17,7 @@ func datasourceOutscaleOAPIServerCertificate() *schema.Resource { return &schema.Resource{ Read: datasourceOutscaleOAPIServerCertificateRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "expiration_date": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_server_certificates.go b/outscale/data_source_outscale_server_certificates.go index 112120154..c08958517 100644 --- a/outscale/data_source_outscale_server_certificates.go +++ b/outscale/data_source_outscale_server_certificates.go @@ -15,7 +15,7 @@ func datasourceOutscaleOAPIServerCertificates() *schema.Resource { return &schema.Resource{ Read: datasourceOutscaleOAPIServerCertificatesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "server_certificates": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_snapshot.go b/outscale/data_source_outscale_snapshot.go index 48e6672d3..90e63f3dc 100644 --- a/outscale/data_source_outscale_snapshot.go +++ b/outscale/data_source_outscale_snapshot.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPISnapshot() *schema.Resource { Read: dataSourceOutscaleOAPISnapshotRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "permissions_to_create_volume": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_snapshot_export_task.go b/outscale/data_source_outscale_snapshot_export_task.go index e97a8ae07..691b82f44 100644 --- a/outscale/data_source_outscale_snapshot_export_task.go +++ b/outscale/data_source_outscale_snapshot_export_task.go @@ -25,7 +25,7 @@ func dataSourceOutscaleOAPISnapshotExportTask() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "osu_export": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_snapshot_export_tasks.go b/outscale/data_source_outscale_snapshot_export_tasks.go index 64b15f93e..22f5190d0 100644 --- a/outscale/data_source_outscale_snapshot_export_tasks.go +++ b/outscale/data_source_outscale_snapshot_export_tasks.go @@ -25,7 +25,7 @@ func dataSourceOutscaleOAPISnapshotExportTasks() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "snapshot_export_tasks": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_snapshots.go b/outscale/data_source_outscale_snapshots.go index b38306f21..4780aae66 100644 --- a/outscale/data_source_outscale_snapshots.go +++ b/outscale/data_source_outscale_snapshots.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPISnapshots() *schema.Resource { Read: dataSourceOutscaleOAPISnapshotsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "snapshots": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_subnet.go b/outscale/data_source_outscale_subnet.go index ce02193f4..dcd5de2e8 100644 --- a/outscale/data_source_outscale_subnet.go +++ b/outscale/data_source_outscale_subnet.go @@ -20,7 +20,7 @@ func dataSourceOutscaleOAPISubnet() *schema.Resource { Read: dataSourceOutscaleOAPISubnetRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "subregion_name": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_subnets.go b/outscale/data_source_outscale_subnets.go index 456dcfe90..28a743fad 100644 --- a/outscale/data_source_outscale_subnets.go +++ b/outscale/data_source_outscale_subnets.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPISubnets() *schema.Resource { Read: dataSourceOutscaleOAPISubnetsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "subnets": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_subregions.go b/outscale/data_source_outscale_subregions.go index 981475880..6dc57be22 100644 --- a/outscale/data_source_outscale_subregions.go +++ b/outscale/data_source_outscale_subregions.go @@ -17,7 +17,7 @@ func dataSourceOutscaleOAPISubregions() *schema.Resource { Read: dataSourceOutscaleOAPISubregionsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), // Computed values. "request_id": { Type: schema.TypeString, diff --git a/outscale/data_source_outscale_tag.go b/outscale/data_source_outscale_tag.go index 62a491118..aa0737534 100644 --- a/outscale/data_source_outscale_tag.go +++ b/outscale/data_source_outscale_tag.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPITag() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPITagRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "key": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_tags.go b/outscale/data_source_outscale_tags.go index 03c05770c..1999421cd 100644 --- a/outscale/data_source_outscale_tags.go +++ b/outscale/data_source_outscale_tags.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPITags() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleOAPITagsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "tags": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_virtual_gateway.go b/outscale/data_source_outscale_virtual_gateway.go index 635671212..883283124 100644 --- a/outscale/data_source_outscale_virtual_gateway.go +++ b/outscale/data_source_outscale_virtual_gateway.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPIVirtualGateway() *schema.Resource { Read: dataSourceOutscaleOAPIVirtualGatewayRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "virtual_gateway_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_virtual_gateways.go b/outscale/data_source_outscale_virtual_gateways.go index d2cfb7ea3..dbe1a9940 100644 --- a/outscale/data_source_outscale_virtual_gateways.go +++ b/outscale/data_source_outscale_virtual_gateways.go @@ -16,7 +16,7 @@ func dataSourceOutscaleOAPIVirtualGateways() *schema.Resource { Read: dataSourceOutscaleOAPIVirtualGatewaysRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "virtual_gateways": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_vm.go b/outscale/data_source_outscale_vm.go index d3aaa0d2d..ba5c6b018 100644 --- a/outscale/data_source_outscale_vm.go +++ b/outscale/data_source_outscale_vm.go @@ -204,7 +204,7 @@ func getOAPIVMSecurityGroups(groupSet []oscgo.SecurityGroupLight) []map[string]i func getDataSourceOAPIVMSchemas() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), } attrsSchema := getOApiVMAttributesSchema() diff --git a/outscale/data_source_outscale_vm_state.go b/outscale/data_source_outscale_vm_state.go index 2ef6d43de..f8363fb39 100644 --- a/outscale/data_source_outscale_vm_state.go +++ b/outscale/data_source_outscale_vm_state.go @@ -21,7 +21,7 @@ func dataSourceOutscaleOAPIVMState() *schema.Resource { func getOAPIVMStateDataSourceSchema() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), } for k, v := range getVMStateAttrsSchema() { diff --git a/outscale/data_source_outscale_vm_states.go b/outscale/data_source_outscale_vm_states.go index 8d3f8d7b4..9c0fd8927 100644 --- a/outscale/data_source_outscale_vm_states.go +++ b/outscale/data_source_outscale_vm_states.go @@ -21,7 +21,7 @@ func dataSourceOutscaleOAPIVMStates() *schema.Resource { func getOAPIVMStatesDataSourceSchema() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "vm_states": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_vm_types.go b/outscale/data_source_outscale_vm_types.go index a319e0253..48806424f 100644 --- a/outscale/data_source_outscale_vm_types.go +++ b/outscale/data_source_outscale_vm_types.go @@ -18,7 +18,7 @@ func dataSourceOutscaleOAPIVMTypes() *schema.Resource { Read: dataSourceOutscaleOAPIVMTypesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "vm_types": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_vms.go b/outscale/data_source_outscale_vms.go index 683ba9a25..052a071b4 100644 --- a/outscale/data_source_outscale_vms.go +++ b/outscale/data_source_outscale_vms.go @@ -21,11 +21,12 @@ func datasourceOutscaleOApiVMS() *schema.Resource { } } -func dataSourceFiltersSchema() *schema.Schema { +func dataSourceFiltersSchema(required bool) *schema.Schema { return &schema.Schema{ Type: schema.TypeSet, - Optional: true, + Optional: !required, ForceNew: true, + Required: required, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -45,7 +46,7 @@ func dataSourceFiltersSchema() *schema.Schema { func datasourceOutscaleOApiVMSSchema() map[string]*schema.Schema { wholeSchema := map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "vms": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_volume.go b/outscale/data_source_outscale_volume.go index f8fcedf69..f4eb47028 100644 --- a/outscale/data_source_outscale_volume.go +++ b/outscale/data_source_outscale_volume.go @@ -19,7 +19,7 @@ func datasourceOutscaleOAPIVolume() *schema.Resource { Schema: map[string]*schema.Schema{ // Arguments - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "subregion_name": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_volumes.go b/outscale/data_source_outscale_volumes.go index ef6d02148..249dc63cc 100644 --- a/outscale/data_source_outscale_volumes.go +++ b/outscale/data_source_outscale_volumes.go @@ -17,7 +17,7 @@ func datasourceOutscaleOAPIVolumes() *schema.Resource { Read: datasourceOAPIVolumesRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "volumes": { Type: schema.TypeList, Computed: true, diff --git a/outscale/data_source_outscale_vpn_connection.go b/outscale/data_source_outscale_vpn_connection.go index 478d32f7a..daa7b5ead 100644 --- a/outscale/data_source_outscale_vpn_connection.go +++ b/outscale/data_source_outscale_vpn_connection.go @@ -17,7 +17,7 @@ func dataSourceOutscaleVPNConnection() *schema.Resource { return &schema.Resource{ Read: dataSourceOutscaleVPNConnectionRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(true), "vpn_connection_id": { Type: schema.TypeString, Computed: true, diff --git a/outscale/data_source_outscale_vpn_connections.go b/outscale/data_source_outscale_vpn_connections.go index e18b43542..acd8bc979 100644 --- a/outscale/data_source_outscale_vpn_connections.go +++ b/outscale/data_source_outscale_vpn_connections.go @@ -16,7 +16,7 @@ func dataSourceOutscaleVPNConnections() *schema.Resource { Read: dataSourceOutscaleVPNConnectionsRead, Schema: map[string]*schema.Schema{ - "filter": dataSourceFiltersSchema(), + "filter": dataSourceFiltersSchema(false), "vpn_connections": { Type: schema.TypeList, Computed: true, From 49f06df3d428e992a44f3266cf6813ada3a98598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Tue, 14 Mar 2023 14:01:13 +0000 Subject: [PATCH 81/82] Remove outscale_load_balancer_tags datasource --- ...data_source_outscale_load_balancer_tags.go | 106 ------------------ ...source_outscale_load_balancer_tags_test.go | 75 ------------- outscale/provider.go | 1 - 3 files changed, 182 deletions(-) delete mode 100644 outscale/data_source_outscale_load_balancer_tags.go delete mode 100644 outscale/data_source_outscale_load_balancer_tags_test.go diff --git a/outscale/data_source_outscale_load_balancer_tags.go b/outscale/data_source_outscale_load_balancer_tags.go deleted file mode 100644 index bdac20873..000000000 --- a/outscale/data_source_outscale_load_balancer_tags.go +++ /dev/null @@ -1,106 +0,0 @@ -package outscale - -import ( - "context" - "fmt" - "time" - - oscgo "github.com/outscale/osc-sdk-go/v2" - "github.com/terraform-providers/terraform-provider-outscale/utils" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func dataSourceOutscaleOAPILBUTags() *schema.Resource { - return &schema.Resource{ - Read: dataSourceOutscaleOAPILBUTagsRead, - - Schema: getDataSourceSchemas(getDSOAPILBUTagsSchema()), - } -} - -func dataSourceOutscaleOAPILBUTagsRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*OutscaleClient).OSCAPI - - ename, nameOk := d.GetOk("load_balancer_names") - if !nameOk { - return fmt.Errorf("load_balancer_names is required") - } - - names := ename.([]interface{}) - - req := oscgo.ReadLoadBalancerTagsRequest{ - LoadBalancerNames: utils.InterfaceSliceToStringSlice(names), - } - - var resp oscgo.ReadLoadBalancerTagsResponse - var err error - err = resource.Retry(5*time.Minute, func() *resource.RetryError { - rp, httpResp, err := conn.LoadBalancerApi.ReadLoadBalancerTags( - context.Background()). - ReadLoadBalancerTagsRequest(req).Execute() - - if err != nil { - return utils.CheckThrottling(httpResp, err) - } - resp = rp - return nil - }) - - if err != nil { - return err - } - - tags := *resp.Tags - l := len(*resp.Tags) - - ta := make([]map[string]interface{}, l) - for k1, v1 := range tags { - t := make(map[string]interface{}) - t["key"] = v1.Key - t["value"] = v1.Value - t["load_balancer_name"] = v1.LoadBalancerName - ta[k1] = t - } - - d.Set("tags", ta) - d.SetId(resource.UniqueId()) - return nil -} - -func getDSOAPILBUTagsSchema() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "load_balancer_names": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "tags": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "key": { - Type: schema.TypeString, - Computed: true, - }, - "load_balancer_name": { - Type: schema.TypeString, - Computed: true, - }, - "value": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }, - "request_id": { - Type: schema.TypeString, - Computed: true, - }, - } -} diff --git a/outscale/data_source_outscale_load_balancer_tags_test.go b/outscale/data_source_outscale_load_balancer_tags_test.go deleted file mode 100644 index 83b7a8242..000000000 --- a/outscale/data_source_outscale_load_balancer_tags_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package outscale - -import ( - "fmt" - "os" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccOutscaleOAPIDSLoadBalancerTags_basic(t *testing.T) { - t.Parallel() - r := acctest.RandString(4) - region := os.Getenv("OUTSCALE_REGION") - zone := fmt.Sprintf("%sa", region) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: getTestAccDSODSutscaleOAPILBUDSTagsConfig(r, zone), - Check: resource.ComposeTestCheckFunc( - testAccCheckODSutscaleOAPILBUDSTagsExists("data.outscale_load_balancer_tags.testds"), - resource.TestCheckResourceAttr( - "data.outscale_load_balancer_tags.testds", "tags.#", "1"), - )}, - }, - }) -} - -func testAccCheckODSutscaleOAPILBUDSTagsExists(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("No LBU Tag DS ID is set") - } - - return nil - } -} - -func getTestAccDSODSutscaleOAPILBUDSTagsConfig(r string, zone string) string { - return fmt.Sprintf(` - resource "outscale_load_balancer" "bar" { - subregion_names = ["%s"] - load_balancer_name = "foobar-terraform-elb-%s" - - listeners { - backend_port = 8000 - backend_protocol = "HTTP" - load_balancer_port = 80 - load_balancer_protocol = "HTTP" - } - - tags { - key = "name" - value = "baz" - } - } - - - data "outscale_load_balancer_tags" "testds" { - load_balancer_names = ["${outscale_load_balancer.bar.id}"] - } - `, zone, r) -} diff --git a/outscale/provider.go b/outscale/provider.go index 23d1b2baf..87ae9061b 100644 --- a/outscale/provider.go +++ b/outscale/provider.go @@ -148,7 +148,6 @@ func Provider() *schema.Provider { "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(), From cc8447cd88633add6c9fd124d2645c446d8603b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Tue, 14 Mar 2023 14:27:17 +0000 Subject: [PATCH 82/82] Fix testacc for us-east-2 --- ...urce_outscale_snapshot_export_task_test.go | 40 ++++++++++--------- outscale/resource_outscale_vm_test.go | 10 ++--- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/outscale/resource_outscale_snapshot_export_task_test.go b/outscale/resource_outscale_snapshot_export_task_test.go index 00a14cf23..172ff4687 100644 --- a/outscale/resource_outscale_snapshot_export_task_test.go +++ b/outscale/resource_outscale_snapshot_export_task_test.go @@ -2,6 +2,7 @@ package outscale import ( "fmt" + "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" @@ -14,6 +15,7 @@ func TestAccOutscaleOAPISnapshotExportTask_basic(t *testing.T) { acctest.RandomWithPrefix("terraform-export-bucket-"), acctest.RandomWithPrefix("terraform-export-bucket-"), } + region := os.Getenv("OUTSCALE_REGION") tags := `tags { key = "test" value = "test" @@ -29,13 +31,13 @@ func TestAccOutscaleOAPISnapshotExportTask_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPISnapshotExportTaskConfig("", osuBucketNames[0]), + Config: testAccOutscaleOAPISnapshotExportTaskConfig(region, "", osuBucketNames[0]), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPISnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), ), }, { - Config: testAccOutscaleOAPISnapshotExportTaskConfig(tags, osuBucketNames[1]), + Config: testAccOutscaleOAPISnapshotExportTaskConfig(region, tags, osuBucketNames[1]), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPISnapshotExportTaskExists("outscale_snapshot_export_task.outscale_snapshot_export_task"), ), @@ -59,23 +61,23 @@ func testAccCheckOutscaleOAPISnapshotExportTaskExists(n string) resource.TestChe } } -func testAccOutscaleOAPISnapshotExportTaskConfig(tags, osuBucketName string) string { +func testAccOutscaleOAPISnapshotExportTaskConfig(region, tags, osuBucketName string) string { return fmt.Sprintf(` - resource "outscale_volume" "outscale_volume_snap" { - subregion_name = "eu-west-2a" - size = 10 -} -resource "outscale_snapshot" "outscale_snapshot" { - volume_id = outscale_volume.outscale_volume_snap.volume_id -} -resource "outscale_snapshot_export_task" "outscale_snapshot_export_task" { - snapshot_id = outscale_snapshot.outscale_snapshot.snapshot_id - osu_export { - disk_image_format = "qcow2" - osu_bucket = "%[2]s" - osu_prefix = "new-export" + resource "outscale_volume" "outscale_volume_snap" { + subregion_name = "%[1]sa" + size = 10 } - %[1]s -} - `, tags, osuBucketName) + resource "outscale_snapshot" "outscale_snapshot" { + volume_id = outscale_volume.outscale_volume_snap.volume_id + } + resource "outscale_snapshot_export_task" "outscale_snapshot_export_task" { + snapshot_id = outscale_snapshot.outscale_snapshot.snapshot_id + osu_export { + disk_image_format = "qcow2" + osu_bucket = "%[3]s" + osu_prefix = "new-export" + } + %[2]s + } + `, region, tags, osuBucketName) } diff --git a/outscale/resource_outscale_vm_test.go b/outscale/resource_outscale_vm_test.go index a7fa6520f..874ead8f5 100644 --- a/outscale/resource_outscale_vm_test.go +++ b/outscale/resource_outscale_vm_test.go @@ -186,14 +186,14 @@ func TestAccOutscaleOAPIVM_withNics(t *testing.T) { var server oscgo.Vm omi := os.Getenv("OUTSCALE_IMAGEID") keypair := os.Getenv("OUTSCALE_KEYPAIR") - + region := os.Getenv("OUTSCALE_REGION") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, "tinav4.c2r2p2", keypair), + Config: testAccCheckOutscaleOAPIVMConfigBasicWithNics(region, omi, "tinav4.c2r2p2", keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &server), testAccCheckOutscaleOAPIVMAttributes(t, &server, omi), @@ -695,7 +695,7 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, vmType, region, k }`, omi, vmType, region, keypair) } -func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair string) string { +func testAccCheckOutscaleOAPIVMConfigBasicWithNics(region, omi, vmType, keypair string) string { return fmt.Sprintf(`resource "outscale_net" "outscale_net" { ip_range = "10.0.0.0/16" } @@ -703,7 +703,7 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair string) resource "outscale_subnet" "outscale_subnet" { net_id = outscale_net.outscale_net.net_id ip_range = "10.0.0.0/24" - subregion_name = "eu-west-2a" + subregion_name = "%sa" } resource "outscale_nic" "outscale_nic" { @@ -736,7 +736,7 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair string) is_primary = false } } - }`, omi, vmType, keypair) + }`, region, omi, vmType, keypair) } func testAccVmsConfigUpdateOAPIVMTags(omi, vmType string, region, value, keypair, sgId string) string {