From b7da9d38e187429d6264eae4f33f182fd6e634ab Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 20 Jul 2023 12:02:15 -0400 Subject: [PATCH 01/12] Add fsx_ontap_storage_virtual_machine data source --- .../service/fsx/common_schema_data_source.go | 38 +++ internal/service/fsx/find.go | 49 ++++ ...tap_storage_virtual_machine_data_source.go | 267 ++++++++++++++++++ ...torage_virtual_machine_data_source_test.go | 160 +++++++++++ internal/service/fsx/service_package_gen.go | 5 + ...ntap_storage_virtual_machine.html.markdown | 98 +++++++ 6 files changed, 617 insertions(+) create mode 100644 internal/service/fsx/ontap_storage_virtual_machine_data_source.go create mode 100644 internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go create mode 100644 website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown diff --git a/internal/service/fsx/common_schema_data_source.go b/internal/service/fsx/common_schema_data_source.go index f1aef6df181..d0ece97a3f2 100644 --- a/internal/service/fsx/common_schema_data_source.go +++ b/internal/service/fsx/common_schema_data_source.go @@ -45,3 +45,41 @@ func DataSourceSnapshotFiltersSchema() *schema.Schema { }, } } + +func BuildStorageVirtualMachineFiltersDataSource(set *schema.Set) []*fsx.StorageVirtualMachineFilter { + var filters []*fsx.StorageVirtualMachineFilter + for _, v := range set.List() { + m := v.(map[string]interface{}) + var filterValues []*string + for _, e := range m["values"].([]interface{}) { + filterValues = append(filterValues, aws.String(e.(string))) + } + + filters = append(filters, &fsx.StorageVirtualMachineFilter{ + Name: aws.String(m["name"].(string)), + Values: filterValues, + }) + } + + return filters +} + +func DataSoureStorageVirtualMachineFiltersSchema() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "values": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + } +} diff --git a/internal/service/fsx/find.go b/internal/service/fsx/find.go index f64069248c6..57d2dd7211d 100644 --- a/internal/service/fsx/find.go +++ b/internal/service/fsx/find.go @@ -333,3 +333,52 @@ func FindSnapshots(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeSnapsh return output, nil } + +func FindStorageVirtualMachine(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeStorageVirtualMachinesInput) (*fsx.StorageVirtualMachine, error) { + output, err := FindStorageVirtualMachines(ctx, conn, input) + + if err != nil { + return nil, err + } + + if len(output) == 0 || output[0] == nil { + return nil, tfresource.NewEmptyResultError(input) + } + + if count := len(output); count > 1 { + return nil, tfresource.NewTooManyResultsError(count, input) + } + + return output[0], nil +} + +func FindStorageVirtualMachines(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeStorageVirtualMachinesInput) ([]*fsx.StorageVirtualMachine, error) { + var output []*fsx.StorageVirtualMachine + + err := conn.DescribeStorageVirtualMachinesPagesWithContext(ctx, input, func(page *fsx.DescribeStorageVirtualMachinesOutput, lastPage bool) bool { + if page == nil { + return !lastPage + } + + for _, v := range page.StorageVirtualMachines { + if v != nil { + output = append(output, v) + } + } + + return !lastPage + }) + + if tfawserr.ErrCodeEquals(err, fsx.ErrCodeStorageVirtualMachineNotFound) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + return output, nil +} diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go new file mode 100644 index 00000000000..b59cb0aaaab --- /dev/null +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -0,0 +1,267 @@ +package fsx + +import ( + "context" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/fsx" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" +) + +// @SDKDataSource("aws_fsx_ontap_storage_virtual_machine", name="Ontap Storage Virtual Machine") +func DataSourceOntapStorageVirtualMachine() *schema.Resource { + return &schema.Resource{ + ReadWithoutTimeout: dataSourceOntapStorageVirtualMachineRead, + + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "active_directory_configuration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "netbios_name": { + Type: schema.TypeString, + Computed: true, + }, + "self_managed_active_directory_configuration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_ips": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "domain_name": { + Type: schema.TypeString, + Computed: true, + }, + "file_system_administrators_group": { + Type: schema.TypeString, + Computed: true, + }, + "organizational_unit_distinguished_name": { + Type: schema.TypeString, + Computed: true, + }, + "username": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "creation_time": { + Type: schema.TypeString, + Computed: true, + }, + "endpoints": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "iscsi": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_addresses": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "management": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_addresses": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "nfs": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_addresses": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "smb": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_addresses": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + }, + }, + "file_system_id": { + Type: schema.TypeString, + Computed: true, + }, + "filter": DataSoureStorageVirtualMachineFiltersSchema(), + "id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "lifecycle_status": { + Type: schema.TypeString, + Computed: true, + }, + "lifecycle_transition_reason": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "message": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "root_volume_security_style": { + Type: schema.TypeString, + Computed: true, + }, + "subtype": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tftags.TagsSchemaComputed(), + "uuid": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +const ( + DSNameOntapStorageVirtualMachine = "Ontap Storage Virtual Machine Data Source" +) + +func dataSourceOntapStorageVirtualMachineRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + var diags diag.Diagnostics + conn := meta.(*conns.AWSClient).FSxConn(ctx) + defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig + ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig + + input := &fsx.DescribeStorageVirtualMachinesInput{} + + if id, ok := d.GetOk("id"); ok { + input.StorageVirtualMachineIds = []*string{aws.String(id.(string))} + } + + input.Filters = BuildStorageVirtualMachineFiltersDataSource( + d.Get("filter").(*schema.Set), + ) + + if len(input.Filters) == 0 { + input.Filters = nil + } + + svm, err := FindStorageVirtualMachine(ctx, conn, input) + + if err != nil { + return sdkdiag.AppendFromErr(diags, tfresource.SingularDataSourceFindError("FSx StorageVirtualMachine", err)) + } + + d.SetId(aws.StringValue(svm.StorageVirtualMachineId)) + + d.Set("arn", svm.ResourceARN) + d.Set("endpoints", flattenOntapStorageVirtualMachineEndpoints(svm.Endpoints)) + d.Set("file_system_id", svm.FileSystemId) + d.Set("id", svm.StorageVirtualMachineId) + d.Set("lifecycle_status", svm.Lifecycle) + d.Set("lifecycle_transition_reason", flattenOntapSvmLifecycleTransitionReason(svm.LifecycleTransitionReason)) + d.Set("name", svm.Name) + d.Set("root_volume_security_style", svm.RootVolumeSecurityStyle) + d.Set("subtype", svm.Subtype) + d.Set("uuid", svm.UUID) + + if err := d.Set("active_directory_configuration", flattenOntapSvmActiveDirectoryConfiguration(d, svm.ActiveDirectoryConfiguration)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting svm_active_directory: %s", err) + } + + if err := d.Set("creation_time", svm.CreationTime.Format(time.RFC3339)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting creation_time: %s", err) + } + + tags := KeyValueTags(ctx, svm.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return sdkdiag.AppendErrorf(diags, "setting tags: %s", err) + } + + return diags +} + +func flattenOntapSvmLifecycleTransitionReason(rs *fsx.LifecycleTransitionReason) []interface{} { + if rs == nil { + return []interface{}{} + } + + m := make(map[string]interface{}) + if rs.Message != nil { + m["message"] = aws.StringValue(rs.Message) + } + + return []interface{}{m} +} diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go new file mode 100644 index 00000000000..326db8079ee --- /dev/null +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -0,0 +1,160 @@ +package fsx_test + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/service/fsx" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" +) + +func TestAccFSxOntapStorageVirtualMachineDataSource_Id(t *testing.T) { + ctx := acctest.Context(t) + + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + resourceName := "aws_fsx_ontap_storage_virtual_machine.test" + dataSourceName := "data.aws_fsx_ontap_storage_virtual_machine.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, fsx.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckOntapStorageVirtualMachineDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccFSxOntapStorageVirtualMachineDataSourceConfig_Id(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration", resourceName, "active_directory_configuration"), + resource.TestCheckResourceAttrPair(dataSourceName, "endpoints", resourceName, "endpoints"), + resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), + resource.TestCheckResourceAttrPair(dataSourceName, "root_volume_security_style", resourceName, "root_volume_security_style"), + resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), + resource.TestCheckResourceAttrPair(dataSourceName, "uuid", resourceName, "uuid"), + ), + }, + }, + }) +} + +func TestAccFSxOntapStorageVirtualMachineDataSource_Filter(t *testing.T) { + ctx := acctest.Context(t) + + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + resourceName := "aws_fsx_ontap_storage_virtual_machine.test" + dataSourceName := "data.aws_fsx_ontap_storage_virtual_machine.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, fsx.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckOntapStorageVirtualMachineDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccFSxOntapStorageVirtualMachineDataSourceConfig_Filter(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration", resourceName, "active_directory_configuration"), + resource.TestCheckResourceAttrPair(dataSourceName, "endpoints", resourceName, "endpoints"), + resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), + resource.TestCheckResourceAttrPair(dataSourceName, "root_volume_security_style", resourceName, "root_volume_security_style"), + resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), + resource.TestCheckResourceAttrPair(dataSourceName, "uuid", resourceName, "uuid"), + ), + }, + }, + }) +} + +func testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName string) string { + return acctest.ConfigCompose(acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` +data "aws_partition" "current" {} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test1" { + vpc_id = aws_vpc.test.id + cidr_block = "10.0.1.0/24" + availability_zone = data.aws_availability_zones.available.names[0] + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test2" { + vpc_id = aws_vpc.test.id + cidr_block = "10.0.2.0/24" + availability_zone = data.aws_availability_zones.available.names[1] + + tags = { + Name = %[1]q + } +} + +resource "aws_fsx_ontap_file_system" "test" { + storage_capacity = 1024 + subnet_ids = [aws_subnet.test1.id] + deployment_type = "SINGLE_AZ_1" + throughput_capacity = 512 + preferred_subnet_id = aws_subnet.test1.id + + tags = { + Name = %[1]q + } +} +`, rName)) +} + +func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Id(rName string) string { + return acctest.ConfigCompose(testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName), fmt.Sprintf(` +resource "aws_fsx_ontap_storage_virtual_machine" "test" { + file_system_id = aws_fsx_ontap_file_system.test.id + name = %[1]q +} + +data "aws_fsx_ontap_storage_virtual_machine" "test" { + id = aws_fsx_ontap_storage_virtual_machine.test.id +} +`, rName)) +} + +func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Filter(rName string) string { + return acctest.ConfigCompose(testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName), fmt.Sprintf(` +resource "aws_fsx_ontap_storage_virtual_machine" "test" { + file_system_id = aws_fsx_ontap_file_system.test.id + name = %[1]q +} + +data "aws_fsx_ontap_storage_virtual_machine" "test" { + filter { + name = "file-system-id" + values = [aws_fsx_ontap_file_system.test.id] + } + + depends_on = [ + aws_fsx_ontap_storage_virtual_machine.test + ] +} +`, rName)) +} diff --git a/internal/service/fsx/service_package_gen.go b/internal/service/fsx/service_package_gen.go index 38d735af0a8..f38f2d11954 100644 --- a/internal/service/fsx/service_package_gen.go +++ b/internal/service/fsx/service_package_gen.go @@ -25,6 +25,11 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { return []*types.ServicePackageSDKDataSource{ + { + Factory: DataSourceOntapStorageVirtualMachine, + TypeName: "aws_fsx_ontap_storage_virtual_machine", + Name: "Ontap Storage Virtual Machine", + }, { Factory: DataSourceOpenzfsSnapshot, TypeName: "aws_fsx_openzfs_snapshot", diff --git a/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown b/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown new file mode 100644 index 00000000000..c102b14de5d --- /dev/null +++ b/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown @@ -0,0 +1,98 @@ +--- +subcategory: "FSx" +layout: "aws" +page_title: "AWS: aws_fsx_ontap_storage_virtual_machine" +description: |- + Retrieve information on FSx ONTAP Storage Virtual Machine (SVM). +--- + +# Data Source: aws_fsx_ontap_storage_virtual_machine + +Retrieve information on FSx ONTAP Storage Virtual Machine (SVM). + +## Example Usage + +### Basic Usage + +```terraform +data "aws_fsx_ontap_storage_virtual_machine" "example" { + id = "svm-12345678" +} +``` + +### Filter Example + +``` +data "aws_fsx_ontap_storage_virtual_machine" "test" { + filter { + name = "file-system-id" + values = ["fs-12345678"] + } +} +``` + +## Argument Reference + +The arguments of this data source act as filters for querying the available ONTAP Storage Virtual Machines in the current region. The given filters must match exactly one Storage Virtual Machine whose data will be exported as attributes. + +The following arguments are optional: + +* `filter` - (Optional) Configuration block. Detailed below. +* `id` - (Optional) Identifier of the storage virtual machine (e.g. `svm-12345678`). + +### filter + +This block allows for complex filters. + +The following arguments are required: + +* `name` - (Required) Name of the field to filter by, as defined by [the underlying AWS API](https://docs.aws.amazon.com/fsx/latest/APIReference/API_StorageVirtualMachineFilter.html). +* `values` - (Required) Set of values that are accepted for the given field. An SVM will be selected if any one of the given values matches. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name of the SVM. +* `active_directory_configuration` - The Microsoft Active Directory configuration to which the SVM is joined, if applicable. See [Active Directory Configuration](#active-directory-configuration) below. +* `creation_time` - The time that the SVM was created. +* `endpoints` - The endpoints that are used to access data or to manage the SVM using the NetApp ONTAP CLI, REST API, or NetApp CloudManager. They are the Iscsi, Management, Nfs, and Smb endpoints. See [SVM Endpoints](#svm-endpoints) below. +* `file_system_id` - Identifier of the file system (e.g. `fs-12345678`). +* `id` - The SVM's system generated unique ID. +* `lifecycle_status` - The SVM's lifecycle status. +* `lifecycle_transition_reason` - Describes why the SVM lifecycle state changed. See [Lifecycle Transition Reason](#lifecycle-transition-reason) below. +* `name` - The name of the SVM, if provisioned. +* `root_volume_security_style` - The security style of the root volume of the SVM. +* `subtype` - The SVM's subtype. +* `uuid` - The SVM's UUID. + +### Active Directory Configuration + +The following arguments are supported for `active_directory_configuration` configuration block: + +* `netbios_name` - The NetBIOS name of the AD computer object to which the SVM is joined. +* `self_managed_active_directory` - The configuration of the self-managed Microsoft Active Directory (AD) directory to which the Windows File Server or ONTAP storage virtual machine (SVM) instance is joined. See [Self Managed Active Directory](#self-managed-active-directory) below. + +### Self Managed Active Directory + +* `dns_ips` - A list of up to three IP addresses of DNS servers or domain controllers in the self-managed AD directory. +* `domain_name` - The fully qualified domain name of the self-managed AD directory. +* `file_system_administrators_group` - The name of the domain group whose members have administrative privileges for the FSx file system. +* `organizational_unit_distinguished_name` - The fully qualified distinguished name of the organizational unit within the self-managed AD directory to which the Windows File Server or ONTAP storage virtual machine (SVM) instance is joined. +* `username` - The user name for the service account on your self-managed AD domain that FSx uses to join to your AD domain. + +### Lifecycle Transition Reason + +* `message` - A detailed message. + +### SVM Endpoints + +* `Iscsi` - An endpoint for connecting using the Internet Small Computer Systems Interface (iSCSI) protocol. See [SVM Endpoint](#svm-endpoint) below. +* `management` - An endpoint for managing SVMs using the NetApp ONTAP CLI, NetApp ONTAP API, or NetApp CloudManager. See [SVM Endpoint](#svm-endpoint) below. +* `nfs` - An endpoint for connecting using the Network File System (NFS) protocol. See [SVM Endpoint](#svm-endpoint) below. +* `smb` - An endpoint for connecting using the Server Message Block (SMB) protocol. See [SVM Endpoint](#svm-endpoint) below. + +### SVM Endpoint + +* `DNSName` - The file system's DNS name. You can mount your file system using its DNS name. +* `IpAddresses` - The SVM endpoint's IP addresses. From aeaaf5eac54618f105da820a86c92da55323171a Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 20 Jul 2023 12:46:55 -0400 Subject: [PATCH 02/12] Add changelog --- .changelog/32621.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32621.txt diff --git a/.changelog/32621.txt b/.changelog/32621.txt new file mode 100644 index 00000000000..7f9404ba223 --- /dev/null +++ b/.changelog/32621.txt @@ -0,0 +1,3 @@ +```release-note:new-data-source +aws_fsx_ontap_storage_virtual_machine +``` From 6e46f317785dd096b5e8cbd5b92eb433438b76ec Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 20 Sep 2023 09:03:11 -0400 Subject: [PATCH 03/12] d/aws_fsx_ontap_storage_virtual_machine: Use 'findStorageVirtualMachine'. --- .../service/fsx/common_schema_data_source.go | 2 +- internal/service/fsx/find.go | 49 ------------------- ...tap_storage_virtual_machine_data_source.go | 14 ++---- internal/service/fsx/service_package_gen.go | 2 +- 4 files changed, 7 insertions(+), 60 deletions(-) diff --git a/internal/service/fsx/common_schema_data_source.go b/internal/service/fsx/common_schema_data_source.go index d0ece97a3f2..e471b2490ff 100644 --- a/internal/service/fsx/common_schema_data_source.go +++ b/internal/service/fsx/common_schema_data_source.go @@ -64,7 +64,7 @@ func BuildStorageVirtualMachineFiltersDataSource(set *schema.Set) []*fsx.Storage return filters } -func DataSoureStorageVirtualMachineFiltersSchema() *schema.Schema { +func DataSourceStorageVirtualMachineFiltersSchema() *schema.Schema { return &schema.Schema{ Type: schema.TypeSet, Optional: true, diff --git a/internal/service/fsx/find.go b/internal/service/fsx/find.go index 017280328c3..c24a32bda5d 100644 --- a/internal/service/fsx/find.go +++ b/internal/service/fsx/find.go @@ -126,52 +126,3 @@ func FindSnapshots(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeSnapsh return output, nil } - -func FindStorageVirtualMachine(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeStorageVirtualMachinesInput) (*fsx.StorageVirtualMachine, error) { - output, err := FindStorageVirtualMachines(ctx, conn, input) - - if err != nil { - return nil, err - } - - if len(output) == 0 || output[0] == nil { - return nil, tfresource.NewEmptyResultError(input) - } - - if count := len(output); count > 1 { - return nil, tfresource.NewTooManyResultsError(count, input) - } - - return output[0], nil -} - -func FindStorageVirtualMachines(ctx context.Context, conn *fsx.FSx, input *fsx.DescribeStorageVirtualMachinesInput) ([]*fsx.StorageVirtualMachine, error) { - var output []*fsx.StorageVirtualMachine - - err := conn.DescribeStorageVirtualMachinesPagesWithContext(ctx, input, func(page *fsx.DescribeStorageVirtualMachinesOutput, lastPage bool) bool { - if page == nil { - return !lastPage - } - - for _, v := range page.StorageVirtualMachines { - if v != nil { - output = append(output, v) - } - } - - return !lastPage - }) - - if tfawserr.ErrCodeEquals(err, fsx.ErrCodeStorageVirtualMachineNotFound) { - return nil, &retry.NotFoundError{ - LastError: err, - LastRequest: input, - } - } - - if err != nil { - return nil, err - } - - return output, nil -} diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go index 6c4e0e7f5a6..71e1809330f 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -13,11 +13,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" - "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -// @SDKDataSource("aws_fsx_ontap_storage_virtual_machine", name="Ontap Storage Virtual Machine") +// @SDKDataSource("aws_fsx_ontap_storage_virtual_machine", name="ONTAP Storage Virtual Machine") func DataSourceOntapStorageVirtualMachine() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceOntapStorageVirtualMachineRead, @@ -152,7 +152,7 @@ func DataSourceOntapStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": DataSoureStorageVirtualMachineFiltersSchema(), + "filter": DataSourceStorageVirtualMachineFiltersSchema(), "id": { Type: schema.TypeString, Optional: true, @@ -191,10 +191,6 @@ func DataSourceOntapStorageVirtualMachine() *schema.Resource { } } -const ( - DSNameOntapStorageVirtualMachine = "Ontap Storage Virtual Machine Data Source" -) - func dataSourceOntapStorageVirtualMachineRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics conn := meta.(*conns.AWSClient).FSxConn(ctx) @@ -215,10 +211,10 @@ func dataSourceOntapStorageVirtualMachineRead(ctx context.Context, d *schema.Res input.Filters = nil } - svm, err := FindStorageVirtualMachine(ctx, conn, input) + svm, err := findStorageVirtualMachine(ctx, conn, input, tfslices.PredicateTrue[*fsx.StorageVirtualMachine]()) if err != nil { - return sdkdiag.AppendFromErr(diags, tfresource.SingularDataSourceFindError("FSx StorageVirtualMachine", err)) + return sdkdiag.AppendErrorf(diags, "reading FSx ONTAP Storage Virtual Machine: %s", err) } d.SetId(aws.StringValue(svm.StorageVirtualMachineId)) diff --git a/internal/service/fsx/service_package_gen.go b/internal/service/fsx/service_package_gen.go index 445bff04b78..6c64fe6af04 100644 --- a/internal/service/fsx/service_package_gen.go +++ b/internal/service/fsx/service_package_gen.go @@ -33,7 +33,7 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac { Factory: DataSourceOntapStorageVirtualMachine, TypeName: "aws_fsx_ontap_storage_virtual_machine", - Name: "Ontap Storage Virtual Machine", + Name: "ONTAP Storage Virtual Machine", }, { Factory: DataSourceOpenzfsSnapshot, From 7aa9b48c82c4d6c72d06d47c205091e37320f58a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 20 Sep 2023 09:06:28 -0400 Subject: [PATCH 04/12] d/aws_fsx_ontap_storage_virtual_machine: Simplify acceptance test configurations. --- ...torage_virtual_machine_data_source_test.go | 75 ++----------------- ...ntap_storage_virtual_machine.html.markdown | 8 +- 2 files changed, 12 insertions(+), 71 deletions(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go index e89552577ea..c57395d1d35 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -4,7 +4,6 @@ package fsx_test import ( - "fmt" "testing" "github.com/aws/aws-sdk-go/service/fsx" @@ -79,81 +78,23 @@ func TestAccFSxOntapStorageVirtualMachineDataSource_Filter(t *testing.T) { }) } -func testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName string) string { - return acctest.ConfigCompose(acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` -data "aws_partition" "current" {} - -resource "aws_vpc" "test" { - cidr_block = "10.0.0.0/16" - - tags = { - Name = %[1]q - } -} - -resource "aws_subnet" "test1" { - vpc_id = aws_vpc.test.id - cidr_block = "10.0.1.0/24" - availability_zone = data.aws_availability_zones.available.names[0] - - tags = { - Name = %[1]q - } -} - -resource "aws_subnet" "test2" { - vpc_id = aws_vpc.test.id - cidr_block = "10.0.2.0/24" - availability_zone = data.aws_availability_zones.available.names[1] - - tags = { - Name = %[1]q - } -} - -resource "aws_fsx_ontap_file_system" "test" { - storage_capacity = 1024 - subnet_ids = [aws_subnet.test1.id] - deployment_type = "SINGLE_AZ_1" - throughput_capacity = 512 - preferred_subnet_id = aws_subnet.test1.id - - tags = { - Name = %[1]q - } -} -`, rName)) -} - func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Id(rName string) string { - return acctest.ConfigCompose(testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName), fmt.Sprintf(` -resource "aws_fsx_ontap_storage_virtual_machine" "test" { - file_system_id = aws_fsx_ontap_file_system.test.id - name = %[1]q -} - + return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { id = aws_fsx_ontap_storage_virtual_machine.test.id } -`, rName)) +`) } func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Filter(rName string) string { - return acctest.ConfigCompose(testAccOntapStorageVirtualMachineDataSourceBaseConfig(rName), fmt.Sprintf(` -resource "aws_fsx_ontap_storage_virtual_machine" "test" { - file_system_id = aws_fsx_ontap_file_system.test.id - name = %[1]q -} - + return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { filter { - name = "file-system-id" - values = [aws_fsx_ontap_file_system.test.id] - } + name = "file-system-id" + values = [aws_fsx_ontap_file_system.test.id] + } - depends_on = [ - aws_fsx_ontap_storage_virtual_machine.test - ] + depends_on = [aws_fsx_ontap_storage_virtual_machine.test] } -`, rName)) +`) } diff --git a/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown b/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown index 16d1a6a54ba..f8815943588 100644 --- a/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown +++ b/website/docs/d/fsx_ontap_storage_virtual_machine.html.markdown @@ -23,11 +23,11 @@ data "aws_fsx_ontap_storage_virtual_machine" "example" { ### Filter Example ``` -data "aws_fsx_ontap_storage_virtual_machine" "test" { +data "aws_fsx_ontap_storage_virtual_machine" "example" { filter { - name = "file-system-id" - values = ["fs-12345678"] - } + name = "file-system-id" + values = ["fs-12345678"] + } } ``` From 354ac0d0524af9182e1c2f8d6bcb62b22cefdc4d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 20 Sep 2023 09:08:34 -0400 Subject: [PATCH 05/12] r/aws_fsx_ontap_storage_virtual_machine: Change `file_system_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew). --- .changelog/32621.txt | 4 ++++ internal/service/fsx/ontap_storage_virtual_machine.go | 1 + 2 files changed, 5 insertions(+) diff --git a/.changelog/32621.txt b/.changelog/32621.txt index 7f9404ba223..ec4c48e4000 100644 --- a/.changelog/32621.txt +++ b/.changelog/32621.txt @@ -1,3 +1,7 @@ ```release-note:new-data-source aws_fsx_ontap_storage_virtual_machine ``` + +```release-note:bug +resource/aws_fsx_ontap_storage_virtual_machine: Change `file_system_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew) +``` \ No newline at end of file diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index b888ee4f90b..272d13c822a 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -199,6 +199,7 @@ func ResourceONTAPStorageVirtualMachine() *schema.Resource { "file_system_id": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringLenBetween(11, 21), }, "name": { From 3610f31f5c859fc5d716ff5b489dc1d8a342446a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 20 Sep 2023 09:12:09 -0400 Subject: [PATCH 06/12] d/aws_fsx_ontap_storage_virtual_machine: Acceptance test capitalization. --- ...ontap_storage_virtual_machine_data_source_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go index c57395d1d35..84dfebfb777 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/acctest" ) -func TestAccFSxOntapStorageVirtualMachineDataSource_Id(t *testing.T) { +func TestAccFSxONTAPStorageVirtualMachineDataSource_Id(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { @@ -29,7 +29,7 @@ func TestAccFSxOntapStorageVirtualMachineDataSource_Id(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccFSxOntapStorageVirtualMachineDataSourceConfig_Id(rName), + Config: testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Id(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), @@ -45,7 +45,7 @@ func TestAccFSxOntapStorageVirtualMachineDataSource_Id(t *testing.T) { }) } -func TestAccFSxOntapStorageVirtualMachineDataSource_Filter(t *testing.T) { +func TestAccFSxONTAPStorageVirtualMachineDataSource_Filter(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { @@ -62,7 +62,7 @@ func TestAccFSxOntapStorageVirtualMachineDataSource_Filter(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccFSxOntapStorageVirtualMachineDataSourceConfig_Filter(rName), + Config: testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Filter(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), @@ -78,7 +78,7 @@ func TestAccFSxOntapStorageVirtualMachineDataSource_Filter(t *testing.T) { }) } -func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Id(rName string) string { +func testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Id(rName string) string { return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { id = aws_fsx_ontap_storage_virtual_machine.test.id @@ -86,7 +86,7 @@ data "aws_fsx_ontap_storage_virtual_machine" "test" { `) } -func testAccFSxOntapStorageVirtualMachineDataSourceConfig_Filter(rName string) string { +func testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Filter(rName string) string { return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { filter { From ab6e08b08045c910fe351c8ef9dd2063ae721f37 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 20 Sep 2023 09:13:32 -0400 Subject: [PATCH 07/12] d/aws_fsx_ontap_storage_virtual_machine: Fix semgrep 'ci.fsx-in-func-name'. --- .../fsx/ontap_storage_virtual_machine_data_source_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go index 84dfebfb777..2bb73af2b09 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -29,7 +29,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Id(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Id(rName), + Config: testAccONTAPStorageVirtualMachineDataSourceConfig_Id(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), @@ -62,7 +62,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Filter(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Filter(rName), + Config: testAccONTAPStorageVirtualMachineDataSourceConfig_Filter(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), @@ -78,7 +78,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Filter(t *testing.T) { }) } -func testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Id(rName string) string { +func testAccONTAPStorageVirtualMachineDataSourceConfig_Id(rName string) string { return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { id = aws_fsx_ontap_storage_virtual_machine.test.id @@ -86,7 +86,7 @@ data "aws_fsx_ontap_storage_virtual_machine" "test" { `) } -func testAccFSxONTAPStorageVirtualMachineDataSourceConfig_Filter(rName string) string { +func testAccONTAPStorageVirtualMachineDataSourceConfig_Filter(rName string) string { return acctest.ConfigCompose(testAccONTAPStorageVirtualMachineConfig_basic(rName), ` data "aws_fsx_ontap_storage_virtual_machine" "test" { filter { From edceee3389417411071a5c9629998b2cdae8c207 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:08:17 -0400 Subject: [PATCH 08/12] build(deps): bump github.com/aws/aws-sdk-go in /.ci/providerlint (#33543) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.45.12 to 1.45.13. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.45.12...v1.45.13) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .ci/providerlint/go.mod | 2 +- .ci/providerlint/go.sum | 4 ++-- .../github.com/aws/aws-sdk-go/aws/endpoints/defaults.go | 3 +++ .ci/providerlint/vendor/modules.txt | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.ci/providerlint/go.mod b/.ci/providerlint/go.mod index 93ad4bc3ad8..5bc33a15b04 100644 --- a/.ci/providerlint/go.mod +++ b/.ci/providerlint/go.mod @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint go 1.20 require ( - github.com/aws/aws-sdk-go v1.45.12 + github.com/aws/aws-sdk-go v1.45.13 github.com/bflad/tfproviderlint v0.29.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 golang.org/x/tools v0.8.0 diff --git a/.ci/providerlint/go.sum b/.ci/providerlint/go.sum index 7d199281409..70dd8685cc6 100644 --- a/.ci/providerlint/go.sum +++ b/.ci/providerlint/go.sum @@ -8,8 +8,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/aws/aws-sdk-go v1.45.12 h1:+bKbbesGNPp+TeGrcqfrWuZoqcIEhjwKyBMHQPp80Jo= -github.com/aws/aws-sdk-go v1.45.12/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.45.13 h1:LwD/G+PX7FQnbU8wXekx12e90i1GuKJQC2+pl4IlPAs= +github.com/aws/aws-sdk-go v1.45.13/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow= diff --git a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 86082f706ad..2b7bdca86cf 100644 --- a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -27990,6 +27990,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-central-1", }: endpoint{}, + endpointKey{ + Region: "eu-central-2", + }: endpoint{}, endpointKey{ Region: "eu-north-1", }: endpoint{}, diff --git a/.ci/providerlint/vendor/modules.txt b/.ci/providerlint/vendor/modules.txt index 18c0d590f53..fcd635a48ef 100644 --- a/.ci/providerlint/vendor/modules.txt +++ b/.ci/providerlint/vendor/modules.txt @@ -24,7 +24,7 @@ github.com/agext/levenshtein # github.com/apparentlymart/go-textseg/v15 v15.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v15/textseg -# github.com/aws/aws-sdk-go v1.45.12 +# github.com/aws/aws-sdk-go v1.45.13 ## explicit; go 1.11 github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/endpoints From 35c3ade0e6f329baeba7d55f2589f4fb5dc9450d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:08:39 -0400 Subject: [PATCH 09/12] build(deps): bump the aws-sdk-go group with 2 updates (#33544) Bumps the aws-sdk-go group with 2 updates: [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) and [github.com/aws/aws-sdk-go-v2/service/ec2](https://github.com/aws/aws-sdk-go-v2). Updates `github.com/aws/aws-sdk-go` from 1.45.12 to 1.45.13 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.45.12...v1.45.13) Updates `github.com/aws/aws-sdk-go-v2/service/ec2` from 1.118.0 to 1.119.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/ec2/v1.118.0...service/ec2/v1.119.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/ec2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index f881de14aeb..d013f10c719 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 github.com/YakDriver/regexache v0.23.0 - github.com/aws/aws-sdk-go v1.45.12 + github.com/aws/aws-sdk-go v1.45.13 github.com/aws/aws-sdk-go-v2 v1.21.0 github.com/aws/aws-sdk-go-v2/config v1.18.40 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 @@ -25,7 +25,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/computeoptimizer v1.27.0 github.com/aws/aws-sdk-go-v2/service/directoryservice v1.18.5 github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.3.0 - github.com/aws/aws-sdk-go-v2/service/ec2 v1.118.0 + github.com/aws/aws-sdk-go-v2/service/ec2 v1.119.0 github.com/aws/aws-sdk-go-v2/service/emrserverless v1.10.5 github.com/aws/aws-sdk-go-v2/service/finspace v1.12.0 github.com/aws/aws-sdk-go-v2/service/fis v1.16.0 diff --git a/go.sum b/go.sum index 5aa726eda53..d5e64034dd5 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmms github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.45.12 h1:+bKbbesGNPp+TeGrcqfrWuZoqcIEhjwKyBMHQPp80Jo= -github.com/aws/aws-sdk-go v1.45.12/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.45.13 h1:LwD/G+PX7FQnbU8wXekx12e90i1GuKJQC2+pl4IlPAs= +github.com/aws/aws-sdk-go v1.45.13/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= @@ -74,8 +74,8 @@ github.com/aws/aws-sdk-go-v2/service/directoryservice v1.18.5 h1:prlnnmX0PYoho7c github.com/aws/aws-sdk-go-v2/service/directoryservice v1.18.5/go.mod h1:/kl14i35MzBB4oaVlmFVmTvdzTX5LiphIuRLyOJfoRU= github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.3.0 h1:c9Ifajg9VU0b86Xd7B6KGpEUtbXbwAJj/8FAQN6ZBeg= github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.3.0/go.mod h1:XLn8/EbqX+qGri306t4IPUBi+VmphNcsR+OJRxPlGqg= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.118.0 h1:ueSJS07XpOwCFhYTHh/Jjw856+U+u0Dv5LIIPOB1/Ns= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.118.0/go.mod h1:0FhI2Rzcv5BNM3dNnbcCx2qa2naFZoAidJi11cQgzL0= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.119.0 h1:oFrb1aQ07i+v63FOTywSG8xL/OYZbk+HmPE8FKSzkRk= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.119.0/go.mod h1:0FhI2Rzcv5BNM3dNnbcCx2qa2naFZoAidJi11cQgzL0= github.com/aws/aws-sdk-go-v2/service/emrserverless v1.10.5 h1:hhQPiPD696RlbY56NsMYVnVsS9ySrZc6eYC9yafauPk= github.com/aws/aws-sdk-go-v2/service/emrserverless v1.10.5/go.mod h1:uRIY0k05TXMGGlHeRxDDhWT9oBqcGbbEBN3gqk9Njos= github.com/aws/aws-sdk-go-v2/service/finspace v1.12.0 h1:qFaAEplUoebyUb2m0I3IgPK9hEZYL2zSDIW9lGMdfe4= From e03ce9e6a50e042f82ec6d169c465045175f63b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:10:35 -0400 Subject: [PATCH 10/12] build(deps): bump tibdex/github-app-token from 2.0.0 to 2.1.0 (#33545) Bumps [tibdex/github-app-token](https://github.com/tibdex/github-app-token) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/tibdex/github-app-token/releases) - [Commits](https://github.com/tibdex/github-app-token/compare/0914d50df753bbc42180d982a6550f195390069f...3beb63f4bd073e61482598c45c71c1019b59b73a) --- updated-dependencies: - dependency-name: tibdex/github-app-token dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cdktf-documentation.yml | 2 +- .github/workflows/issues.yml | 4 ++-- .github/workflows/pull_request_target.yml | 4 ++-- .github/workflows/resource-counts.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cdktf-documentation.yml b/.github/workflows/cdktf-documentation.yml index 4b39cc3ce1b..287dd94a080 100644 --- a/.github/workflows/cdktf-documentation.yml +++ b/.github/workflows/cdktf-documentation.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Generate Token id: generate_token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index f679c00d482..344e6e563fd 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -29,7 +29,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id @@ -87,7 +87,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 08d4cc36158..0837a586efe 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -30,7 +30,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id @@ -123,7 +123,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id diff --git a/.github/workflows/resource-counts.yml b/.github/workflows/resource-counts.yml index 4f9b2a1c779..d99d87db715 100644 --- a/.github/workflows/resource-counts.yml +++ b/.github/workflows/resource-counts.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Generate Token id: generate_token - uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: app_id: ${{ secrets.APP_ID }} installation_retrieval_mode: id From 8941b7f17ce615e0a98642833302356f3a193084 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 20 Sep 2023 12:04:18 -0400 Subject: [PATCH 11/12] teamcity/sanity: Avoid double message --- .teamcity/settings.kts | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index f114d6abf35..0360074d60c 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -594,32 +594,6 @@ object Sanity : BuildType({ type = "JetBrains.SharedResources" param("locks-param", "${DslContext.getParameter("aws_account.lock_id")} writeLock") } - - val notifierConnectionID = DslContext.getParameter("notifier.id", "") - val notifier: Notifier? = if (notifierConnectionID != "") { - Notifier(notifierConnectionID, DslContext.getParameter("notifier.destination")) - } else { - null - } - - if (notifier != null) { - val branchRef = DslContext.getParameter("branch_name", "") - notifications { - notifierSettings = slackNotifier { - connection = notifier.connectionID - sendTo = notifier.destination - messageFormat = verboseMessageFormat { - addBranch = branchRef != "refs/heads/main" - addStatusText = true - } - } - buildStarted = false - buildFailedToStart = true - buildFailed = true - buildFinishedSuccessfully = false - firstBuildErrorOccurs = true - } - } } }) From e1f0a57a9f7ae9697100ad115051a85678635141 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Wed, 20 Sep 2023 16:10:14 +0000 Subject: [PATCH 12/12] Update CHANGELOG.md for #33549 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a1e323556..662a5d128b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ FEATURES: * **New Data Source:** `aws_fsx_ontap_file_system` ([#32503](https://github.com/hashicorp/terraform-provider-aws/issues/32503)) +* **New Data Source:** `aws_fsx_ontap_storage_virtual_machine` ([#32621](https://github.com/hashicorp/terraform-provider-aws/issues/32621)) +* **New Data Source:** `aws_organizations_organizational_unit` ([#33408](https://github.com/hashicorp/terraform-provider-aws/issues/33408)) * **New Resource:** `aws_opensearch_package` ([#33227](https://github.com/hashicorp/terraform-provider-aws/issues/33227)) * **New Resource:** `aws_opensearch_package_association` ([#33227](https://github.com/hashicorp/terraform-provider-aws/issues/33227)) @@ -16,6 +18,7 @@ BUG FIXES: * resource/aws_db_instance: Fix so that `storage_throughput` can be changed when `iops` and `allocated_storage` are not changed ([#33529](https://github.com/hashicorp/terraform-provider-aws/issues/33529)) * resource/aws_db_option_group: Avoid erroneous differences being reported when an `option` `port` and/or `version` is not set ([#33511](https://github.com/hashicorp/terraform-provider-aws/issues/33511)) * resource/aws_fsx_ontap_storage_virtual_machine: Avoid recreating resource when `active_directory_configuration.self_managed_active_directory_configuration.file_system_administrators_group` is configured ([#33466](https://github.com/hashicorp/terraform-provider-aws/issues/33466)) +* resource/aws_fsx_ontap_storage_virtual_machine: Change `file_system_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew) ([#32621](https://github.com/hashicorp/terraform-provider-aws/issues/32621)) * resource/aws_sesv2_email_identity: Mark `dkim_signing_attributes.domain_signing_private_key` as sensitive ([#33477](https://github.com/hashicorp/terraform-provider-aws/issues/33477)) ## 5.17.0 (September 14, 2023)