From b8ef7e0d66373be41f52ff4c97034447c79ca037 Mon Sep 17 00:00:00 2001 From: Thiery Ouattara Date: Wed, 17 Jan 2024 15:48:46 +0000 Subject: [PATCH 1/3] Enable detect SG manually configure on a new plan --- outscale/data_source_outscale_vm.go | 7 +++---- outscale/resource_outscale_nic.go | 30 ++++++++--------------------- outscale/resource_outscale_vm.go | 10 +++++----- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/outscale/data_source_outscale_vm.go b/outscale/data_source_outscale_vm.go index c41ffde14..021bf86d0 100644 --- a/outscale/data_source_outscale_vm.go +++ b/outscale/data_source_outscale_vm.go @@ -171,8 +171,7 @@ func oapiVMDescriptionAttributes(set AttributeSetter, vm *oscgo.Vm) error { if err := set("root_device_type", vm.GetRootDeviceType()); err != nil { return err } - if err := set("security_groups", getOAPIVMSecurityGroups(vm.GetSecurityGroups())); err != nil { - log.Printf("[DEBUG] SECURITY GROUPS ERR %+v", err) + if err := set("security_groups", getSecurityGroups(vm.GetSecurityGroups())); err != nil { return err } if err := set("state", vm.GetState()); err != nil { @@ -216,7 +215,7 @@ func getOscAPIVMBlockDeviceMapping(blockDeviceMappings []oscgo.BlockDeviceMappin return blockDeviceMapping } -func getOAPIVMSecurityGroups(groupSet []oscgo.SecurityGroupLight) []map[string]interface{} { +func getSecurityGroups(groupSet []oscgo.SecurityGroupLight) []map[string]interface{} { res := []map[string]interface{}{} for _, g := range groupSet { r := map[string]interface{}{ @@ -229,7 +228,7 @@ func getOAPIVMSecurityGroups(groupSet []oscgo.SecurityGroupLight) []map[string]i return res } -func getVMSecurityGroupIds(sgIds []oscgo.SecurityGroupLight) []string { +func getSecurityGroupIds(sgIds []oscgo.SecurityGroupLight) []string { res := make([]string, len(sgIds)) for k, ids := range sgIds { res[k] = ids.GetSecurityGroupId() diff --git a/outscale/resource_outscale_nic.go b/outscale/resource_outscale_nic.go index 43ecc1375..5b123c2e9 100644 --- a/outscale/resource_outscale_nic.go +++ b/outscale/resource_outscale_nic.go @@ -51,7 +51,7 @@ func getOAPINicSchema() map[string]*schema.Schema { Computed: true, }, "security_group_ids": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -246,16 +246,9 @@ func resourceOutscaleOAPINicCreate(d *schema.ResourceData, meta interface{}) err if v, ok := d.GetOk("description"); ok { request.SetDescription(v.(string)) } - - if v, ok := d.GetOk("security_group_ids"); ok { - m := v.([]interface{}) - a := make([]string, len(m)) - for k, v := range m { - a[k] = v.(string) - } - request.SetSecurityGroupIds(a) + if sgIDs := utils.SetToStringSlice(d.Get("security_group_ids").(*schema.Set)); len(sgIDs) > 0 { + request.SetSecurityGroupIds(sgIDs) } - if v, ok := d.GetOk("private_ips"); ok { request.SetPrivateIps(expandPrivateIPLight(v.(*schema.Set).List())) } @@ -380,18 +373,12 @@ func resourceOutscaleOAPINicRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("subregion_name", eni.GetSubregionName()); err != nil { return err } - - x := make([]map[string]interface{}, len(eni.GetSecurityGroups())) - for k, v := range eni.GetSecurityGroups() { - b := make(map[string]interface{}) - b["security_group_id"] = v.GetSecurityGroupId() - b["security_group_name"] = v.GetSecurityGroupName() - x[k] = b + if err := d.Set("security_groups", getSecurityGroups(eni.GetSecurityGroups())); err != nil { + return err } - if err := d.Set("security_groups", x); err != nil { + if err := d.Set("security_group_ids", getSecurityGroupIds(eni.GetSecurityGroups())); err != nil { return err } - if err := d.Set("mac_address", eni.GetMacAddress()); err != nil { return err } @@ -660,11 +647,10 @@ func resourceOutscaleOAPINicUpdate(d *schema.ResourceData, meta interface{}) err } if d.HasChange("security_group_ids") { - stringValueList := utils.InterfaceSliceToStringSlice(d.Get("security_group_ids").([]interface{})) request := oscgo.UpdateNicRequest{ - NicId: d.Id(), - SecurityGroupIds: &stringValueList, + NicId: d.Id(), } + request.SetSecurityGroupIds(utils.SetToStringSlice(d.Get("security_group_ids").(*schema.Set))) err = resource.Retry(5*time.Minute, func() *resource.RetryError { _, httpResp, err := conn.NicApi.UpdateNic(context.Background()).UpdateNicRequest(request).Execute() diff --git a/outscale/resource_outscale_vm.go b/outscale/resource_outscale_vm.go index abf3f51ed..67a59dba2 100644 --- a/outscale/resource_outscale_vm.go +++ b/outscale/resource_outscale_vm.go @@ -538,7 +538,7 @@ func resourceOutscaleOApiVM() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, }, "security_group_names": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -862,8 +862,8 @@ func resourceOAPIVMRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("admin_password", adminPassword); err != nil { return err } - if len(utils.SetToStringSlice(d.Get("security_group_ids").(*schema.Set))) > 0 { - if err := set("security_group_ids", getVMSecurityGroupIds(vm.GetSecurityGroups())); err != nil { + if nics := buildNetworkOApiInterfaceOpts(d); len(nics) == 0 { + if err := set("security_group_ids", getSecurityGroupIds(vm.GetSecurityGroups())); err != nil { return err } } @@ -997,7 +997,7 @@ func resourceOAPIVMUpdate(d *schema.ResourceData, meta interface{}) error { if d.HasChange("security_group_names") && !d.IsNewResource() { opts := oscgo.UpdateVmRequest{VmId: id} - opts.SetSecurityGroupIds(utils.InterfaceSliceToStringSlice(d.Get("security_group_names").([]interface{}))) + opts.SetSecurityGroupIds(utils.SetToStringSlice(d.Get("security_group_names").(*schema.Set))) if err := updateVmAttr(conn, opts); err != nil { return err } @@ -1180,7 +1180,7 @@ func buildCreateVmsRequest(d *schema.ResourceData, meta interface{}) (oscgo.Crea request.SetSecurityGroupIds(sgIDs) } - if sgNames := utils.InterfaceSliceToStringSlice(d.Get("security_group_names").([]interface{})); len(sgNames) > 0 { + if sgNames := utils.SetToStringSlice(d.Get("security_group_names").(*schema.Set)); len(sgNames) > 0 { request.SetSecurityGroups(sgNames) } From 99746148cca60f30b0568b005b28ef8d04c7fb1a Mon Sep 17 00:00:00 2001 From: Thiery Ouattara Date: Wed, 24 Jan 2024 10:20:51 +0000 Subject: [PATCH 2/3] update testsAcc --- outscale/data_source_outscale_image_test.go | 11 +++ outscale/data_source_outscale_images_test.go | 12 +++ .../data_source_outscale_public_ip_test.go | 11 +++ outscale/data_source_outscale_tag_test.go | 16 +++- .../data_source_outscale_vm_state_test.go | 21 ++++- outscale/data_source_outscale_vm_test.go | 16 +++- .../data_source_outscale_vm_types_test.go | 13 ++- outscale/data_source_outscale_vms_test.go | 11 +++ outscale/data_source_outscale_volumes_test.go | 13 ++- ...esource_outscale_flexible_gpu_link_test.go | 12 ++- ...esource_outscale_image_export_task_test.go | 11 +++ ...e_outscale_image_launch_permission_test.go | 66 +++++--------- outscale/resource_outscale_image_test.go | 10 +++ ...esource_outscale_load_balancer_vms_test.go | 60 +++++++++++++ outscale/resource_outscale_nic_link_test.go | 7 +- .../resource_outscale_public_ip_link_test.go | 34 +++---- outscale/resource_outscale_public_ip_test.go | 76 +++------------- .../resource_outscale_route_table_test.go | 8 ++ outscale/resource_outscale_vm_test.go | 90 +++++++++++++++---- .../resource_outscale_volumes_link_test.go | 5 ++ 20 files changed, 335 insertions(+), 168 deletions(-) diff --git a/outscale/data_source_outscale_image_test.go b/outscale/data_source_outscale_image_test.go index 66915851c..19d30f485 100644 --- a/outscale/data_source_outscale_image_test.go +++ b/outscale/data_source_outscale_image_test.go @@ -49,11 +49,22 @@ func testAccCheckOutscaleOAPIImageDataSourceID(n string) resource.TestCheckFunc func testAccCheckOutscaleOAPIImageDataSourceBasicConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_img_data" { + security_group_name = "sg_imgData" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basicIm" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "terraform-basic" placement_subregion_name = "%[3]sa" + security_group_ids = [outscale_security_group.sg_img_data.security_group_id] } resource "outscale_image" "image" { diff --git a/outscale/data_source_outscale_images_test.go b/outscale/data_source_outscale_images_test.go index ebcd9580c..e59467e3a 100644 --- a/outscale/data_source_outscale_images_test.go +++ b/outscale/data_source_outscale_images_test.go @@ -49,11 +49,22 @@ func testAccCheckOutscaleOAPIImagesDataSourceID(n string) resource.TestCheckFunc func testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, vmType, region, imageName string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_imgs_data" { + security_group_name = "sg_imgsData" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basic_one" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "terraform-basic" placement_subregion_name = "%[3]sa" + security_group_ids = [outscale_security_group.sg_imgs_data.security_group_id] } resource "outscale_vm" "basic_two" { @@ -61,6 +72,7 @@ func testAccCheckOutscaleOAPIImagesDataSourceConfig(omi, vmType, region, imageNa vm_type = "%[2]s" keypair_name = "terraform-basic" placement_subregion_name = "%[3]sa" + security_group_ids = [outscale_security_group.sg_imgs_data.security_group_id] } resource "outscale_image" "image_one" { diff --git a/outscale/data_source_outscale_public_ip_test.go b/outscale/data_source_outscale_public_ip_test.go index bf8c0a5a4..a9e0f0be6 100644 --- a/outscale/data_source_outscale_public_ip_test.go +++ b/outscale/data_source_outscale_public_ip_test.go @@ -128,10 +128,21 @@ const testAccDataSourceOutscaleOAPIPublicIPConfigWithTags = ` func testAccDataSourceOutscaleOAPIPublicIPConfigwithVM(omi, region string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_Pbip" { + security_group_name = "sg_data_ip" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "outscale_vm" { image_id = "%s" vm_type = "tinav4.c2r2p2" keypair_name = "terraform-basic" + security_group_ids = [outscale_security_group.sg_Pbip.security_group_id] } resource "outscale_public_ip" "outscale_public_ip" { diff --git a/outscale/data_source_outscale_tag_test.go b/outscale/data_source_outscale_tag_test.go index 20c5e513e..ae5daae18 100644 --- a/outscale/data_source_outscale_tag_test.go +++ b/outscale/data_source_outscale_tag_test.go @@ -33,11 +33,21 @@ func TestAccVM_WithTagDataSource(t *testing.T) { // Lookup based on InstanceID func testAccOAPITagDataSourceConfig(omi, vmType string) string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { + resource "outscale_security_group" "sg_vm_tag" { + security_group_name = "sg_tag" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + + resource "outscale_vm" "basicTag" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" - + security_group_ids = [outscale_security_group.sg_vm_tag.security_group_id] tags { key = "Name" value = "test-vm" @@ -47,7 +57,7 @@ func testAccOAPITagDataSourceConfig(omi, vmType string) string { data "outscale_tag" "web" { filter { name = "resource_ids" - values = [outscale_vm.basic.id] + values = [outscale_vm.basicTag.id] } } `, omi, vmType) diff --git a/outscale/data_source_outscale_vm_state_test.go b/outscale/data_source_outscale_vm_state_test.go index 876105c18..db12fb266 100644 --- a/outscale/data_source_outscale_vm_state_test.go +++ b/outscale/data_source_outscale_vm_state_test.go @@ -35,7 +35,7 @@ func testAccDataSourceOutscaleOAPIVMStateCheck(name string) resource.TestCheckFu return fmt.Errorf("root module has no resource called %s", name) } - vm, ok := s.RootModule().Resources["outscale_vm.basic"] + vm, ok := s.RootModule().Resources["outscale_vm.basic_state"] if !ok { return fmt.Errorf("can't find outscale_public_ip.test in state") } @@ -55,17 +55,32 @@ func testAccDataSourceOutscaleOAPIVMStateCheck(name string) resource.TestCheckFu func testAccDataSourceOutscaleOAPIVmStateConfig(omi, vmType string) string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { + resource "outscale_security_group" "sg_vm_state" { + security_group_name = "sg_vmState" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + + resource "outscale_vm" "basic_state" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" + security_group_ids = [outscale_security_group.sg_vm_state.security_group_id] } data "outscale_vm_state" "state" { all_vms = false filter { name = "vm_ids" - values = [outscale_vm.basic.id] + values = [outscale_vm.basic_state.id] + } + filter { + name = "vm_states" + values = ["running"] } } `, omi, vmType) diff --git a/outscale/data_source_outscale_vm_test.go b/outscale/data_source_outscale_vm_test.go index 6b13a3383..6b5174ac3 100644 --- a/outscale/data_source_outscale_vm_test.go +++ b/outscale/data_source_outscale_vm_test.go @@ -32,22 +32,32 @@ func TestAccVM_DataSource_basic(t *testing.T) { func testAccOAPIVMDataSourceConfig(omi, vmType, region string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_vm_data" { + security_group_name = "sg_vm_basic" + description = "Used in the terraform acceptance tests" - resource "outscale_vm" "outscale_vm" { + tags { + key = "Name" + value = "tf-acc-test" + } + } + + resource "outscale_vm" "outscale_vm_data" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "terraform-basic" - + security_group_ids = [outscale_security_group.sg_vm_data.security_group_id] tags { key = "name" value = "Terraform-VM" } + } data "outscale_vm" "basic_web" { filter { name = "vm_ids" - values = [outscale_vm.outscale_vm.vm_id] + values = [outscale_vm.outscale_vm_data.vm_id] } } `, omi, vmType, region) diff --git a/outscale/data_source_outscale_vm_types_test.go b/outscale/data_source_outscale_vm_types_test.go index 86e990399..1b908ca41 100644 --- a/outscale/data_source_outscale_vm_types_test.go +++ b/outscale/data_source_outscale_vm_types_test.go @@ -27,10 +27,21 @@ func TestAccVM_TypesDataSource_basic(t *testing.T) { func testAccDataSourceOutscaleOAPIVMTypesConfig(omi, vmType string) string { return fmt.Sprintf(` - resource "outscale_vm" "basic" { + resource "outscale_security_group" "sg_vms_types" { + security_group_name = "sg_vm_type" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + + resource "outscale_vm" "basic_types" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" + security_group_ids = [outscale_security_group.sg_vms_types.security_group_id] } data "outscale_vm_types" "vm_types" { diff --git a/outscale/data_source_outscale_vms_test.go b/outscale/data_source_outscale_vms_test.go index 20cfa0d3d..c9b07b583 100644 --- a/outscale/data_source_outscale_vms_test.go +++ b/outscale/data_source_outscale_vms_test.go @@ -31,10 +31,21 @@ func TestAccVMS_DataSource_basic(t *testing.T) { func testAccOAPIVMSDataSourceConfig(omi, vmType string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_vms" { + security_group_name = "sg_vms_test" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basic" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" + security_group_ids = [outscale_security_group.sg_vms.security_group_id] } data "outscale_vms" "basic_web" { diff --git a/outscale/data_source_outscale_volumes_test.go b/outscale/data_source_outscale_volumes_test.go index b2a6e8da0..75e75cc81 100644 --- a/outscale/data_source_outscale_volumes_test.go +++ b/outscale/data_source_outscale_volumes_test.go @@ -50,14 +50,13 @@ func TestAccVM_withVolumesDataSource(t *testing.T) { t.Parallel() 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(utils.GetRegion(), omi, keypair, sgId), + Config: testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(utils.GetRegion(), omi, keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIVolumeDataSourceID("data.outscale_volumes.outscale_volumes"), // resource.TestCheckResourceAttr("data.outscale_volumes.outscale_volumes", "volumes.0.size", "1"), @@ -116,7 +115,7 @@ func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithMultipleVolumeIDsFilter( `, region) } -func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keypair, sgId string) string { +func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keypair string) string { return fmt.Sprintf(` resource "outscale_volume" "outscale_volume" { subregion_name = "%[1]sa" @@ -148,8 +147,8 @@ func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keyp } } - resource "outscale_security_group" "sg" { - security_group_name = "%[3]s" + resource "outscale_security_group" "sg_volumes" { + security_group_name = "sg_vols" description = "Used in the terraform acceptance tests" tags { @@ -161,7 +160,7 @@ func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keyp resource "outscale_vm" "outscale_vm" { image_id = "%[2]s" keypair_name = "%[3]s" - security_group_ids = ["%[4]s"] + security_group_ids = [outscale_security_group.sg_volumes.security_group_id] vm_type = "tinav4.c2r2p2" } @@ -189,5 +188,5 @@ func testAccCheckOutscaleOAPIVolumesDataSourceConfigWithVM(region, imageID, keyp values = [outscale_vm.outscale_vm.vm_id] } } - `, region, imageID, keypair, sgId) + `, region, imageID, keypair) } diff --git a/outscale/resource_outscale_flexible_gpu_link_test.go b/outscale/resource_outscale_flexible_gpu_link_test.go index 54e15238f..8c439afed 100644 --- a/outscale/resource_outscale_flexible_gpu_link_test.go +++ b/outscale/resource_outscale_flexible_gpu_link_test.go @@ -27,12 +27,22 @@ func TestAccVM_withFlexibleGpuLink_basic(t *testing.T) { func testAccOutscaleOAPIFlexibleGpuLinkConfig(omi, vmType, region string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_fgpu" { + security_group_name = "sg_GPU" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basic" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" placement_subregion_name = "%[3]sa" - + security_group_ids = [outscale_security_group.sg_fgpu.security_group_id] } resource "outscale_flexible_gpu" "fGPU-1" { diff --git a/outscale/resource_outscale_image_export_task_test.go b/outscale/resource_outscale_image_export_task_test.go index 5aa84df40..5035f2c39 100644 --- a/outscale/resource_outscale_image_export_task_test.go +++ b/outscale/resource_outscale_image_export_task_test.go @@ -67,11 +67,22 @@ func testAccCheckOutscaleOAPImageExportTaskExists(n string) resource.TestCheckFu func testAccOAPIImageExportTaskConfigBasic(omi, vmType, region, imageName, tags string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_task" { + security_group_name = "sg_export_task" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basic" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" placement_subregion_name = "%sa" + security_group_ids = [outscale_security_group.sg_task.security_group_id] } resource "outscale_image" "foo" { diff --git a/outscale/resource_outscale_image_launch_permission_test.go b/outscale/resource_outscale_image_launch_permission_test.go index bb56df987..48a711d8d 100644 --- a/outscale/resource_outscale_image_launch_permission_test.go +++ b/outscale/resource_outscale_image_launch_permission_test.go @@ -17,12 +17,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -func TestAccNet_WithImageLaunchPermission_Basic(t *testing.T) { +func TestAccVM_WithImageLaunchPermission_Basic(t *testing.T) { omi := os.Getenv("OUTSCALE_IMAGEID") region := utils.GetRegion() accountID := os.Getenv("OUTSCALE_ACCOUNT") keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") imageID := "" @@ -34,21 +33,21 @@ func TestAccNet_WithImageLaunchPermission_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), }, // Drop just launch permission to test destruction { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, false, rInt, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, false, rInt, keypair), Check: r.ComposeTestCheckFunc( testAccOutscaleOAPIImageLaunchPermissionDestroyed(accountID, &imageID), ), }, // Re-add everything so we can test when AMI disappears { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -56,7 +55,7 @@ func TestAccNet_WithImageLaunchPermission_Basic(t *testing.T) { // Here we delete the AMI to verify the follow-on refresh after this step // should not error. { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), Check: r.ComposeTestCheckFunc( testAccOutscaleOAPIImageDisappears(&imageID), ), @@ -66,12 +65,11 @@ func TestAccNet_WithImageLaunchPermission_Basic(t *testing.T) { }) } -func TestAccNet_ImageLaunchPermissionDestruction_Basic(t *testing.T) { +func TestAccVM_ImageLaunchPermissionDestruction_Basic(t *testing.T) { omi := os.Getenv("OUTSCALE_IMAGEID") region := utils.GetRegion() accountID := os.Getenv("OUTSCALE_ACCOUNT") keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") var imageID string rInt := acctest.RandInt() @@ -82,14 +80,14 @@ func TestAccNet_ImageLaunchPermissionDestruction_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, false, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, false, keypair), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), testAccOutscaleOAPIImageLaunchPermissionExists(accountID, &imageID), ), }, { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, true, keypair, sgId), + Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, true, keypair), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -184,18 +182,9 @@ func testCheckResourceGetAttr(name, key string, value *string) r.TestCheckFunc { } } -func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, accountID string, includeLaunchPermission bool, r int, keypair, sgId string) string { +func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, accountID string, includeLaunchPermission bool, r int, keypair string) string { base := 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" { + resource "outscale_security_group" "sg_perm" { security_group_name = "%[5]s" description = "Used in the terraform acceptance tests" @@ -203,24 +192,22 @@ func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, account key = "Name" value = "tf-acc-test" } - - net_id = "${outscale_net.net.id}" } resource "outscale_vm" "outscale_instance" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[5]s" - security_group_ids = ["%[6]s"] + security_group_ids = [outscale_security_group.sg_perm.security_group_id] placement_subregion_name = "%[3]sa" } resource "outscale_image" "outscale_image" { image_name = "terraform test-123-%[4]d" - vm_id = "${outscale_vm.outscale_instance.id}" + vm_id = outscale_vm.outscale_instance.vm_id no_reboot = "true" } - `, omi, vmType, region, r, keypair, sgId) + `, omi, vmType, region, r, keypair) if !includeLaunchPermission { return base @@ -228,7 +215,7 @@ func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, account return base + fmt.Sprintf(` resource "outscale_image_launch_permission" "outscale_image_launch_permission" { - image_id = "${outscale_image.outscale_image.image_id}" + image_id = outscale_image.outscale_image.image_id permission_additions { account_ids = ["%s"] } @@ -236,18 +223,9 @@ func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, account `, accountID) } -func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region string, r int, includeAddtion, includeRemoval bool, keypair, sgId string) string { +func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region string, r int, includeAddtion, includeRemoval bool, keypair string) string { base := 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" { + resource "outscale_security_group" "sg_prem" { security_group_name = "%[5]s" description = "Used in the terraform acceptance tests" @@ -255,29 +233,27 @@ func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region st key = "Name" value = "tf-acc-test" } - - net_id = "${outscale_net.net.id}" } resource "outscale_vm" "outscale_instance" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[5]s" - security_group_ids = ["%[6]s"] + security_group_ids = [outscale_security_group.sg_perm.security_group_id] placement_subregion_name = "%[3]sa" } resource "outscale_image" "outscale_image" { image_name = "terraform test-123-%[4]d" - vm_id = "${outscale_vm.outscale_instance.id}" + vm_id = outscale_vm.outscale_instance.vm_id no_reboot = "true" } - `, omi, vmType, region, r, keypair, sgId) + `, omi, vmType, region, r, keypair) if includeAddtion { return base + ` resource "outscale_image_launch_permission" "outscale_image_launch_permission" { - image_id = "${outscale_image.outscale_image.image_id}" + image_id = outscale_image.outscale_image.image_id permission_additions { account_ids = ["520679080430"] @@ -289,7 +265,7 @@ func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region st if includeRemoval { return base + ` resource "outscale_image_launch_permission" "outscale_image_launch_permission_two" { - image_id = "${outscale_image_launch_permission.outscale_image_launch_permission.image_id}" + image_id = outscale_image_launch_permission.outscale_image_launch_permission.image_id permission_removals { account_ids = ["520679080430"] diff --git a/outscale/resource_outscale_image_test.go b/outscale/resource_outscale_image_test.go index 1ec51e562..5e82ccaa2 100644 --- a/outscale/resource_outscale_image_test.go +++ b/outscale/resource_outscale_image_test.go @@ -110,10 +110,20 @@ func testAccCheckOAPIImageExists(n string, ami *oscgo.Image) resource.TestCheckF func testAccOAPIImageConfigBasic(omi, vmType, region string, rInt int) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_img" { + security_group_name = "terraform_test_img" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } + } + resource "outscale_vm" "basic" { image_id = "%[1]s" vm_type = "%[2]s" placement_subregion_name = "%[3]sa" + security_group_ids = [outscale_security_group.sg_img.security_group_id] } resource "outscale_volume" "snap_volume" { subregion_name = "%[3]sa" diff --git a/outscale/resource_outscale_load_balancer_vms_test.go b/outscale/resource_outscale_load_balancer_vms_test.go index d67d5bf19..e682df8c2 100644 --- a/outscale/resource_outscale_load_balancer_vms_test.go +++ b/outscale/resource_outscale_load_balancer_vms_test.go @@ -74,14 +74,34 @@ resource "outscale_load_balancer" "bar" { } } +resource "outscale_security_group" "sg_lb1" { + security_group_name = "terraform_test_lb01" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } +} + resource "outscale_vm" "foo1" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb1.security_group_id] +} + +resource "outscale_security_group" "sg_lb02" { + security_group_name = "terraform_test_lb02" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } } resource "outscale_vm" "foo2" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb02.security_group_id] } resource "outscale_load_balancer_vms" "foo1" { @@ -104,14 +124,34 @@ resource "outscale_load_balancer" "bar" { } } +resource "outscale_security_group" "sg_lb1" { + security_group_name = "terraform_test_lb01" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } +} + resource "outscale_vm" "foo1" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb1.security_group_id] +} + +resource "outscale_security_group" "sg_lb02" { + security_group_name = "terraform_test_lb02" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } } resource "outscale_vm" "foo2" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb02.security_group_id] } resource "outscale_load_balancer_vms" "foo1" { @@ -134,14 +174,34 @@ resource "outscale_load_balancer" "bar" { } } +resource "outscale_security_group" "sg_lb1" { + security_group_name = "terraform_test_lb01" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } +} + resource "outscale_vm" "foo1" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb1.security_group_id] +} + +resource "outscale_security_group" "sg_lb02" { + security_group_name = "terraform_test_lb02" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } } resource "outscale_vm" "foo2" { image_id = "%[2]s" vm_type = "tinav4.c1r1p1" + security_group_ids = [outscale_security_group.sg_lb02.security_group_id] } resource "outscale_load_balancer_vms" "foo1" { diff --git a/outscale/resource_outscale_nic_link_test.go b/outscale/resource_outscale_nic_link_test.go index 56525d554..aaacf80ca 100644 --- a/outscale/resource_outscale_nic_link_test.go +++ b/outscale/resource_outscale_nic_link_test.go @@ -137,7 +137,7 @@ func testAccOutscaleNicLinkConfigBasic(sg int, omi, vmType, region string) strin } } - resource "outscale_security_group" "outscale_security_group" { + resource "outscale_security_group" "security_group_nic" { security_group_name = "terraform_test_%d" description = "Used in the terraform acceptance tests" net_id = outscale_net.net.id @@ -152,7 +152,7 @@ func testAccOutscaleNicLinkConfigBasic(sg int, omi, vmType, region string) strin image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" - security_group_ids = [outscale_security_group.outscale_security_group.id] + security_group_ids = [outscale_security_group.security_group_nic.security_group_id] placement_subregion_name = "%[4]sa" subnet_id = outscale_subnet.outscale_subnet.id } @@ -161,12 +161,11 @@ func testAccOutscaleNicLinkConfigBasic(sg int, omi, vmType, region string) strin subregion_name = "%[4]sa" ip_range = "10.0.0.0/16" net_id = outscale_net.net.id - - depends_on = [outscale_security_group.outscale_security_group] } resource "outscale_nic" "outscale_nic" { subnet_id = outscale_subnet.outscale_subnet.subnet_id + security_group_ids = [outscale_security_group.security_group_nic.security_group_id] } resource "outscale_nic_link" "outscale_nic_link" { diff --git a/outscale/resource_outscale_public_ip_link_test.go b/outscale/resource_outscale_public_ip_link_test.go index 38293b2e5..5fc2f4797 100644 --- a/outscale/resource_outscale_public_ip_link_test.go +++ b/outscale/resource_outscale_public_ip_link_test.go @@ -17,11 +17,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -func TestAccNet_WithPublicIPLink_basic(t *testing.T) { +func TestAccVM_WithPublicIPLink_basic(t *testing.T) { var a oscgo.PublicIp omi := os.Getenv("OUTSCALE_IMAGEID") keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -29,10 +28,10 @@ func TestAccNet_WithPublicIPLink_basic(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPIPublicIPLinkDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPLinkConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair, sgId), + Config: testAccOutscaleOAPIPublicIPLinkConfig(omi, "tinav4.c2r2p2", utils.GetRegion(), keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIPublicIPLExists( - "outscale_public_ip.ip", &a), + "outscale_public_ip.ip_link", &a), testAccCheckOutscaleOAPIPublicIPLinkExists( "outscale_public_ip_link.by_public_ip", &a), ), @@ -211,18 +210,9 @@ func testAccCheckOutscaleOAPIPublicIPLExists(n string, res *oscgo.PublicIp) reso } } -func testAccOutscaleOAPIPublicIPLinkConfig(omi, vmType, region, keypair, sgId string) string { +func testAccOutscaleOAPIPublicIPLinkConfig(omi, vmType, region, keypair 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" { + resource "outscale_security_group" "sg_link" { security_group_name = "%[4]s" description = "Used in the terraform acceptance tests" @@ -230,23 +220,21 @@ func testAccOutscaleOAPIPublicIPLinkConfig(omi, vmType, region, keypair, sgId st key = "Name" value = "tf-acc-test" } - - net_id = "${outscale_net.net.id}" } - resource "outscale_vm" "vm" { + resource "outscale_vm" "vm_link" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" - security_group_ids = ["%[5]s"] + security_group_ids = [outscale_security_group.sg_link.security_group_id] placement_subregion_name = "%[3]sa" } - resource "outscale_public_ip" "ip" {} + resource "outscale_public_ip" "ip_link" {} resource "outscale_public_ip_link" "by_public_ip" { - public_ip = "${outscale_public_ip.ip.public_ip}" - vm_id = "${outscale_vm.vm.id}" + public_ip = outscale_public_ip.ip_link.public_ip + vm_id = outscale_vm.vm_link.id } - `, omi, vmType, region, keypair, sgId) + `, omi, vmType, region, keypair) } diff --git a/outscale/resource_outscale_public_ip_test.go b/outscale/resource_outscale_public_ip_test.go index 77ada4b67..823c800da 100644 --- a/outscale/resource_outscale_public_ip_test.go +++ b/outscale/resource_outscale_public_ip_test.go @@ -36,33 +36,24 @@ func TestAccOthers_PublicIP_basic(t *testing.T) { }) } -func TestAccNet_PublicIP_instance(t *testing.T) { +func TestAccVM_PublicIP_instance(t *testing.T) { t.Parallel() var conf oscgo.PublicIp omi := os.Getenv("OUTSCALE_IMAGEID") region := utils.GetRegion() keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") //rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "outscale_public_ip.bar", + IDRefreshName: "outscale_public_ip.bar1", Providers: testAccProviders, CheckDestroy: testAccCheckOutscaleOAPIPublicIPDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPInstanceConfig(omi, "tinav4.c2r2p2", region, keypair, sgId), + Config: testAccOutscaleOAPIPublicIPInstanceConfig(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &conf), - testAccCheckOutscaleOAPIPublicIPAttributes(&conf), - ), - }, - - { - Config: testAccOutscaleOAPIPublicIPInstanceConfig2(omi, "tinav4.c2r2p2", region, keypair, sgId), - Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &conf), + testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar1", &conf), testAccCheckOutscaleOAPIPublicIPAttributes(&conf), ), }, @@ -263,74 +254,33 @@ resource "outscale_public_ip" "bar" { } ` -func testAccOutscaleOAPIPublicIPInstanceConfig(omi, vmType, region, keypair, sgId string) string { +func testAccOutscaleOAPIPublicIPInstanceConfig(omi, vmType, region, keypair 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" + resource "outscale_security_group" "sg_ip" { + security_group_name = "sg_publicIp" 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"] + security_group_ids = [outscale_security_group.sg_ip.security_group_id] placement_subregion_name = "%[3]sa" } - resource "outscale_public_ip" "bar" {} - `, omi, vmType, region, keypair, sgId) -} + resource "outscale_public_ip" "bar1" {} -func testAccOutscaleOAPIPublicIPInstanceConfig2(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]sa" + resource "outscale_public_ip_link" "public_ip_link" { + vm_id = outscale_vm.basic.vm_id + public_ip = outscale_public_ip.bar1.public_ip } - - resource "outscale_public_ip" "bar" {} - `, omi, vmType, region, keypair, sgId) + `, omi, vmType, region, keypair) } func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, keypair, sgId string) string { diff --git a/outscale/resource_outscale_route_table_test.go b/outscale/resource_outscale_route_table_test.go index d39bf54bf..38aafeebf 100644 --- a/outscale/resource_outscale_route_table_test.go +++ b/outscale/resource_outscale_route_table_test.go @@ -419,6 +419,13 @@ func testAccOAPIRouteTableConfigInstance(omi, vmType, region string) string { net_id = outscale_net.foo.id } + resource "outscale_security_group" "sg_route" { + description = "testAcc Terraform security group" + security_group_name = "sgRoute" + net_id = outscale_net.foo.net_id + + } + resource "outscale_vm" "foo" { image_id = "%s" vm_type = "%s" @@ -426,6 +433,7 @@ func testAccOAPIRouteTableConfigInstance(omi, vmType, region string) string { subnet_id = outscale_subnet.foo.id placement_subregion_name = "%sa" placement_tenancy = "default" + security_group_ids = [outscale_security_group.sg_route.security_group_id] } resource "outscale_route_table" "foo" { diff --git a/outscale/resource_outscale_vm_test.go b/outscale/resource_outscale_vm_test.go index a9178afb5..2cd75d8ac 100644 --- a/outscale/resource_outscale_vm_test.go +++ b/outscale/resource_outscale_vm_test.go @@ -209,7 +209,6 @@ func TestAccVM_UpdateKeypair(t *testing.T) { t.Parallel() omi := os.Getenv("OUTSCALE_IMAGEID") keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") region := utils.GetRegion() var before oscgo.Vm @@ -221,7 +220,7 @@ func TestAccVM_UpdateKeypair(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPIVMDestroy, Steps: []resource.TestStep{ { - Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region, keypair, sgId), + Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIVMExists("outscale_vm.basic", &before), testAccCheckOutscaleOAPIVMAttributes(t, &before, omi), @@ -230,7 +229,7 @@ func TestAccVM_UpdateKeypair(t *testing.T) { ), }, { - Config: testAccVmsConfigUpdateOAPIVMKey(omi, "tinav4.c2r2p2", region, keypair, sgId), + Config: testAccVmsConfigUpdateOAPIVMKey2(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOAPIVMExists("outscale_vm.basic", &after), testAccCheckOAPIVMNotRecreated(t, &before, &after), @@ -375,10 +374,16 @@ func testAccCheckOutscaleVMWithMultiBlockDeviceMapping(region, omi, keypair stri volume_id = outscale_volume.example.id } + resource "outscale_security_group" "sg_device" { + description = "testAcc Terraform security group" + security_group_name = "sgProtection" + } + resource "outscale_vm" "outscale_vm" { image_id = "%s" vm_type = "tinav4.c2r2p2" keypair_name = "%s" + security_group_ids = [outscale_security_group.sg_device.security_group_id] block_device_mappings { device_name = "/dev/sda1" # resizing bootdisk volume @@ -419,11 +424,18 @@ func testAccCheckOutscaleVMWithMultiBlockDeviceMapping(region, omi, keypair stri func testAccCheckOutscaleDeletionProtectionUpdateBasic(omi, deletionProtection, keypair string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_protection" { + description = "testAcc Terraform security group" + security_group_name = "sgProtection" + } + resource "outscale_vm" "outscale_vm" { image_id = "%[1]s" vm_type = "tinav4.c2r2p2" keypair_name = "%[3]s" deletion_protection = %[2]s + security_group_ids = [outscale_security_group.sg_protection.security_group_id] + } `, omi, deletionProtection, keypair) } @@ -631,13 +643,16 @@ func testAccCheckOutscaleOAPIVMAttributes(t *testing.T, server *oscgo.Vm, omi st func testAccCheckOutscaleOAPIVMConfigBasic(omi, vmType, region, keypair string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_basicVvm" { + description = "testAcc Terraform security group" + security_group_name = "sgVm" + } resource "outscale_vm" "basic" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" placement_subregion_name = "%[3]s" - #placement_tenancy = "dedicated" - #nested_virtualization = true + security_group_ids = [outscale_security_group.sg_basicVvm.security_group_id] tags { key = "name" value = "Terraform-VM" @@ -647,11 +662,16 @@ func testAccCheckOutscaleOAPIVMConfigBasic(omi, vmType, region, keypair string) func testAccCheckOutscaleOAPIVMConfigImport(omi, vmType, region, keypair string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_import_vm" { + description = "testAcc Terraform security group" + security_group_name = "sg_importVm" + } resource "outscale_vm" "basic_import" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" placement_subregion_name = "%[3]s" + security_group_ids = [outscale_security_group.sg_import_vm.security_group_id] tags { key = "name" @@ -676,6 +696,11 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, vmType, region, k ip_range = "10.0.0.0/24" subregion_name = "%[3]sa" } + resource "outscale_security_group" "security_group7" { + description = "test vm with nic" + security_group_name = "sg_nic5" + net_id = outscale_net.outscale_net.net_id + } resource "outscale_security_group" "outscale_security_group8" { description = "test vm with nic" @@ -685,6 +710,7 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNicAttached(omi, vmType, region, k resource "outscale_nic" "outscale_nic5" { subnet_id = outscale_subnet.outscale_subnet.subnet_id + security_group_ids = [outscale_security_group.security_group7.security_group_id] } resource "outscale_vm" "basic" { @@ -722,10 +748,6 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair, region subregion_name = "%[4]sa" } - resource "outscale_nic" "outscale_nic" { - subnet_id = outscale_subnet.outscale_subnet.subnet_id - } - resource "outscale_security_group" "outscale_security_group" { description = "test vm with nic" security_group_name = "private-sg" @@ -756,10 +778,39 @@ func testAccCheckOutscaleOAPIVMConfigBasicWithNics(omi, vmType, keypair, region }`, omi, vmType, keypair, region) } -func testAccVmsConfigUpdateOAPIVMKey(omi, vmType, region, keypair, sgId string) string { +func testAccVmsConfigUpdateOAPIVMKey(omi, vmType, region string) string { return fmt.Sprintf(` - resource "outscale_security_group" "sg" { - security_group_name = "%[4]s" + resource "outscale_keypair" "keypair01" { + keypair_name = "terraform-keypair-create" + } + resource "outscale_security_group" "sg_keypair" { + security_group_name = "sg_keypair" + description = "Used in the terraform acceptance tests" + + tags { + key = "Name" + value = "tf-acc-test" + } + } + + resource "outscale_vm" "basic" { + image_id = "%[1]s" + vm_type = "%[2]s" + keypair_name = outscale_keypair.keypair01.keypair_name + security_group_ids = [outscale_security_group.sg_keypair.security_group_id] + placement_subregion_name = "%[3]sb" + } + `, omi, vmType, region) +} + +func testAccVmsConfigUpdateOAPIVMKey2(omi, vmType, region, keypair string) string { + return fmt.Sprintf(` + resource "outscale_keypair" "keypair01" { + keypair_name = "terraform-keypair-create" + } + + resource "outscale_security_group" "sg_keypair" { + security_group_name = "sg_keypair" description = "Used in the terraform acceptance tests" tags { @@ -772,20 +823,24 @@ func testAccVmsConfigUpdateOAPIVMKey(omi, vmType, region, keypair, sgId string) image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" - security_group_ids = ["%[5]s"] + security_group_ids = [outscale_security_group.sg_keypair.security_group_id] placement_subregion_name = "%[3]sb" } - `, omi, vmType, region, keypair, sgId) + `, omi, vmType, region, keypair) } func testAccVmsConfigUpdateOAPIVMTags(omi, vmType, region, value, keypair string) string { return fmt.Sprintf(` - + resource "outscale_security_group" "sg_tags_vm" { + description = "testAcc Terraform security group" + security_group_name = "sgTagsVm" + } resource "outscale_vm" "basic" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[5]s" placement_subregion_name = "%[3]sb" + security_group_ids = [outscale_security_group.sg_tags_vm.security_group_id] tags { key = "name" @@ -915,6 +970,10 @@ func assertEqual(t *testing.T, a interface{}, b interface{}, message string) { func testAccCheckOutscaleOAPIVMBehaviorConfigBasic(omi, vmType, region, keypair, perfomance, vmBehavior string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_behavior_vm" { + description = "testAcc Terraform security group" + security_group_name = "sg_behaviorVm" + } resource "outscale_vm" "basicr1" { image_id = "%[1]s" vm_type = "%[2]s" @@ -922,6 +981,7 @@ func testAccCheckOutscaleOAPIVMBehaviorConfigBasic(omi, vmType, region, keypair, placement_subregion_name = "%[3]s" vm_initiated_shutdown_behavior = "%[6]s" performance = "%[5]s" + security_group_ids = [outscale_security_group.sg_behavior_vm.security_group_id] tags { key = "name" diff --git a/outscale/resource_outscale_volumes_link_test.go b/outscale/resource_outscale_volumes_link_test.go index 264f5571e..594abec82 100644 --- a/outscale/resource_outscale_volumes_link_test.go +++ b/outscale/resource_outscale_volumes_link_test.go @@ -112,11 +112,16 @@ func testAccCheckOAPIVolumeAttachmentExists(n string, i *oscgo.Vm, v *oscgo.Volu func testAccOAPIVolumeAttachmentConfig(omi, vmType, region, keypair string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_vol_link" { + description = "testAcc Terraform security group" + security_group_name = "sg_volumes_link" + } resource "outscale_vm" "web" { image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" placement_subregion_name = "%[3]sb" + security_group_ids = [outscale_security_group.sg_vol_link.security_group_id] } resource "outscale_volume" "volume" { From a68bf8c4491751fe973d058d4b9c56a7d58660c6 Mon Sep 17 00:00:00 2001 From: Thiery Ouattara Date: Tue, 30 Jan 2024 12:44:25 +0000 Subject: [PATCH 3/3] Update integration tests --- outscale/data_source_outscale_nic_test.go | 61 ++- outscale/data_source_outscale_nics_test.go | 10 +- outscale/data_source_outscale_subnet_test.go | 8 + .../data_source_outscale_vm_states_test.go | 7 + ...e_outscale_image_launch_permission_test.go | 53 ++- .../resource_outscale_nic_private_ip_test.go | 17 +- outscale/resource_outscale_public_ip_test.go | 47 +- ...i_access_rule_datasource_attributes_ok.ref | 8 +- ..._access_rules_datasource_attributes_ok.ref | 44 +- ...ient_gateways_datasource_attributes_ok.ref | 24 +- ...ient_gateways_datasource_attributes_ok.ref | 58 +-- ....flexible_gpu_datasource_attributes_ok.ref | 45 +- ...1.flexible_gpu_datasource_attributes_ok.tf | 6 + ...e_gpu_catalog_datasource_attributes_ok.ref | 46 +- ...exible_gpu_link_resource_attributes_ok.ref | 45 +- ...lexible_gpu_link_resource_attributes_ok.tf | 8 +- ...flexible_gpus_datasource_attributes_ok.ref | 45 +- ....flexible_gpus_datasource_attributes_ok.tf | 6 + .../step1.image_datasource_attributes_ok.ref | 47 +- .../step1.image_datasource_attributes_ok.tf | 8 +- ...ge_no-reboot_resource_std_attributes_ok.tf | 13 +- ...unch_permission_resource_attributes_ok.ref | 46 +- ...aunch_permission_resource_attributes_ok.tf | 6 + .../step1.images_datasource_attributes_ok.ref | 47 +- .../step1.images_datasource_attributes_ok.tf | 8 +- .../step2.images_datasource_attributes_ok.ref | 96 ++-- .../step2.images_datasource_attributes_ok.tf | 8 +- ...rnet_services_datasource_attributes_ok.ref | 20 +- ...listener_rule_datasource_attributes_ok.ref | 47 +- ..._listener_rule_datasource_attributes_ok.tf | 11 +- ...r_listener_rule_resource_attributes_ok.ref | 48 +- ...er_listener_rule_resource_attributes_ok.tf | 14 +- ...r_listener_rule_resource_attributes_ok.ref | 48 +- ...er_listener_rule_resource_attributes_ok.tf | 13 +- ...istener_rules_datasource_attributes_ok.ref | 59 ++- ...listener_rules_datasource_attributes_ok.tf | 17 +- ...ncer_vm_health_datasource_attributes_ok.tf | 2 +- ...ad_balancer_vms_resource_attributes_ok.ref | 70 ++- ...oad_balancer_vms_resource_attributes_ok.tf | 6 + ...oad_balancer_vms_resource_remove_vm_ok.ref | 62 ++- ...load_balancer_vms_resource_remove_vm_ok.tf | 8 +- ...tasource_attributes_ok_without_filters.ref | 16 +- ....net_peerings_datasource_attributes_ok.ref | 28 +- .../step1.nic_datasource_attributes_ok.ref | 61 ++- .../step1.nic_datasource_attributes_ok.tf | 94 ++-- .../step1.nic_resource_attributes_ok.ref | 4 +- .../step1.nic_link_resource_attributes_ok.ref | 37 +- .../step1.nic_link_resource_attributes_ok.tf | 3 +- ....nic_private_ip_resource_attributes_ok.ref | 4 +- .../step1.nics_datasource_attributes_ok.ref | 419 ++++++++++++++---- .../step1.nics_datasource_attributes_ok.tf | 4 +- ....route_tables_datasource_attributes_ok.ref | 20 +- ...step1.subnets_datasource_attributes_ok.ref | 42 +- .../step1.vm_resource_centos_ok.ref | 4 +- ...resource_private_with_multiple_NICs_ok.ref | 4 +- ...t_access_point_resource_with_RT_add_RT.ref | 8 +- ...vate_load_balancer_Add_security_groups.ref | 10 +- ....nat_services_datasource_attributes_ok.ref | 86 ++-- ....public_ip_link_resource_attributes_ok.ref | 45 +- ...1.public_ip_link_resource_attributes_ok.tf | 7 + .../step1.vm_datasource_centos_ok.ref | 4 +- .../step2.vm_datasource_centos_ok.ref | 2 +- ...m_resource_public_with_multiple_BDM_ok.ref | 66 ++- ...vm_resource_public_with_multiple_BDM_ok.tf | 6 + ...m_resource_public_with_multiple_BDM_ok.ref | 64 ++- ...vm_resource_public_with_multiple_BDM_ok.tf | 6 + .../step1.vm_resource_with_user_data_ok.ref | 80 +++- .../step1.vm_resource_with_user_data_ok.tf | 6 + .../step1.vm_resource_with_user_data_ok_2.ref | 52 ++- .../step1.vm_resource_with_user_data_ok_2.tf | 6 + ..._state_datasource_centos_attributes_ok.ref | 44 +- ...m_state_datasource_centos_attributes_ok.tf | 7 + ...states_datasource_centos_attributes_ok.ref | 61 ++- ..._states_datasource_centos_attributes_ok.tf | 14 +- .../step1.vms_datasource_attributes_ok.ref | 82 +++- .../step1.vms_datasource_attributes_ok.tf | 21 +- .../step2.vms_datasource_attributes_ok.ref | 80 +++- .../step2.vms_datasource_attributes_ok.tf | 23 +- ...step1.volumes_datasource_attributes_ok.ref | 20 +- ...tep1.volumes_datasource_attributes_ok2.ref | 28 +- ...tep1.volumes_datasource_attributes_ok3.ref | 16 +- ...tep1.volumes_datasource_attributes_ok4.ref | 103 +++-- ...step1.volumes_datasource_attributes_ok4.tf | 6 + ...tep2.volumes_datasource_attributes_ok4.ref | 109 +++-- ...step2.volumes_datasource_attributes_ok4.tf | 5 + ...p1.volumes_link_resource_attributes_ok.ref | 59 ++- ...ep1.volumes_link_resource_attributes_ok.tf | 5 + ...n_connection_datasources_attributes_ok.ref | 56 +-- 88 files changed, 2197 insertions(+), 972 deletions(-) diff --git a/outscale/data_source_outscale_nic_test.go b/outscale/data_source_outscale_nic_test.go index 8e00238f5..cf3756497 100644 --- a/outscale/data_source_outscale_nic_test.go +++ b/outscale/data_source_outscale_nic_test.go @@ -131,33 +131,42 @@ func testAccCheckOutscaleOAPINICDestroy(s *terraform.State) error { func testAccOutscaleOAPIENIDataSourceConfig(subregion string) string { return fmt.Sprintf(` - resource "outscale_net" "outscale_net" { - ip_range = "10.0.0.0/16" - - tags { - key = "Name" - value = "testacc-nic-ds" - } + resource "outscale_net" "outscale_net" { + ip_range = "10.0.0.0/16" + tags { + key = "Name" + value = "testacc-nic-ds" } + } - resource "outscale_subnet" "outscale_subnet" { - subregion_name = "%sa" - ip_range = "10.0.0.0/24" - net_id = outscale_net.outscale_net.id + resource "outscale_subnet" "outscale_subnet" { + subregion_name = "%sa" + ip_range = "10.0.0.0/24" + net_id = outscale_net.outscale_net.id + } + resource "outscale_security_group" "sgdatNic" { + security_group_name = "test_sgNic" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" } + net_id = outscale_net.outscale_net.net_id + } - resource "outscale_nic" "outscale_nic" { - subnet_id = outscale_subnet.outscale_subnet.id - tags { - value = "tf-value" - key = "tf-key" - } + resource "outscale_nic" "outscale_nic" { + subnet_id = outscale_subnet.outscale_subnet.id + security_group_ids = [outscale_security_group.sgdatNic.security_group_id] + tags { + value = "tf-value" + key = "tf-key" } + } - data "outscale_nic" "outscale_nic" { - nic_id = outscale_nic.outscale_nic.id - } - `, subregion) + data "outscale_nic" "outscale_nic" { + nic_id = outscale_nic.outscale_nic.id + } +`, subregion) } func testAccOutscaleOAPIENIDataSourceConfigFilter(subregion string) string { @@ -176,9 +185,19 @@ func testAccOutscaleOAPIENIDataSourceConfigFilter(subregion string) string { ip_range = "10.0.0.0/24" net_id = outscale_net.outscale_net.id } + resource "outscale_security_group" "sgdatNic" { + security_group_name = "test_sgNic" + description = "Used in the terraform acceptance tests" + tags { + key = "Name" + value = "tf-acc-test" + } + net_id = outscale_net.outscale_net.net_id + } resource "outscale_nic" "outscale_nic" { subnet_id = outscale_subnet.outscale_subnet.id + security_group_ids = [outscale_security_group.sgdatNic.security_group_id] tags { value = "tf-value" key = "tf-key" diff --git a/outscale/data_source_outscale_nics_test.go b/outscale/data_source_outscale_nics_test.go index d5110bc98..8b266a495 100644 --- a/outscale/data_source_outscale_nics_test.go +++ b/outscale/data_source_outscale_nics_test.go @@ -40,9 +40,17 @@ func testAccCheckOutscaleOAPINicsDataSourceConfig(subregion string) string { ip_range = "10.0.0.0/24" net_id = outscale_net.outscale_net.net_id } - + + resource "outscale_security_group" "sg_dataNic" { + description = "sg for terraform tests" + security_group_name = "terraform-sg" + net_id = outscale_net.outscale_net.net_id + } + resource "outscale_nic" "outscale_nic" { subnet_id = outscale_subnet.outscale_subnet.subnet_id + security_group_ids = [outscale_security_group.sg_dataNic.security_group_id] + } data "outscale_nics" "outscale_nics" { diff --git a/outscale/data_source_outscale_subnet_test.go b/outscale/data_source_outscale_subnet_test.go index 8cbe32c90..5499c561d 100644 --- a/outscale/data_source_outscale_subnet_test.go +++ b/outscale/data_source_outscale_subnet_test.go @@ -125,6 +125,14 @@ func testAccDataSourceOutscaleOAPISubnetWithAvailableIpsCountsFilter(region stri name = "available_ips_counts" values = [outscale_subnet.outscale_subnet.available_ips_count] } + filter { + name = "ip_ranges" + values = ["10.0.0.0/24"] + } + filter { + name = "net_ids" + values = [outscale_net.outscale_net.net_id] + } } `, region) } diff --git a/outscale/data_source_outscale_vm_states_test.go b/outscale/data_source_outscale_vm_states_test.go index a5209f333..11d12a979 100644 --- a/outscale/data_source_outscale_vm_states_test.go +++ b/outscale/data_source_outscale_vm_states_test.go @@ -25,10 +25,17 @@ func TestAccVM_StatesDataSource(t *testing.T) { func testAccDataSourceOutscaleOAPIVMStatesConfig(omi, vmType string) string { return fmt.Sprintf(` + resource "outscale_security_group" "sg_vStates" { + description = "testAcc Terraform security group" + security_group_name = "sg_volumes_link" + } + resource "outscale_vm" "basic" { image_id = "%s" vm_type = "%s" keypair_name = "terraform-basic" + security_group_ids = [outscale_security_group.sg_vStates.security_group_id] + } data "outscale_vm_states" "state" { diff --git a/outscale/resource_outscale_image_launch_permission_test.go b/outscale/resource_outscale_image_launch_permission_test.go index 48a711d8d..f712b0c29 100644 --- a/outscale/resource_outscale_image_launch_permission_test.go +++ b/outscale/resource_outscale_image_launch_permission_test.go @@ -33,21 +33,21 @@ func TestAccVM_WithImageLaunchPermission_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), }, // Drop just launch permission to test destruction { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, false, rInt, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, false, rInt), Check: r.ComposeTestCheckFunc( testAccOutscaleOAPIImageLaunchPermissionDestroyed(accountID, &imageID), ), }, // Re-add everything so we can test when AMI disappears { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -55,7 +55,7 @@ func TestAccVM_WithImageLaunchPermission_Basic(t *testing.T) { // Here we delete the AMI to verify the follow-on refresh after this step // should not error. { - Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, true, rInt, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionConfig(omi, "tinav4.c2r2p2", region, accountID, keypair, true, rInt), Check: r.ComposeTestCheckFunc( testAccOutscaleOAPIImageDisappears(&imageID), ), @@ -80,14 +80,14 @@ func TestAccVM_ImageLaunchPermissionDestruction_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, false, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, false), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), testAccOutscaleOAPIImageLaunchPermissionExists(accountID, &imageID), ), }, { - Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, rInt, true, true, keypair), + Config: testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, "tinav4.c2r2p2", region, keypair, rInt, true, true), Check: r.ComposeTestCheckFunc( testCheckResourceOAPILPIGetAttr("outscale_image.outscale_image", "id", &imageID), ), @@ -182,10 +182,10 @@ func testCheckResourceGetAttr(name, key string, value *string) r.TestCheckFunc { } } -func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, accountID string, includeLaunchPermission bool, r int, keypair string) string { +func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, accountID, keypair string, includeLaunchPermission bool, r int) string { base := fmt.Sprintf(` resource "outscale_security_group" "sg_perm" { - security_group_name = "%[5]s" + security_group_name = "sgLPerm" description = "Used in the terraform acceptance tests" tags { @@ -223,10 +223,10 @@ func testAccOutscaleOAPIImageLaunchPermissionConfig(omi, vmType, region, account `, accountID) } -func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region string, r int, includeAddtion, includeRemoval bool, keypair string) string { +func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region, keypair string, r int, includeAddtion, includeRemoval bool) string { base := fmt.Sprintf(` - resource "outscale_security_group" "sg_prem" { - security_group_name = "%[5]s" + resource "outscale_security_group" "sg_perm" { + security_group_name = "sgLPerm" description = "Used in the terraform acceptance tests" tags { @@ -234,7 +234,6 @@ func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region st value = "tf-acc-test" } } - resource "outscale_vm" "outscale_instance" { image_id = "%[1]s" vm_type = "%[2]s" @@ -252,26 +251,26 @@ func testAccOutscaleOAPIImageLaunchPermissionCreateConfig(omi, vmType, region st if includeAddtion { return base + ` - resource "outscale_image_launch_permission" "outscale_image_launch_permission" { - image_id = outscale_image.outscale_image.image_id - - permission_additions { - account_ids = ["520679080430"] + resource "outscale_image_launch_permission" "outscale_image_launch_permission" { + image_id = outscale_image.outscale_image.image_id + + permission_additions { + account_ids = ["520679080430"] + } } - } - ` + ` } if includeRemoval { return base + ` - resource "outscale_image_launch_permission" "outscale_image_launch_permission_two" { - image_id = outscale_image_launch_permission.outscale_image_launch_permission.image_id - - permission_removals { - account_ids = ["520679080430"] - } - } - ` + resource "outscale_image_launch_permission" "outscale_image_launch_permission_two" { + image_id = outscale_image_launch_permission.outscale_image_launch_permission.image_id + + permission_removals { + account_ids = ["520679080430"] + } + } + ` } return base } diff --git a/outscale/resource_outscale_nic_private_ip_test.go b/outscale/resource_outscale_nic_private_ip_test.go index 492f55905..b2e3b7934 100644 --- a/outscale/resource_outscale_nic_private_ip_test.go +++ b/outscale/resource_outscale_nic_private_ip_test.go @@ -67,15 +67,22 @@ func testAccOutscaleOAPINetworkInterfacePrivateIPConfigBasic(region string) stri 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_security_group" "sg_PrNic" { + description = "sg for terraform tests" + security_group_name = "terraform-sg" + 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 + security_group_ids = [outscale_security_group.sg_PrNic.security_group_id] } - + resource "outscale_nic_private_ip" "outscale_nic_private_ip" { - nic_id = "${outscale_nic.outscale_nic.nic_id}" + nic_id = outscale_nic.outscale_nic.nic_id private_ips = ["10.0.45.67"] } `, region) diff --git a/outscale/resource_outscale_public_ip_test.go b/outscale/resource_outscale_public_ip_test.go index 823c800da..7623b8d4d 100644 --- a/outscale/resource_outscale_public_ip_test.go +++ b/outscale/resource_outscale_public_ip_test.go @@ -68,7 +68,6 @@ func TestAccNet_PublicIP_associated_user_private_ip(t *testing.T) { omi := os.Getenv("OUTSCALE_IMAGEID") region := utils.GetRegion() keypair := os.Getenv("OUTSCALE_KEYPAIR") - sgId := os.Getenv("OUTSCALE_SECURITYGROUPID") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -77,14 +76,14 @@ func TestAccNet_PublicIP_associated_user_private_ip(t *testing.T) { CheckDestroy: testAccCheckOutscaleOAPIPublicIPDestroy, Steps: []resource.TestStep{ { - Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, "tinav4.c2r2p2", region, keypair, sgId), + Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &one), testAccCheckOutscaleOAPIPublicIPAttributes(&one), ), }, { - Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, "tinav4.c2r2p2", region, keypair, sgId), + Config: testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, "tinav4.c2r2p2", region, keypair), Check: resource.ComposeTestCheckFunc( testAccCheckOutscaleOAPIPublicIPExists("outscale_public_ip.bar", &one), testAccCheckOutscaleOAPIPublicIPAttributes(&one), @@ -283,18 +282,9 @@ func testAccOutscaleOAPIPublicIPInstanceConfig(omi, vmType, region, keypair stri `, omi, vmType, region, keypair) } -func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, keypair, sgId string) string { +func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, keypair 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" { + resource "outscale_security_group" "sgIP" { security_group_name = "%[4]s" description = "Used in the terraform acceptance tests" @@ -302,15 +292,13 @@ func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, ke 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"] + security_group_ids = [outscale_security_group.sgIP.security_group_id] placement_subregion_name = "%[3]sa" } @@ -318,26 +306,17 @@ func testAccOutscaleOAPIPublicIPInstanceConfigAssociated(omi, vmType, region, ke image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" - security_group_ids = ["%[5]s"] + security_group_ids = [outscale_security_group.sgIP.security_group_id] placement_subregion_name = "%[3]sa" } resource "outscale_public_ip" "bar" {} - `, omi, vmType, region, keypair, sgId) + `, omi, vmType, region, keypair) } -func testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, vmType, region, keypair, sgId string) string { +func testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, vmType, region, keypair 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" { + resource "outscale_security_group" "sgIP" { security_group_name = "%[4]s" description = "Used in the terraform acceptance tests" @@ -345,15 +324,13 @@ func testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, vmType, regi 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"] + security_group_ids = [outscale_security_group.sgIP.security_group_id] placement_subregion_name = "%[3]sa" } @@ -361,10 +338,10 @@ func testAccOutscaleOAPIPublicIPInstanceConfigAssociatedSwitch(omi, vmType, regi image_id = "%[1]s" vm_type = "%[2]s" keypair_name = "%[4]s" - security_group_ids = ["%[5]s"] + security_group_ids = [outscale_security_group.sgIP.security_group_id] placement_subregion_name = "%[3]sa" } resource "outscale_public_ip" "bar" {} - `, omi, vmType, region, keypair, sgId) + `, omi, vmType, region, keypair) } diff --git a/tests/qa_provider_oapi/data/api_access_rule/TF-200_api_access_rule_datasource_attributes_ok/step1.api_access_rule_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/api_access_rule/TF-200_api_access_rule_datasource_attributes_ok/step1.api_access_rule_datasource_attributes_ok.ref index 9e8d05f52..c3792cce9 100644 --- a/tests/qa_provider_oapi/data/api_access_rule/TF-200_api_access_rule_datasource_attributes_ok/step1.api_access_rule_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/api_access_rule/TF-200_api_access_rule_datasource_attributes_ok/step1.api_access_rule_datasource_attributes_ok.ref @@ -193,10 +193,10 @@ "schema_version": 0, "attributes": { "ca_fingerprint": "########", - "ca_id": "##id-2##", + "ca_id": "##id-1##", "ca_pem": "########", "description": "", - "id": "##id-2##", + "id": "##id-1##", "request_id": "########" }, "sensitive_attributes": [], @@ -214,10 +214,10 @@ "schema_version": 0, "attributes": { "ca_fingerprint": "########", - "ca_id": "##id-1##", + "ca_id": "##id-2##", "ca_pem": "########", "description": "", - "id": "##id-1##", + "id": "##id-2##", "request_id": "########" }, "sensitive_attributes": [], diff --git a/tests/qa_provider_oapi/data/api_access_rules/TF-202_api_access_rules_datasource_ok/step1.api_access_rules_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/api_access_rules/TF-202_api_access_rules_datasource_ok/step1.api_access_rules_datasource_attributes_ok.ref index b0e3e76ec..288d63d62 100644 --- a/tests/qa_provider_oapi/data/api_access_rules/TF-202_api_access_rules_datasource_ok/step1.api_access_rules_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/api_access_rules/TF-202_api_access_rules_datasource_ok/step1.api_access_rules_datasource_attributes_ok.ref @@ -22,8 +22,8 @@ "##id-2##" ], "cns": [ - "outscale-1", - "test-TF202" + "test-TF202", + "outscale-1" ], "description": "AAR-TF-202-1", "ip_ranges": "########" @@ -35,9 +35,9 @@ "##id-2##" ], "cns": [ - "outscale-1", + "test-TF202-2", "test-TF202", - "test-TF202-2" + "outscale-1" ], "description": "API Access rules-TF-202-1", "ip_ranges": "########" @@ -68,8 +68,8 @@ "##id-2##" ], "cns": [ - "outscale-1", - "test-TF202" + "test-TF202", + "outscale-1" ], "description": "AAR-TF-202-1", "ip_ranges": "########" @@ -81,9 +81,9 @@ "##id-2##" ], "cns": [ - "outscale-1", + "test-TF202-2", "test-TF202", - "test-TF202-2" + "outscale-1" ], "description": "API Access rules-TF-202-1", "ip_ranges": "########" @@ -114,8 +114,8 @@ "##id-2##" ], "cns": [ - "outscale-1", - "test-TF202" + "test-TF202", + "outscale-1" ], "description": "AAR-TF-202-1", "ip_ranges": "########" @@ -127,9 +127,9 @@ "##id-2##" ], "cns": [ - "outscale-1", + "test-TF202-2", "test-TF202", - "test-TF202-2" + "outscale-1" ], "description": "API Access rules-TF-202-1", "ip_ranges": "########" @@ -160,8 +160,8 @@ "##id-2##" ], "cns": [ - "outscale-1", - "test-TF202" + "test-TF202", + "outscale-1" ], "description": "AAR-TF-202-1", "ip_ranges": "########" @@ -173,9 +173,9 @@ "##id-2##" ], "cns": [ - "outscale-1", + "test-TF202-2", "test-TF202", - "test-TF202-2" + "outscale-1" ], "description": "API Access rules-TF-202-1", "ip_ranges": "########" @@ -206,8 +206,8 @@ "##id-2##" ], "cns": [ - "outscale-1", - "test-TF202" + "test-TF202", + "outscale-1" ], "description": "AAR-TF-202-1", "ip_ranges": "########" @@ -296,10 +296,10 @@ "schema_version": 0, "attributes": { "ca_fingerprint": "########", - "ca_id": "##id-1##", + "ca_id": "##id-2##", "ca_pem": "########", "description": "", - "id": "##id-1##", + "id": "##id-2##", "request_id": "########" }, "sensitive_attributes": [], @@ -317,10 +317,10 @@ "schema_version": 0, "attributes": { "ca_fingerprint": "########", - "ca_id": "##id-2##", + "ca_id": "##id-1##", "ca_pem": "########", "description": "", - "id": "##id-2##", + "id": "##id-1##", "request_id": "########" }, "sensitive_attributes": [], diff --git a/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step1.client_gateways_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step1.client_gateways_datasource_attributes_ok.ref index 14957a768..0df139d03 100644 --- a/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step1.client_gateways_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step1.client_gateways_datasource_attributes_ok.ref @@ -17,7 +17,7 @@ "client_gateway_ids": null, "client_gateways": [ { - "bgp_asn": 575, + "bgp_asn": 571, "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", "public_ip": "########", @@ -25,12 +25,16 @@ "tags": [ { "key": "name-mzi", - "value": "CGW_2_mzi" + "value": "CGW_1_mzi" + }, + { + "key": "project", + "value": "terraform" } ] }, { - "bgp_asn": 571, + "bgp_asn": 575, "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", "public_ip": "########", @@ -38,11 +42,7 @@ "tags": [ { "key": "name-mzi", - "value": "CGW_1_mzi" - }, - { - "key": "project", - "value": "terraform" + "value": "CGW_2_mzi" } ] } @@ -65,9 +65,9 @@ "schema_version": 0, "attributes": { "bgp_asn": 571, - "client_gateway_id": "##id-1##", + "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", - "id": "##id-1##", + "id": "##id-0##", "public_ip": "########", "request_id": "########", "state": "available", @@ -97,9 +97,9 @@ "schema_version": 0, "attributes": { "bgp_asn": 575, - "client_gateway_id": "##id-0##", + "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", - "id": "##id-0##", + "id": "##id-1##", "public_ip": "########", "request_id": "########", "state": "available", diff --git a/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step2.client_gateways_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step2.client_gateways_datasource_attributes_ok.ref index 474810190..eb5d1ec4a 100644 --- a/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step2.client_gateways_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/client_gateways/TF-60_client_gateways_datasource_attributes_ok/step2.client_gateways_datasource_attributes_ok.ref @@ -17,7 +17,7 @@ "client_gateway_ids": null, "client_gateways": [ { - "bgp_asn": 575, + "bgp_asn": 571, "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", "public_ip": "########", @@ -25,12 +25,16 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_2_terraform" + "value": "CGW_1_terraform" + }, + { + "key": "project", + "value": "terraform" } ] }, { - "bgp_asn": 571, + "bgp_asn": 575, "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", "public_ip": "########", @@ -38,11 +42,7 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_1_terraform" - }, - { - "key": "project", - "value": "terraform" + "value": "CGW_2_terraform" } ] } @@ -68,7 +68,7 @@ "client_gateways": [ { "bgp_asn": 571, - "client_gateway_id": "##id-1##", + "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", "public_ip": "########", "state": "available", @@ -104,7 +104,7 @@ "client_gateway_ids": null, "client_gateways": [ { - "bgp_asn": 571, + "bgp_asn": 575, "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", "public_ip": "########", @@ -112,16 +112,12 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_1_terraform" - }, - { - "key": "project", - "value": "terraform" + "value": "CGW_2_terraform" } ] }, { - "bgp_asn": 575, + "bgp_asn": 571, "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", "public_ip": "########", @@ -129,7 +125,11 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_2_terraform" + "value": "CGW_1_terraform" + }, + { + "key": "project", + "value": "terraform" } ] } @@ -154,7 +154,7 @@ "client_gateway_ids": null, "client_gateways": [ { - "bgp_asn": 571, + "bgp_asn": 575, "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", "public_ip": "########", @@ -162,16 +162,12 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_1_terraform" - }, - { - "key": "project", - "value": "terraform" + "value": "CGW_2_terraform" } ] }, { - "bgp_asn": 575, + "bgp_asn": 571, "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", "public_ip": "########", @@ -179,7 +175,11 @@ "tags": [ { "key": "name-terraform", - "value": "CGW_2_terraform" + "value": "CGW_1_terraform" + }, + { + "key": "project", + "value": "terraform" } ] } @@ -202,9 +202,9 @@ "schema_version": 0, "attributes": { "bgp_asn": 571, - "client_gateway_id": "##id-1##", + "client_gateway_id": "##id-0##", "connection_type": "ipsec.1", - "id": "##id-1##", + "id": "##id-0##", "public_ip": "########", "request_id": "########", "state": "available", @@ -234,9 +234,9 @@ "schema_version": 0, "attributes": { "bgp_asn": 575, - "client_gateway_id": "##id-0##", + "client_gateway_id": "##id-1##", "connection_type": "ipsec.1", - "id": "##id-0##", + "id": "##id-1##", "public_ip": "########", "request_id": "########", "state": "available", diff --git a/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.ref index 7c5b773f5..a1a4d3b7e 100644 --- a/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.ref @@ -121,6 +121,7 @@ "dependencies": [ "outscale_flexible_gpu.fGPU-1", "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfg", "outscale_vm.MaVM" ] } @@ -148,6 +149,33 @@ } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgfg", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-3##", + "description": "test security group", + "id": "##id-4##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-4##", + "security_group_name": "SG-inteFg", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -166,7 +194,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-3##" + "volume_id": "##id-5##" }, "device_name": "/dev/sda1" } @@ -178,7 +206,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-1##", - "image_id": "##id-4##", + "image_id": "##id-6##", "is_source_dest_checked": true, "keypair_name": "KP-TF177", "launch_number": 0, @@ -199,15 +227,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-5##", + "reservation_id": "##id-7##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-4##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-6##", - "security_group_name": "default" + "security_group_id": "##id-4##", + "security_group_name": "SG-inteFg" } ], "state": "running", @@ -223,7 +253,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfg" ] } ] diff --git a/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.tf index c51abaf17..4dc272c6a 100644 --- a/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/flexible_gpu/TF-177_flexible_gpu_datasource_attributes_ok/step1.flexible_gpu_datasource_attributes_ok.tf @@ -3,10 +3,16 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF177" } +resource "outscale_security_group" "my_sgfg" { + description = "test security group" + security_group_name = "SG-inteFg" +} + resource "outscale_vm" "MaVM" { image_id = var.image_id vm_type = var.fgpu_vm_type keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgfg.security_group_id] placement_subregion_name = "${var.region}a" vm_initiated_shutdown_behavior = "restart" } diff --git a/tests/qa_provider_oapi/data/flexible_gpu_catalog/TF-176_flexible_gpu_catalog_datasource_attributes_ok/step1.flexible_gpu_catalog_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/flexible_gpu_catalog/TF-176_flexible_gpu_catalog_datasource_attributes_ok/step1.flexible_gpu_catalog_datasource_attributes_ok.ref index 04fce4358..785e8324a 100644 --- a/tests/qa_provider_oapi/data/flexible_gpu_catalog/TF-176_flexible_gpu_catalog_datasource_attributes_ok/step1.flexible_gpu_catalog_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/flexible_gpu_catalog/TF-176_flexible_gpu_catalog_datasource_attributes_ok/step1.flexible_gpu_catalog_datasource_attributes_ok.ref @@ -16,6 +16,24 @@ "attributes": { "filter": "########", "flexible_gpu_catalog": [ + { + "generations": [ + "v6" + ], + "max_cpu": 35, + "max_ram": 256, + "model_name": "nvidia-a100-80", + "v_ram": 80000 + }, + { + "generations": [ + "v5" + ], + "max_cpu": 35, + "max_ram": 250, + "model_name": "nvidia-v100", + "v_ram": 16000 + }, { "generations": [ "v5", @@ -32,7 +50,7 @@ ], "max_cpu": 80, "max_ram": 512, - "model_name": "nvidia-p6", + "model_name": "nvidia-p100", "v_ram": 16000 }, { @@ -41,7 +59,7 @@ ], "max_cpu": 80, "max_ram": 512, - "model_name": "nvidia-p100", + "model_name": "nvidia-p6", "v_ram": 16000 }, { @@ -51,25 +69,7 @@ ], "max_cpu": 80, "max_ram": 512, - "model_name": "nvidia-k2", - "v_ram": 4096 - }, - { - "generations": [ - "v6" - ], - "max_cpu": 35, - "max_ram": 256, - "model_name": "nvidia-a100-80", - "v_ram": 80000 - }, - { - "generations": [ - "v5" - ], - "max_cpu": 35, - "max_ram": 250, - "model_name": "nvidia-v100", + "model_name": "nvidia-m60", "v_ram": 16000 }, { @@ -79,8 +79,8 @@ ], "max_cpu": 80, "max_ram": 512, - "model_name": "nvidia-m60", - "v_ram": 16000 + "model_name": "nvidia-k2", + "v_ram": 4096 } ], "id": "##id-0##", diff --git a/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.ref index 742234c0d..12ee2f89e 100644 --- a/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.ref @@ -49,6 +49,7 @@ "dependencies": [ "outscale_flexible_gpu.fGPU-1", "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfg_link", "outscale_vm.MaVM" ] } @@ -76,6 +77,33 @@ } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgfg_link", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-3##", + "description": "test security group", + "id": "##id-4##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-4##", + "security_group_name": "SG-inteFg_link", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -94,7 +122,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-3##" + "volume_id": "##id-5##" }, "device_name": "/dev/sda1" } @@ -106,7 +134,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-1##", - "image_id": "##id-4##", + "image_id": "##id-6##", "is_source_dest_checked": true, "keypair_name": "KP-TF174", "launch_number": 0, @@ -127,15 +155,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-5##", + "reservation_id": "##id-7##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-4##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-6##", - "security_group_name": "default" + "security_group_id": "##id-4##", + "security_group_name": "SG-inteFg_link" } ], "state": "running", @@ -151,7 +181,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfg_link" ] } ] diff --git a/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.tf index 54d816ded..ecbd01ff7 100644 --- a/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/flexible_gpu_link/TF-174_flexible_gpu_link_resource_attributes_ok/step1.flexible_gpu_link_resource_attributes_ok.tf @@ -1,12 +1,19 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF174" + +} + +resource "outscale_security_group" "my_sgfg_link" { + description = "test security group" + security_group_name = "SG-inteFg_link" } resource "outscale_vm" "MaVM" { image_id = var.image_id vm_type = var.fgpu_vm_type keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgfg_link.security_group_id] placement_subregion_name = "${var.region}a" vm_initiated_shutdown_behavior = "restart" } @@ -18,7 +25,6 @@ resource "outscale_flexible_gpu" "fGPU-1" { delete_on_vm_deletion = true } - resource "outscale_flexible_gpu_link" "link_fGPU" { flexible_gpu_id = outscale_flexible_gpu.fGPU-1.flexible_gpu_id vm_id = outscale_vm.MaVM.vm_id diff --git a/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.ref index 20d782aac..eae18066e 100644 --- a/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.ref @@ -158,6 +158,7 @@ "dependencies": [ "outscale_flexible_gpu.fGPU-1", "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfgs", "outscale_vm.MaVM" ] } @@ -185,6 +186,33 @@ } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgfgs", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-5##", + "description": "test security group_fg", + "id": "##id-6##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-6##", + "security_group_name": "SG-inteFlg", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -203,7 +231,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-5##" + "volume_id": "##id-7##" }, "device_name": "/dev/sda1" } @@ -215,7 +243,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-1##", - "image_id": "##id-6##", + "image_id": "##id-8##", "is_source_dest_checked": true, "keypair_name": "KP-TF1775", "launch_number": 0, @@ -236,15 +264,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-7##", + "reservation_id": "##id-9##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-6##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-8##", - "security_group_name": "default" + "security_group_id": "##id-6##", + "security_group_name": "SG-inteFlg" } ], "state": "running", @@ -260,7 +290,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgfgs" ] } ] diff --git a/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.tf index de5935605..b48e988b4 100644 --- a/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/flexible_gpus/TF-175_flexible_gpus_datasource_attributes_ok/step1.flexible_gpus_datasource_attributes_ok.tf @@ -2,10 +2,16 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF1775" } +resource "outscale_security_group" "my_sgfgs" { + description = "test security group_fg" + security_group_name = "SG-inteFlg" +} + resource "outscale_vm" "MaVM" { image_id = var.image_id vm_type = var.fgpu_vm_type keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgfgs.security_group_id] placement_subregion_name = "${var.region}a" vm_initiated_shutdown_behavior = "restart" } diff --git a/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.ref index 01f1e30db..ecc37e9d3 100644 --- a/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.ref @@ -540,11 +540,39 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoyNDAwMDAwMDAwMDAwLCJkZWxldGUiOjI0MDAwMDAwMDAwMDAsInVwZGF0ZSI6MjQwMDAwMDAwMDAwMH19", "dependencies": [ + "outscale_security_group.my_sgImg", "outscale_vm.my-vm" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgImg", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-0##", + "description": "test security group", + "id": "##id-4##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-4##", + "security_group_name": "SG-inteImg", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -563,7 +591,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-4##" + "volume_id": "##id-5##" }, "device_name": "/dev/sda1" } @@ -575,7 +603,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-3##", - "image_id": "##id-5##", + "image_id": "##id-6##", "is_source_dest_checked": true, "keypair_name": "", "launch_number": 0, @@ -596,15 +624,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-6##", + "reservation_id": "##id-7##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-4##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-7##", - "security_group_name": "default" + "security_group_id": "##id-4##", + "security_group_name": "SG-inteImg" } ], "state": "running", @@ -618,7 +648,10 @@ "vm_type": "t2.small" }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", + "dependencies": [ + "outscale_security_group.my_sgImg" + ] } ] } diff --git a/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.tf index 413c9bfcd..75927af50 100644 --- a/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/image/TF-66_image_datasource_attributes_ok/step1.image_datasource_attributes_ok.tf @@ -1,5 +1,11 @@ +resource "outscale_security_group" "my_sgImg" { + description = "test security group" + security_group_name = "SG-inteImg" +} + resource "outscale_vm" "my-vm" { - image_id = var.image_id + image_id = var.image_id + security_group_ids = [outscale_security_group.my_sgImg.security_group_id] } resource "outscale_image" "outscale_image" { diff --git a/tests/qa_provider_oapi/data/image/TF-67_image_resource_attributes_ok/step1.image_no-reboot_resource_std_attributes_ok.tf b/tests/qa_provider_oapi/data/image/TF-67_image_resource_attributes_ok/step1.image_no-reboot_resource_std_attributes_ok.tf index 1751d46a1..0ec0682e2 100644 --- a/tests/qa_provider_oapi/data/image/TF-67_image_resource_attributes_ok/step1.image_no-reboot_resource_std_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/image/TF-67_image_resource_attributes_ok/step1.image_no-reboot_resource_std_attributes_ok.tf @@ -1,5 +1,10 @@ +resource "outscale_security_group" "my_sgImg1" { + description = "test sg group" +} + resource "outscale_vm" "my-vm" { - image_id = var.image_id + image_id = var.image_id + security_group_ids = [outscale_security_group.my_sgImg1.security_group_id] } resource "outscale_image" "outscale_image" { @@ -9,11 +14,11 @@ resource "outscale_image" "outscale_image" { tags { key = "Key" value = "value-tags" - } -tags { + } + tags { key = "Key-2" value = "value-tags-2" - } + } } ### Test Copy Image diff --git a/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.ref index c244bde60..3d9011520 100644 --- a/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.ref @@ -70,6 +70,7 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoyNDAwMDAwMDAwMDAwLCJkZWxldGUiOjI0MDAwMDAwMDAwMDAsInVwZGF0ZSI6MjQwMDAwMDAwMDAwMH19", "dependencies": [ "outscale_keypair.my_keypair", + "outscale_security_group.my_sgImgl", "outscale_vm.outscale_vm" ] } @@ -111,6 +112,7 @@ "dependencies": [ "outscale_image.outscale_image", "outscale_keypair.my_keypair", + "outscale_security_group.my_sgImgl", "outscale_vm.outscale_vm" ] } @@ -138,6 +140,33 @@ } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgImgl", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-0##", + "description": "test sg_group", + "id": "##id-5##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-5##", + "security_group_name": "SG-inteImgl", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -156,7 +185,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-5##" + "volume_id": "##id-6##" }, "device_name": "/dev/sda1" } @@ -168,7 +197,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-3##", - "image_id": "##id-6##", + "image_id": "##id-7##", "is_source_dest_checked": true, "keypair_name": "KP-TF68", "launch_number": 0, @@ -189,15 +218,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-7##", + "reservation_id": "##id-8##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-5##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-8##", - "security_group_name": "default" + "security_group_id": "##id-5##", + "security_group_name": "SG-inteImgl" } ], "state": "running", @@ -213,7 +244,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgImgl" ] } ] diff --git a/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.tf index 27da7f4d7..f6052f635 100644 --- a/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/image_launch_permission/TF-68_image_launch_permission_resource_attributes_ok/step1.image_launch_permission_resource_attributes_ok.tf @@ -1,3 +1,8 @@ +resource "outscale_security_group" "my_sgImgl" { + description = "test sg_group" + security_group_name = "SG-inteImgl" +} + resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF68" } @@ -6,6 +11,7 @@ resource "outscale_vm" "outscale_vm" { image_id = var.image_id vm_type = var.vm_type keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgImgl.security_group_id] } resource "outscale_image" "outscale_image" { diff --git a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.ref index aba37277f..ec0c1a91e 100644 --- a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.ref @@ -78,11 +78,39 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoyNDAwMDAwMDAwMDAwLCJkZWxldGUiOjI0MDAwMDAwMDAwMDAsInVwZGF0ZSI6MjQwMDAwMDAwMDAwMH19", "dependencies": [ + "outscale_security_group.my_sgImgs", "outscale_vm.outscale_vm" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgImgs", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-0##", + "description": "test sg-group", + "id": "##id-4##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-4##", + "security_group_name": "SG-inteImgs", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -101,7 +129,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-4##" + "volume_id": "##id-5##" }, "device_name": "/dev/sda1" } @@ -113,7 +141,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-3##", - "image_id": "##id-5##", + "image_id": "##id-6##", "is_source_dest_checked": true, "keypair_name": "", "launch_number": 0, @@ -134,15 +162,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-6##", + "reservation_id": "##id-7##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-4##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-7##", - "security_group_name": "default" + "security_group_id": "##id-4##", + "security_group_name": "SG-inteImgs" } ], "state": "running", @@ -156,7 +186,10 @@ "vm_type": "t2.small" }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", + "dependencies": [ + "outscale_security_group.my_sgImgs" + ] } ] } diff --git a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.tf index a5e9b195f..eb816c9fd 100644 --- a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step1.images_datasource_attributes_ok.tf @@ -1,5 +1,11 @@ +resource "outscale_security_group" "my_sgImgs" { + description = "test sg-group" + security_group_name = "SG-inteImgs" +} + resource "outscale_vm" "outscale_vm" { - image_id = var.image_id + image_id = var.image_id + security_group_ids = [outscale_security_group.my_sgImgs.security_group_id] } resource "outscale_image" "outscale_image1" { diff --git a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.ref index b2784aad5..241513d0e 100644 --- a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.ref @@ -60,11 +60,11 @@ "tags": [ { "key": "Key-2", - "value": "value-tags-2" + "value": "value:TF69" }, { "key": "Key:TF69", - "value": "value:TF69" + "value": "value-tags" } ] }, @@ -109,11 +109,11 @@ "tags": [ { "key": "Key-2", - "value": "value:TF69" + "value": "value-tags-2" }, { "key": "Key:TF69", - "value": "value-tags" + "value": "value:TF69" } ] } @@ -149,7 +149,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-4##", + "snapshot_id": "##id-2##", "volume_size": 10, "volume_type": "standard" } @@ -161,7 +161,7 @@ "creation_date": "########", "description": "", "file_location": "########", - "image_id": "##id-5##", + "image_id": "##id-3##", "image_name": "########", "image_type": "machine", "permissions_to_launch": [], @@ -198,7 +198,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-2##", + "snapshot_id": "##id-4##", "volume_size": 10, "volume_type": "standard" } @@ -210,7 +210,7 @@ "creation_date": "########", "description": "", "file_location": "########", - "image_id": "##id-3##", + "image_id": "##id-5##", "image_name": "########", "image_type": "machine", "permissions_to_launch": [], @@ -300,11 +300,11 @@ "tags": [ { "key": "Key-2", - "value": "value-tags-2" + "value": "value:TF69" }, { "key": "Key:TF69", - "value": "value:TF69" + "value": "value-tags" } ] }, @@ -349,11 +349,11 @@ "tags": [ { "key": "Key-2", - "value": "value:TF69" + "value": "value-tags-2" }, { "key": "Key:TF69", - "value": "value-tags" + "value": "value:TF69" } ] } @@ -389,7 +389,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-4##", + "snapshot_id": "##id-2##", "volume_size": 10, "volume_type": "standard" } @@ -401,7 +401,7 @@ "creation_date": "########", "description": "", "file_location": "########", - "image_id": "##id-5##", + "image_id": "##id-3##", "image_name": "########", "image_type": "machine", "permissions_to_launch": [], @@ -438,7 +438,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-2##", + "snapshot_id": "##id-4##", "volume_size": 10, "volume_type": "standard" } @@ -450,7 +450,7 @@ "creation_date": "########", "description": "", "file_location": "########", - "image_id": "##id-3##", + "image_id": "##id-5##", "image_name": "########", "image_type": "machine", "permissions_to_launch": [], @@ -509,7 +509,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-2##", + "snapshot_id": "##id-4##", "volume_size": 10, "volume_type": "standard" } @@ -521,7 +521,7 @@ "creation_date": "########", "description": "", "file_location": "########", - "image_id": "##id-3##", + "image_id": "##id-5##", "image_name": "########", "image_type": "machine", "permissions_to_launch": [], @@ -574,7 +574,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-4##", + "snapshot_id": "##id-2##", "volume_size": 10, "volume_type": "standard" } @@ -586,8 +586,8 @@ "creation_date": "########", "description": "", "file_location": "########", - "id": "##id-5##", - "image_id": "##id-5##", + "id": "##id-3##", + "image_id": "##id-3##", "image_name": "########", "image_type": "machine", "is_public": null, @@ -629,6 +629,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoyNDAwMDAwMDAwMDAwLCJkZWxldGUiOjI0MDAwMDAwMDAwMDAsInVwZGF0ZSI6MjQwMDAwMDAwMDAwMH19", "dependencies": [ + "outscale_security_group.my_sgImgs", "outscale_vm.outscale_vm" ] } @@ -652,7 +653,7 @@ { "delete_on_vm_deletion": true, "iops": 0, - "snapshot_id": "##id-2##", + "snapshot_id": "##id-4##", "volume_size": 10, "volume_type": "standard" } @@ -664,8 +665,8 @@ "creation_date": "########", "description": "", "file_location": "########", - "id": "##id-3##", - "image_id": "##id-3##", + "id": "##id-5##", + "image_id": "##id-5##", "image_name": "########", "image_type": "machine", "is_public": null, @@ -707,11 +708,39 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoyNDAwMDAwMDAwMDAwLCJkZWxldGUiOjI0MDAwMDAwMDAwMDAsInVwZGF0ZSI6MjQwMDAwMDAwMDAwMH19", "dependencies": [ + "outscale_security_group.my_sgImgs", "outscale_vm.outscale_vm" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgImgs", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-1##", + "description": "test sg-group", + "id": "##id-11##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-11##", + "security_group_name": "SG-inteImgs", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -730,7 +759,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-11##" + "volume_id": "##id-12##" }, "device_name": "/dev/sda1" } @@ -742,7 +771,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-10##", - "image_id": "##id-12##", + "image_id": "##id-13##", "is_source_dest_checked": true, "keypair_name": "", "launch_number": 0, @@ -763,15 +792,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-13##", + "reservation_id": "##id-14##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-11##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-14##", - "security_group_name": "default" + "security_group_id": "##id-11##", + "security_group_name": "SG-inteImgs" } ], "state": "running", @@ -785,7 +816,10 @@ "vm_type": "t2.small" }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", + "dependencies": [ + "outscale_security_group.my_sgImgs" + ] } ] } diff --git a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.tf index 7fc3afdb8..52b08137f 100644 --- a/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/images/TF-69_images_datasource_attributes_ok/step2.images_datasource_attributes_ok.tf @@ -1,5 +1,11 @@ +resource "outscale_security_group" "my_sgImgs" { + description = "test sg-group" + security_group_name = "SG-inteImgs" +} + resource "outscale_vm" "outscale_vm" { - image_id = var.image_id + image_id = var.image_id + security_group_ids = [outscale_security_group.my_sgImgs.security_group_id] } resource "outscale_image" "outscale_image1" { diff --git a/tests/qa_provider_oapi/data/internet_services/TF-74_internet_services_datasource_attributes_ok/step1.internet_services_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/internet_services/TF-74_internet_services_datasource_attributes_ok/step1.internet_services_datasource_attributes_ok.ref index cca12c23b..b7270fe6d 100644 --- a/tests/qa_provider_oapi/data/internet_services/TF-74_internet_services_datasource_attributes_ok/step1.internet_services_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/internet_services/TF-74_internet_services_datasource_attributes_ok/step1.internet_services_datasource_attributes_ok.ref @@ -23,9 +23,13 @@ "net_id": "", "state": "", "tags": [ + { + "key": "Key", + "value": "value-tags" + }, { "key": "name", - "value": "Internet-service-2" + "value": "Internet-service-1" } ] }, @@ -34,13 +38,9 @@ "net_id": "", "state": "", "tags": [ - { - "key": "Key", - "value": "value-tags" - }, { "key": "name", - "value": "Internet-service-1" + "value": "Internet-service-2" } ] } @@ -60,8 +60,8 @@ { "schema_version": 0, "attributes": { - "id": "##id-2##", - "internet_service_id": "##id-2##", + "id": "##id-1##", + "internet_service_id": "##id-1##", "net_id": "", "request_id": "########", "state": "", @@ -90,8 +90,8 @@ { "schema_version": 0, "attributes": { - "id": "##id-1##", - "internet_service_id": "##id-1##", + "id": "##id-2##", + "internet_service_id": "##id-2##", "net_id": "", "request_id": "########", "state": "", diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref index e4788beeb..98594d034 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref @@ -157,6 +157,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbl", "outscale_vm.public_vm_1" ] } @@ -199,6 +200,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbl", "outscale_vm.public_vm_1" ] } @@ -225,11 +227,39 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbl", "outscale_vm.public_vm_1" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgLbl", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-11##", + "description": "test sg-group-lbu", + "id": "##id-12##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-12##", + "security_group_name": "SG-inteLbl", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -248,7 +278,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-11##" + "volume_id": "##id-13##" }, "device_name": "/dev/sda1" } @@ -260,7 +290,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-3##", - "image_id": "##id-12##", + "image_id": "##id-14##", "is_source_dest_checked": true, "keypair_name": "KP-TF87", "launch_number": 0, @@ -281,15 +311,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-13##", + "reservation_id": "##id-15##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-12##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-14##", - "security_group_name": "default" + "security_group_id": "##id-12##", + "security_group_name": "SG-inteLbl" } ], "state": "running", @@ -305,7 +337,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgLbl" ] } ] diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.tf index 5b5f9d4ad..df145ab8a 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.tf @@ -2,11 +2,16 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF87" } +resource "outscale_security_group" "my_sgLbl" { + description = "test sg-group-lbu" + security_group_name = "SG-inteLbl" +} resource "outscale_vm" "public_vm_1" { - image_id = var.image_id - vm_type = var.vm_type - keypair_name = outscale_keypair.my_keypair.keypair_name + image_id = var.image_id + vm_type = var.vm_type + keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgLbl.security_group_id] } resource "outscale_load_balancer" "public_lbu2" { diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref index 645577f41..f12f7394b 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref @@ -130,6 +130,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -172,6 +173,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -214,6 +216,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -240,11 +243,39 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgLbur", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-12##", + "description": "test sg-group-lbur", + "id": "##id-13##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-13##", + "security_group_name": "SG-inteLbulist", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -263,7 +294,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-12##" + "volume_id": "##id-14##" }, "device_name": "/dev/sda1" } @@ -275,7 +306,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-6##", - "image_id": "##id-13##", + "image_id": "##id-15##", "is_source_dest_checked": true, "keypair_name": "KP-TF88", "launch_number": 0, @@ -296,15 +327,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-14##", + "reservation_id": "##id-16##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-13##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-15##", - "security_group_name": "default" + "security_group_id": "##id-13##", + "security_group_name": "SG-inteLbulist" } ], "state": "running", @@ -320,7 +353,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgLbur" ] } ] diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.tf index 7aa1b2db4..c801c1cc6 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.tf @@ -1,10 +1,17 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF88" } + +resource "outscale_security_group" "my_sgLbur" { + description = "test sg-group-lbur" + security_group_name = "SG-inteLbulist" +} + resource "outscale_vm" "public_vm_1" { - image_id = var.image_id - vm_type = var.vm_type - keypair_name = outscale_keypair.my_keypair.keypair_name + image_id = var.image_id + vm_type = var.vm_type + keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgLbur.security_group_id] } resource "outscale_load_balancer" "public_lbu2" { @@ -72,4 +79,3 @@ resource "outscale_load_balancer_listener_rule" "rule-3" { } vm_ids = [outscale_vm.public_vm_1.vm_id ] } - diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref index f9aafb456..6fa0138c4 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref @@ -132,6 +132,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -174,6 +175,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -216,6 +218,7 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } @@ -242,11 +245,39 @@ "dependencies": [ "outscale_keypair.my_keypair", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLbur", "outscale_vm.public_vm_1" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgLbur", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-12##", + "description": "test sg-group-lbur", + "id": "##id-13##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-13##", + "security_group_name": "SG-inteLbulist", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -265,7 +296,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-12##" + "volume_id": "##id-14##" }, "device_name": "/dev/sda1" } @@ -277,7 +308,7 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-1##", - "image_id": "##id-13##", + "image_id": "##id-15##", "is_source_dest_checked": true, "keypair_name": "KP-TF88", "launch_number": 0, @@ -298,15 +329,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-14##", + "reservation_id": "##id-16##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-13##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-15##", - "security_group_name": "default" + "security_group_id": "##id-13##", + "security_group_name": "SG-inteLbulist" } ], "state": "running", @@ -322,7 +355,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypair", + "outscale_security_group.my_sgLbur" ] } ] diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.tf index c69c9ee31..37d87f85b 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.tf @@ -1,10 +1,17 @@ resource "outscale_keypair" "my_keypair" { keypair_name = "KP-TF88" } + +resource "outscale_security_group" "my_sgLbur" { + description = "test sg-group-lbur" + security_group_name = "SG-inteLbulist" +} + resource "outscale_vm" "public_vm_1" { - image_id = var.image_id - vm_type = var.vm_type - keypair_name = outscale_keypair.my_keypair.keypair_name + image_id = var.image_id + vm_type = var.vm_type + keypair_name = outscale_keypair.my_keypair.keypair_name + security_group_ids = [outscale_security_group.my_sgLbur.security_group_id] } resource "outscale_load_balancer" "public_lbu2" { diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref index 8ba3ecdb2..30dedabda 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref @@ -51,7 +51,7 @@ { "mode": "managed", "type": "outscale_keypair", - "name": "my_keypair", + "name": "my_keypairL", "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", "instances": [ { @@ -59,7 +59,7 @@ "attributes": { "id": "##id-5##", "keypair_fingerprint": "########", - "keypair_name": "KP-TF89", + "keypair_name": "LKP-TF89", "private_key": "########", "public_key": null, "request_id": "########", @@ -171,8 +171,9 @@ "sensitive_attributes": [], "private": "bnVsbA==", "dependencies": [ - "outscale_keypair.my_keypair", + "outscale_keypair.my_keypairL", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLburs", "outscale_vm.public_vm_1" ] } @@ -213,8 +214,9 @@ "sensitive_attributes": [], "private": "bnVsbA==", "dependencies": [ - "outscale_keypair.my_keypair", + "outscale_keypair.my_keypairL", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLburs", "outscale_vm.public_vm_1" ] } @@ -239,13 +241,41 @@ "sensitive_attributes": [], "private": "bnVsbA==", "dependencies": [ - "outscale_keypair.my_keypair", + "outscale_keypair.my_keypairL", "outscale_load_balancer.public_lbu2", + "outscale_security_group.my_sgLburs", "outscale_vm.public_vm_1" ] } ] }, + { + "mode": "managed", + "type": "outscale_security_group", + "name": "my_sgLburs", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "##id-11##", + "description": "test sg-group-lburs", + "id": "##id-12##", + "inbound_rules": [], + "net_id": "", + "outbound_rules": [], + "remove_default_outbound_rule": false, + "request_id": "########", + "security_group_id": "##id-12##", + "security_group_name": "SG-inteLburs", + "tag": null, + "tags": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "mode": "managed", "type": "outscale_vm", @@ -264,7 +294,7 @@ "delete_on_vm_deletion": "true", "link_date": "########", "state": "attached", - "volume_id": "##id-11##" + "volume_id": "##id-13##" }, "device_name": "/dev/sda1" } @@ -276,9 +306,9 @@ "get_admin_password": null, "hypervisor": "xen", "id": "##id-3##", - "image_id": "##id-12##", + "image_id": "##id-14##", "is_source_dest_checked": true, - "keypair_name": "KP-TF89", + "keypair_name": "LKP-TF89", "launch_number": 0, "nested_virtualization": false, "net_id": "", @@ -297,15 +327,17 @@ "public_dns_name": "########", "public_ip": "########", "request_id": "########", - "reservation_id": "##id-13##", + "reservation_id": "##id-15##", "root_device_name": "/dev/sda1", "root_device_type": "ebs", - "security_group_ids": null, + "security_group_ids": [ + "##id-12##" + ], "security_group_names": null, "security_groups": [ { - "security_group_id": "##id-14##", - "security_group_name": "default" + "security_group_id": "##id-12##", + "security_group_name": "SG-inteLburs" } ], "state": "running", @@ -321,7 +353,8 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=", "dependencies": [ - "outscale_keypair.my_keypair" + "outscale_keypair.my_keypairL", + "outscale_security_group.my_sgLburs" ] } ] diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.tf index 45775b39d..b8d5f6fb8 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.tf @@ -1,10 +1,17 @@ -resource "outscale_keypair" "my_keypair" { - keypair_name = "KP-TF89" +resource "outscale_keypair" "my_keypairL" { + keypair_name = "LKP-TF89" } + +resource "outscale_security_group" "my_sgLburs" { + description = "test sg-group-lburs" + security_group_name = "SG-inteLburs" +} + resource "outscale_vm" "public_vm_1" { - image_id = var.image_id - vm_type = var.vm_type - keypair_name = outscale_keypair.my_keypair.keypair_name + image_id = var.image_id + vm_type = var.vm_type + keypair_name = outscale_keypair.my_keypairL.keypair_name + security_group_ids = [outscale_security_group.my_sgLburs.security_group_id] } resource "outscale_load_balancer" "public_lbu2" { diff --git a/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.tf index 9ee936ddd..df4689312 100644 --- a/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.tf +++ b/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.tf @@ -20,7 +20,7 @@ resource "outscale_vm" "outscale_vm-1" { image_id = var.image_id vm_type = var.vm_type keypair_name = outscale_keypair.my_keypair.keypair_name - security_group_ids = [outscale_security_group.public_sg.id] + security_group_ids = [outscale_security_group.public_sg.id] placement_subregion_name = "${var.region}a" user_data = base64encode(<