From a5826f683742940fed31b6b8e6b7e74b9c344f5c Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 13 Jul 2023 16:58:04 -0400 Subject: [PATCH 01/17] Add FSx ONTAP Data Source --- .../fsx/ontap_file_system_data_source.go | 230 ++++++++++++++++++ .../fsx/ontap_file_system_data_source_test.go | 63 +++++ internal/service/fsx/service_package_gen.go | 5 + .../d/fsx_ontap_file_system.html.markdown | 68 ++++++ 4 files changed, 366 insertions(+) create mode 100644 internal/service/fsx/ontap_file_system_data_source.go create mode 100644 internal/service/fsx/ontap_file_system_data_source_test.go create mode 100644 website/docs/d/fsx_ontap_file_system.html.markdown diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go new file mode 100644 index 00000000000..d12be7ef332 --- /dev/null +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -0,0 +1,230 @@ +package fsx + +import ( + "context" + + "github.com/aws/aws-sdk-go/aws" + "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" +) + +// @SDKDataSource("aws_fsx_ontap_file_system", name="Ontap File System") +func DataSourceOntapFileSystem() *schema.Resource { + return &schema.Resource{ + ReadWithoutTimeout: dataSourceOntapFileSystemRead, + + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "automatic_backup_retention_days": { + Type: schema.TypeInt, + Computed: true, + }, + "daily_automatic_backup_start_time": { + Type: schema.TypeString, + Computed: true, + }, + "deployment_type": { + Type: schema.TypeString, + Computed: true, + }, + "disk_iops_configuration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "iops": { + Type: schema.TypeInt, + Computed: true, + }, + "mode": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "endpoint_ip_address_range": { + Type: schema.TypeString, + Computed: true, + }, + "endpoints": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "intercluster": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "ip_addresses": { + Type: schema.TypeList, + 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.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Required: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_interface_ids": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "preferred_subnet_id": { + Type: schema.TypeString, + Computed: true, + }, + "route_table_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "storage_capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + "subnet_ids": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "tags": tftags.TagsSchemaComputed(), + "throughput_capacity": { + Type: schema.TypeInt, + Computed: true, + }, + "vpc_id": { + Type: schema.TypeString, + Computed: true, + }, + "weekly_maintenance_start_time": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +const ( + DSNameOntapFileSystem = "Ontap File System Data Source" +) + +func dataSourceOntapFileSystemRead(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 + + id := d.Get("id").(string) + filesystem, err := FindFileSystemByID(ctx, conn, id) + + if err != nil { + return sdkdiag.AppendErrorf(diags, "reading FSx Ontap File System (%s): %s", d.Id(), err) + } + + if filesystem.LustreConfiguration != nil { + return sdkdiag.AppendErrorf(diags, "expected FSx Ontap File System, found FSx Lustre File System: %s", d.Id()) + } + + if filesystem.WindowsConfiguration != nil { + return sdkdiag.AppendErrorf(diags, "expected FSx Ontap File System, found FSx Windows File System: %s", d.Id()) + } + + if filesystem.OpenZFSConfiguration != nil { + return sdkdiag.AppendErrorf(diags, "expected FSx Ontap File System, found FSx OpenZFS File System: %s", d.Id()) + } + + if filesystem.OntapConfiguration == nil { + return sdkdiag.AppendErrorf(diags, "reading FSx Ontap File System (%s): empty OntapConfiguration", d.Id()) + } + + d.SetId(aws.StringValue(filesystem.FileSystemId)) + d.Set("arn", filesystem.ResourceARN) + d.Set("automatic_backup_retention_days", filesystem.OntapConfiguration.AutomaticBackupRetentionDays) + d.Set("daily_automatic_backup_start_time", filesystem.OntapConfiguration.DailyAutomaticBackupStartTime) + d.Set("deployment_type", filesystem.OntapConfiguration.DeploymentType) + if err := d.Set("disk_iops_configuration", flattenOntapFileDiskIopsConfiguration(filesystem.OntapConfiguration.DiskIopsConfiguration)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting disk_iops_configuration: %s", err) + } + d.Set("dns_name", filesystem.DNSName) + d.Set("endpoint_ip_address_range", filesystem.OntapConfiguration.EndpointIpAddressRange) + if err := d.Set("endpoints", flattenOntapFileSystemEndpoints(filesystem.OntapConfiguration.Endpoints)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) + } + d.Set("id", filesystem.FileSystemId) + d.Set("kms_key_id", filesystem.KmsKeyId) + d.Set("network_interface_ids", aws.StringValueSlice(filesystem.NetworkInterfaceIds)) + d.Set("owner_id", filesystem.OwnerId) + d.Set("preferred_subnet_id", filesystem.OntapConfiguration.PreferredSubnetId) + d.Set("route_table_ids", aws.StringValueSlice(filesystem.OntapConfiguration.RouteTableIds)) + d.Set("storage_capacity", filesystem.StorageCapacity) + d.Set("storage_type", filesystem.StorageType) + d.Set("subnet_ids", aws.StringValueSlice(filesystem.SubnetIds)) + d.Set("throughput_capacity", filesystem.OntapConfiguration.ThroughputCapacity) + d.Set("vpc_id", filesystem.VpcId) + d.Set("weekly_maintenance_start_time", filesystem.OntapConfiguration.WeeklyMaintenanceStartTime) + + tags := KeyValueTags(ctx, filesystem.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 +} diff --git a/internal/service/fsx/ontap_file_system_data_source_test.go b/internal/service/fsx/ontap_file_system_data_source_test.go new file mode 100644 index 00000000000..13bd77955a9 --- /dev/null +++ b/internal/service/fsx/ontap_file_system_data_source_test.go @@ -0,0 +1,63 @@ +package fsx_test + +import ( + "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 TestAccFSxOntapFileSystemDataSource_Id(t *testing.T) { + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + ctx := acctest.Context(t) + resourceName := "aws_fsx_ontap_file_system.test" + datasourceName := "data.aws_fsx_ontap_file_system.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: testAccCheckOntapFileSystemDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccOntapFileSystemDataSourceConfigId(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(datasourceName, "automatic_backup_retention_days", resourceName, "automatic_backup_retention_days"), + resource.TestCheckResourceAttrPair(datasourceName, "daily_automatic_backup_start_time", resourceName, "daily_automatic_backup_start_time"), + resource.TestCheckResourceAttrPair(datasourceName, "deployment_type", resourceName, "deployment_type"), + resource.TestCheckResourceAttrPair(datasourceName, "disk_iops_configuration", resourceName, "disk_iops_configuration"), + resource.TestCheckResourceAttrPair(datasourceName, "dns_name", resourceName, "dns_name"), + resource.TestCheckResourceAttrPair(datasourceName, "endpoint_ip_address_range", resourceName, "endpoint_ip_address_range"), + resource.TestCheckResourceAttrPair(datasourceName, "endpoints", resourceName, "endpoints"), + resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "kms_key_id", resourceName, "kms_key_id"), + resource.TestCheckResourceAttrPair(datasourceName, "network_interface_ids", resourceName, "network_interface_ids"), + resource.TestCheckResourceAttrPair(datasourceName, "owner_id", resourceName, "owner_id"), + resource.TestCheckResourceAttrPair(datasourceName, "preferred_subnet_id", resourceName, "preferred_subnet_id"), + resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids", resourceName, "route_table_ids"), + resource.TestCheckResourceAttrPair(datasourceName, "storage_capacity", resourceName, "storage_capacity"), + resource.TestCheckResourceAttrPair(datasourceName, "storage_type", resourceName, "storage_type"), + resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), + resource.TestCheckResourceAttrPair(datasourceName, "throughput_capacity", resourceName, "throughput_capacity"), + resource.TestCheckResourceAttrPair(datasourceName, "vpc_id", resourceName, "vpc_id"), + resource.TestCheckResourceAttrPair(datasourceName, "weekly_maintenance_start_time", resourceName, "weekly_maintenance_start_time"), + ), + }, + }, + }) +} + +func testAccOntapFileSystemDataSourceConfigId(rName string) string { + return acctest.ConfigCompose(testAccONTAPFileSystemConfig_basic(rName), ` +data "aws_fsx_ontap_file_system" "test" { + id = aws_fsx_ontap_file_system.test.id +} +`) +} diff --git a/internal/service/fsx/service_package_gen.go b/internal/service/fsx/service_package_gen.go index 38d735af0a8..b0018e2bcce 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: DataSourceOntapFileSystem, + TypeName: "aws_fsx_ontap_file_system", + Name: "Ontap File System", + }, { Factory: DataSourceOpenzfsSnapshot, TypeName: "aws_fsx_openzfs_snapshot", diff --git a/website/docs/d/fsx_ontap_file_system.html.markdown b/website/docs/d/fsx_ontap_file_system.html.markdown new file mode 100644 index 00000000000..8af7948c34b --- /dev/null +++ b/website/docs/d/fsx_ontap_file_system.html.markdown @@ -0,0 +1,68 @@ +--- +subcategory: "FSx" +layout: "aws" +page_title: "AWS: aws_fsx_ontap_file_system" +description: |- + Retrieve information on FSx ONTAP File System. +--- + +# Data Source: aws_fsx_ontap_file_system + +Retrieve information on FSx ONTAP File System. + +## Example Usage + +### Basic Usage + +```terraform +data "aws_fsx_ontap_file_system" "example" { + id = "fs-12345678 +} +``` + +## Argument Reference + +The following arguments are required: + +* `id` - (Required) Identifier of the file system (e.g. `fs-12345678`). + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name of the file system. +* `automatic_backup_retention_days` - The number of days to retain automatic backups. +* `daily_automatic_backup_start_time` - The preferred time (in `HH:MM` format) to take daily automatic backups, in the UTC time zone. +* `deployment_type` - The file system deployment type. +* `disk_iops_configuration` - The SSD IOPS configuration for the Amazon FSx for NetApp ONTAP file system, specifying the number of provisioned IOPS and the provision mode. See [Disk IOPS](#disk-iops) Below. +* `dns_name` - DNS name for the file system (e.g. `fs-12345678.corp.example.com`). +* `endpoint_ip_address_range` - (Multi-AZ only) Specifies the IP address range in which the endpoints to access your file system exist. +* `endpoints` - The Management and Intercluster FileSystemEndpoints that are used to access data or to manage the file system using the NetApp ONTAP CLI, REST API, or NetApp SnapMirror. See [FileSystemEndpoints](#file-system-endpoints) below. +* `id` - Identifier of the file system (e.g. `fs-12345678`). +* `kms_key_id` - ARN for the KMS Key to encrypt the file system at rest. +* `network_interface_ids` - The IDs of the elastic network interfaces from which a specific file system is accessible. +* `owner_id` - AWS account identifier that created the file system. +* `preferred_subnet_id` - Specifies the subnet in which you want the preferred file server to be located. +* `route_table_ids` - (Multi-AZ only) The VPC route tables in which your file system's endpoints exist. +* `storage_capacity` - The storage capacity of the file system in gibibytes (GiB). +* `storage_type` - The type of storage the file system is using. If set to `SSD`, the file system uses solid state drive storage. If set to `HDD`, the file system uses hard disk drive storage. +* `subnet_ids` - Specifies the IDs of the subnets that the file system is accessible from. For the MULTI_AZ_1 file system deployment type, there are two subnet IDs, one for the preferred file server and one for the standby file server. The preferred file server subnet identified in the `preferred_subnet_id` property. +* `tags` - The tags associated with the file system. +* `throughput_capacity` - The sustained throughput of an Amazon FSx file system in Megabytes per second (MBps). +* `vpc_id` - The ID of the primary virtual private cloud (VPC) for the file system. +* `weekly_maintenance_start_time` - The preferred start time (in `D:HH:MM` format) to perform weekly maintenance, in the UTC time zone. + +### Disk IOPS + +* `iops` - The total number of SSD IOPS provisioned for the file system. +* `mode` - Specifies whether the file system is using the `AUTOMATIC` setting of SSD IOPS of 3 IOPS per GB of storage capacity, or if it using a `USER_PROVISIONED` value. + +### File System Endpoints + +* `intercluster` - A FileSystemEndpoint for managing your file system by setting up NetApp SnapMirror with other ONTAP systems. See [FileSystemEndpoint](#file-system-endpoint) below. +* `management` - A FileSystemEndpoint for managing your file system using the NetApp ONTAP CLI and NetApp ONTAP API. See [FileSystemEndpoint](#file-system-endpoint) below. + +### File System Endpoint + +* `DNSName` - The file system's DNS name. You can mount your file system using its DNS name. +* `IpAddresses` - IP addresses of the file system endpoint. From cbe1b8322fc0044ba0bec4b330e606965c638a26 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 13 Jul 2023 19:30:39 -0400 Subject: [PATCH 02/17] update schema --- .../service/fsx/ontap_file_system_data_source.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go index d12be7ef332..4a77f545a6e 100644 --- a/internal/service/fsx/ontap_file_system_data_source.go +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -72,7 +72,7 @@ func DataSourceOntapFileSystem() *schema.Resource { Computed: true, }, "ip_addresses": { - Type: schema.TypeList, + Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -89,7 +89,7 @@ func DataSourceOntapFileSystem() *schema.Resource { Computed: true, }, "ip_addresses": { - Type: schema.TypeList, + Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -108,11 +108,9 @@ func DataSourceOntapFileSystem() *schema.Resource { Computed: true, }, "network_interface_ids": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Elem: &schema.Schema{Type: schema.TypeString}, }, "owner_id": { Type: schema.TypeString, @@ -123,7 +121,7 @@ func DataSourceOntapFileSystem() *schema.Resource { Computed: true, }, "route_table_ids": { - Type: schema.TypeList, + Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -136,7 +134,7 @@ func DataSourceOntapFileSystem() *schema.Resource { Computed: true, }, "subnet_ids": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, From 4847817a611ca49ffd42e19323e4973f310aaaa0 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 13 Jul 2023 19:34:42 -0400 Subject: [PATCH 03/17] add changelog --- .changelog/32503.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32503.txt diff --git a/.changelog/32503.txt b/.changelog/32503.txt new file mode 100644 index 00000000000..490c696103b --- /dev/null +++ b/.changelog/32503.txt @@ -0,0 +1,3 @@ +```release-note:new-data-source +aws_fsx_ontap_file_system +``` From 4fc0a47f1e5206dd6b0e69f24daec3df03dd8b50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 06:23:53 +0000 Subject: [PATCH 04/17] build(deps): bump tibdex/github-app-token from 1.8.2 to 2.0.0 Bumps [tibdex/github-app-token](https://github.com/tibdex/github-app-token) from 1.8.2 to 2.0.0. - [Release notes](https://github.com/tibdex/github-app-token/releases) - [Commits](https://github.com/tibdex/github-app-token/compare/0d49dd721133f900ebd5e0dff2810704e8defbc6...0914d50df753bbc42180d982a6550f195390069f) --- updated-dependencies: - dependency-name: tibdex/github-app-token dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 46f2c480f2c..0e0545f4ee2 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@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 15e35ae298b..dce641bc5ad 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@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} @@ -86,7 +86,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index f459ef5c844..0884ad619ba 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@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} @@ -122,7 +122,7 @@ jobs: steps: - name: 'Generate Token' id: token - uses: tibdex/github-app-token@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} diff --git a/.github/workflows/resource-counts.yml b/.github/workflows/resource-counts.yml index c1cb994ad33..de1a7503b5e 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@0d49dd721133f900ebd5e0dff2810704e8defbc6 # v1.8.2 + uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} installation_id: ${{ secrets.INSTALLATION_ID }} From 13e5c261cc9068b0adbaacb8091b03cc1281c749 Mon Sep 17 00:00:00 2001 From: George Wu Date: Mon, 18 Sep 2023 23:18:39 -0700 Subject: [PATCH 05/17] Use AWS SDK for Go v2 for mediaconnect service. --- .github/labeler-pr-triage.yml | 2 +- go.mod | 1 + go.sum | 2 ++ internal/conns/awsclient_gen.go | 6 ++-- internal/service/mediaconnect/README.md | 2 +- internal/service/mediaconnect/generate.go | 2 +- .../mediaconnect/service_package_gen.go | 17 ++++++---- internal/service/mediaconnect/tags_gen.go | 33 +++++++++---------- names/names_data.csv | 2 +- 9 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.github/labeler-pr-triage.yml b/.github/labeler-pr-triage.yml index afd9edb0c51..854d3eb3933 100644 --- a/.github/labeler-pr-triage.yml +++ b/.github/labeler-pr-triage.yml @@ -680,7 +680,7 @@ service/marketplacemetering: - 'website/**/marketplacemetering_*' service/mediaconnect: - 'internal/service/mediaconnect/**/*' - - 'website/**/media_connect_*' + - 'website/**/mediaconnect_*' service/mediaconvert: - 'internal/service/mediaconvert/**/*' - 'website/**/media_convert_*' diff --git a/go.mod b/go.mod index 019f868a28b..033de732fd0 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/lambda v1.39.5 github.com/aws/aws-sdk-go-v2/service/lexmodelsv2 v1.32.5 github.com/aws/aws-sdk-go-v2/service/lightsail v1.28.5 + github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.20.5 github.com/aws/aws-sdk-go-v2/service/medialive v1.37.0 github.com/aws/aws-sdk-go-v2/service/mediapackage v1.23.3 github.com/aws/aws-sdk-go-v2/service/oam v1.2.5 diff --git a/go.sum b/go.sum index 871324a5c59..02def762b3b 100644 --- a/go.sum +++ b/go.sum @@ -118,6 +118,8 @@ github.com/aws/aws-sdk-go-v2/service/lexmodelsv2 v1.32.5 h1:vI9ar8zMH9oJ0ywJU184 github.com/aws/aws-sdk-go-v2/service/lexmodelsv2 v1.32.5/go.mod h1:BsjYt3w75hHFse6bzZt4Lvzdl2yKESDV6WIOOVOQsUU= github.com/aws/aws-sdk-go-v2/service/lightsail v1.28.5 h1:IFT75uoZ5Ohcpb0sf7NQTF0Tyx8SmfCMz9IQGjyztXQ= github.com/aws/aws-sdk-go-v2/service/lightsail v1.28.5/go.mod h1:nh/y5+FgVxvjrwd2myeB92rKKJVMkxZem3irP3/bT28= +github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.20.5 h1:aEG8G1HXtyaSRHp3fKzP/AgKAviExpth8MQeBPYLvzI= +github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.20.5/go.mod h1:MC8RAClijE5FGkgl8rgw3fHIpsgTk97iZyo8NsHW6wU= github.com/aws/aws-sdk-go-v2/service/medialive v1.37.0 h1:R5u3iuM07pN+lV4t3VHfr3kCByCnxZws1R5y875TuvQ= github.com/aws/aws-sdk-go-v2/service/medialive v1.37.0/go.mod h1:oBjVE7s8Z2RQtKxCgHavkhkAu0m54h4YCjXivPR/BhQ= github.com/aws/aws-sdk-go-v2/service/mediapackage v1.23.3 h1:lC+4aTyl6yZ59X2Ek0FBg2loD0R048dE/Hnje0tSg3s= diff --git a/internal/conns/awsclient_gen.go b/internal/conns/awsclient_gen.go index d8435373717..a4f259fd8cc 100644 --- a/internal/conns/awsclient_gen.go +++ b/internal/conns/awsclient_gen.go @@ -35,6 +35,7 @@ import ( lambda_sdkv2 "github.com/aws/aws-sdk-go-v2/service/lambda" lexmodelsv2_sdkv2 "github.com/aws/aws-sdk-go-v2/service/lexmodelsv2" lightsail_sdkv2 "github.com/aws/aws-sdk-go-v2/service/lightsail" + mediaconnect_sdkv2 "github.com/aws/aws-sdk-go-v2/service/mediaconnect" medialive_sdkv2 "github.com/aws/aws-sdk-go-v2/service/medialive" mediapackage_sdkv2 "github.com/aws/aws-sdk-go-v2/service/mediapackage" oam_sdkv2 "github.com/aws/aws-sdk-go-v2/service/oam" @@ -165,7 +166,6 @@ import ( locationservice_sdkv1 "github.com/aws/aws-sdk-go/service/locationservice" macie2_sdkv1 "github.com/aws/aws-sdk-go/service/macie2" managedgrafana_sdkv1 "github.com/aws/aws-sdk-go/service/managedgrafana" - mediaconnect_sdkv1 "github.com/aws/aws-sdk-go/service/mediaconnect" mediaconvert_sdkv1 "github.com/aws/aws-sdk-go/service/mediaconvert" mediastore_sdkv1 "github.com/aws/aws-sdk-go/service/mediastore" memorydb_sdkv1 "github.com/aws/aws-sdk-go/service/memorydb" @@ -758,8 +758,8 @@ func (c *AWSClient) Macie2Conn(ctx context.Context) *macie2_sdkv1.Macie2 { return errs.Must(conn[*macie2_sdkv1.Macie2](ctx, c, names.Macie2)) } -func (c *AWSClient) MediaConnectConn(ctx context.Context) *mediaconnect_sdkv1.MediaConnect { - return errs.Must(conn[*mediaconnect_sdkv1.MediaConnect](ctx, c, names.MediaConnect)) +func (c *AWSClient) MediaConnectClient(ctx context.Context) *mediaconnect_sdkv2.Client { + return errs.Must(client[*mediaconnect_sdkv2.Client](ctx, c, names.MediaConnect)) } func (c *AWSClient) MediaConvertConn(ctx context.Context) *mediaconvert_sdkv1.MediaConvert { diff --git a/internal/service/mediaconnect/README.md b/internal/service/mediaconnect/README.md index 49304e56642..38e3483d735 100644 --- a/internal/service/mediaconnect/README.md +++ b/internal/service/mediaconnect/README.md @@ -8,4 +8,4 @@ _At the moment, the Terraform AWS Provider has little or no support for MediaCon * [Find out about contributing](https://hashicorp.github.io/terraform-provider-aws/#contribute) to the AWS provider! * AWS Provider Docs: [Home](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) -* AWS Docs: [AWS SDK for Go MediaConnect](https://docs.aws.amazon.com/sdk-for-go/api/service/mediaconnect/) +* AWS Docs: [AWS SDK for Go MediaConnect](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/mediaconnect) diff --git a/internal/service/mediaconnect/generate.go b/internal/service/mediaconnect/generate.go index 3b82e38f603..d8e6b3c76f2 100644 --- a/internal/service/mediaconnect/generate.go +++ b/internal/service/mediaconnect/generate.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run ../../generate/tags/main.go -ListTags -ServiceTagsMap -UpdateTags +//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -KVTValues=true -SkipTypesImp=true -ListTags -ServiceTagsMap -UpdateTags //go:generate go run ../../generate/servicepackage/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. diff --git a/internal/service/mediaconnect/service_package_gen.go b/internal/service/mediaconnect/service_package_gen.go index 7adaa5c29b9..1c3e8fc9bed 100644 --- a/internal/service/mediaconnect/service_package_gen.go +++ b/internal/service/mediaconnect/service_package_gen.go @@ -5,9 +5,8 @@ package mediaconnect import ( "context" - aws_sdkv1 "github.com/aws/aws-sdk-go/aws" - session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" - mediaconnect_sdkv1 "github.com/aws/aws-sdk-go/service/mediaconnect" + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + mediaconnect_sdkv2 "github.com/aws/aws-sdk-go-v2/service/mediaconnect" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/types" "github.com/hashicorp/terraform-provider-aws/names" @@ -35,11 +34,15 @@ func (p *servicePackage) ServicePackageName() string { return names.MediaConnect } -// NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. -func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*mediaconnect_sdkv1.MediaConnect, error) { - sess := config["session"].(*session_sdkv1.Session) +// NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. +func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) (*mediaconnect_sdkv2.Client, error) { + cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) - return mediaconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return mediaconnect_sdkv2.NewFromConfig(cfg, func(o *mediaconnect_sdkv2.Options) { + if endpoint := config["endpoint"].(string); endpoint != "" { + o.BaseEndpoint = aws_sdkv2.String(endpoint) + } + }), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/mediaconnect/tags_gen.go b/internal/service/mediaconnect/tags_gen.go index 152f2fcdbbf..aaf7909fb60 100644 --- a/internal/service/mediaconnect/tags_gen.go +++ b/internal/service/mediaconnect/tags_gen.go @@ -5,9 +5,8 @@ import ( "context" "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/mediaconnect" - "github.com/aws/aws-sdk-go/service/mediaconnect/mediaconnectiface" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/mediaconnect" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/logging" @@ -19,12 +18,12 @@ import ( // listTags lists mediaconnect service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. -func listTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, identifier string) (tftags.KeyValueTags, error) { +func listTags(ctx context.Context, conn *mediaconnect.Client, identifier string) (tftags.KeyValueTags, error) { input := &mediaconnect.ListTagsForResourceInput{ ResourceArn: aws.String(identifier), } - output, err := conn.ListTagsForResourceWithContext(ctx, input) + output, err := conn.ListTagsForResource(ctx, input) if err != nil { return tftags.New(ctx, nil), err @@ -36,7 +35,7 @@ func listTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, ident // ListTags lists mediaconnect service tags and set them in Context. // It is called from outside this package. func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier string) error { - tags, err := listTags(ctx, meta.(*conns.AWSClient).MediaConnectConn(ctx), identifier) + tags, err := listTags(ctx, meta.(*conns.AWSClient).MediaConnectClient(ctx), identifier) if err != nil { return err @@ -49,21 +48,21 @@ func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier stri return nil } -// map[string]*string handling +// map[string]string handling // Tags returns mediaconnect service tags. -func Tags(tags tftags.KeyValueTags) map[string]*string { - return aws.StringMap(tags.Map()) +func Tags(tags tftags.KeyValueTags) map[string]string { + return tags.Map() } // KeyValueTags creates tftags.KeyValueTags from mediaconnect service tags. -func KeyValueTags(ctx context.Context, tags map[string]*string) tftags.KeyValueTags { +func KeyValueTags(ctx context.Context, tags map[string]string) tftags.KeyValueTags { return tftags.New(ctx, tags) } // getTagsIn returns mediaconnect service tags from Context. // nil is returned if there are no input tags. -func getTagsIn(ctx context.Context) map[string]*string { +func getTagsIn(ctx context.Context) map[string]string { if inContext, ok := tftags.FromContext(ctx); ok { if tags := Tags(inContext.TagsIn.UnwrapOrDefault()); len(tags) > 0 { return tags @@ -74,7 +73,7 @@ func getTagsIn(ctx context.Context) map[string]*string { } // setTagsOut sets mediaconnect service tags in Context. -func setTagsOut(ctx context.Context, tags map[string]*string) { +func setTagsOut(ctx context.Context, tags map[string]string) { if inContext, ok := tftags.FromContext(ctx); ok { inContext.TagsOut = types.Some(KeyValueTags(ctx, tags)) } @@ -83,7 +82,7 @@ func setTagsOut(ctx context.Context, tags map[string]*string) { // updateTags updates mediaconnect service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. -func updateTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, identifier string, oldTagsMap, newTagsMap any) error { +func updateTags(ctx context.Context, conn *mediaconnect.Client, identifier string, oldTagsMap, newTagsMap any) error { oldTags := tftags.New(ctx, oldTagsMap) newTags := tftags.New(ctx, newTagsMap) @@ -94,10 +93,10 @@ func updateTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, ide if len(removedTags) > 0 { input := &mediaconnect.UntagResourceInput{ ResourceArn: aws.String(identifier), - TagKeys: aws.StringSlice(removedTags.Keys()), + TagKeys: removedTags.Keys(), } - _, err := conn.UntagResourceWithContext(ctx, input) + _, err := conn.UntagResource(ctx, input) if err != nil { return fmt.Errorf("untagging resource (%s): %w", identifier, err) @@ -112,7 +111,7 @@ func updateTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, ide Tags: Tags(updatedTags), } - _, err := conn.TagResourceWithContext(ctx, input) + _, err := conn.TagResource(ctx, input) if err != nil { return fmt.Errorf("tagging resource (%s): %w", identifier, err) @@ -125,5 +124,5 @@ func updateTags(ctx context.Context, conn mediaconnectiface.MediaConnectAPI, ide // UpdateTags updates mediaconnect service tags. // It is called from outside this package. func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { - return updateTags(ctx, meta.(*conns.AWSClient).MediaConnectConn(ctx), identifier, oldTags, newTags) + return updateTags(ctx, meta.(*conns.AWSClient).MediaConnectClient(ctx), identifier, oldTags, newTags) } diff --git a/names/names_data.csv b/names/names_data.csv index fb3a690acc9..79e804a2190 100644 --- a/names/names_data.csv +++ b/names/names_data.csv @@ -138,7 +138,7 @@ elasticache,elasticache,elasticache,elasticache,,elasticache,,,ElastiCache,Elast es,es,elasticsearchservice,elasticsearchservice,elasticsearch,es,,es;elasticsearchservice,Elasticsearch,ElasticsearchService,,1,,aws_elasticsearch_,aws_es_,,elasticsearch_,Elasticsearch,Amazon,,,,,, elbv2,elbv2,elbv2,elasticloadbalancingv2,,elbv2,,elasticloadbalancingv2,ELBV2,ELBV2,,1,,aws_a?lb(\b|_listener|_target_group|s),aws_elbv2_,,lbs?\.;lb_listener;lb_target_group;lb_hosted,ELB (Elastic Load Balancing),,,,,,, elb,elb,elb,elasticloadbalancing,,elb,,elasticloadbalancing,ELB,ELB,,1,,aws_(app_cookie_stickiness_policy|elb|lb_cookie_stickiness_policy|lb_ssl_negotiation_policy|load_balancer_|proxy_protocol_policy),aws_elb_,,app_cookie_stickiness_policy;elb;lb_cookie_stickiness_policy;lb_ssl_negotiation_policy;load_balancer;proxy_protocol_policy,ELB Classic,,,,,,, -mediaconnect,mediaconnect,mediaconnect,mediaconnect,,mediaconnect,,,MediaConnect,MediaConnect,,1,,,aws_mediaconnect_,,media_connect_,Elemental MediaConnect,AWS,,,,,, +mediaconnect,mediaconnect,mediaconnect,mediaconnect,,mediaconnect,,,MediaConnect,MediaConnect,,,2,,aws_mediaconnect_,,mediaconnect_,Elemental MediaConnect,AWS,,,,,, mediaconvert,mediaconvert,mediaconvert,mediaconvert,,mediaconvert,,,MediaConvert,MediaConvert,,1,,aws_media_convert_,aws_mediaconvert_,,media_convert_,Elemental MediaConvert,AWS,,,,,, medialive,medialive,medialive,medialive,,medialive,,,MediaLive,MediaLive,,,2,,aws_medialive_,,medialive_,Elemental MediaLive,AWS,,,,,, mediapackage,mediapackage,mediapackage,mediapackage,,mediapackage,,,MediaPackage,MediaPackage,,,2,aws_media_package_,aws_mediapackage_,,media_package_,Elemental MediaPackage,AWS,,,,,, From b84f4f8003165808a2aa8ff8dfcbd03b84df1075 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Tue, 19 Sep 2023 09:58:34 -0400 Subject: [PATCH 06/17] ci: github-app-token v2 action updates --- .github/workflows/cdktf-documentation.yml | 3 ++- .github/workflows/issues.yml | 6 ++++-- .github/workflows/pull_request_target.yml | 6 ++++-- .github/workflows/resource-counts.yml | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cdktf-documentation.yml b/.github/workflows/cdktf-documentation.yml index 0e0545f4ee2..4b39cc3ce1b 100644 --- a/.github/workflows/cdktf-documentation.yml +++ b/.github/workflows/cdktf-documentation.yml @@ -19,7 +19,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{secrets.APP_PEM }} cdktfDocs: diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index dce641bc5ad..f679c00d482 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -32,7 +32,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Add needs-triage for non-maintainer' @@ -89,7 +90,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Maintainer Issues' diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 0884ad619ba..08d4cc36158 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -33,7 +33,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Add needs-triage for non-maintainers' @@ -125,7 +126,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Maintainer Pull Requests' diff --git a/.github/workflows/resource-counts.yml b/.github/workflows/resource-counts.yml index de1a7503b5e..4f9b2a1c779 100644 --- a/.github/workflows/resource-counts.yml +++ b/.github/workflows/resource-counts.yml @@ -15,7 +15,8 @@ jobs: uses: tibdex/github-app-token@0914d50df753bbc42180d982a6550f195390069f # v2.0.0 with: app_id: ${{ secrets.APP_ID }} - installation_id: ${{ secrets.INSTALLATION_ID }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{secrets.APP_PEM }} - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - run: | From a50005845b9fe9b8fe87644fbe148543b72fa390 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 19 Sep 2023 11:56:30 -0400 Subject: [PATCH 07/17] tweak generate file --- internal/service/mediaconnect/generate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mediaconnect/generate.go b/internal/service/mediaconnect/generate.go index d8e6b3c76f2..3d8ab34c85d 100644 --- a/internal/service/mediaconnect/generate.go +++ b/internal/service/mediaconnect/generate.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -KVTValues=true -SkipTypesImp=true -ListTags -ServiceTagsMap -UpdateTags +//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -KVTValues -SkipTypesImp -ListTags -ServiceTagsMap -UpdateTags //go:generate go run ../../generate/servicepackage/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. From a0fa45cef40abaaec9202e2511d014a6629df671 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Tue, 19 Sep 2023 17:27:09 +0000 Subject: [PATCH 08/17] Update CHANGELOG.md for #33395 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 420e1b48cfe..29ca37b0c40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## 5.18.0 (Unreleased) +FEATURES: + +* **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)) + ENHANCEMENTS: * resource/aws_fsx_ontap_storage_virtual_machine: Remove [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew) from `active_directory_configuration.self_managed_active_directory_configuration.domain_name`, `active_directory_configuration.self_managed_active_directory_configuration.file_system_administrators_group` and `active_directory_configuration.self_managed_active_directory_configuration.organizational_unit_distinguished_name` allowing an SVM to join AD after creation ([#33466](https://github.com/hashicorp/terraform-provider-aws/issues/33466)) From f1ab03fab6783ec1ce3b1857aff1141e566a58d4 Mon Sep 17 00:00:00 2001 From: George Wu Date: Tue, 19 Sep 2023 10:34:34 -0700 Subject: [PATCH 09/17] Update link to Contributing Guide section on new services. (#33517) --- .github/workflows/dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index a65281eeb45..cd0fb92168a 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -63,7 +63,7 @@ jobs: * Check [open pull requests with the `dependencies` label](https://github.com/hashicorp/terraform-provider-aws/pulls?q=is%3Aopen+is%3Apr+label%3Adependencies) to view other dependency updates. * If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed. * If this pull request is for supporting a new AWS service: - * Ensure the new AWS service changes are following the [Contributing Guide section on new services](https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/contribution-checklists.md#new-service), in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split. + * Ensure the new AWS service changes are following the [Contributing Guide section on new services](https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/add-a-new-service.md), in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split. * If this pull request is already a separate pull request from the above item, you can ignore this message. go_mod: From 970fcd7ff56de67c8407566cf311213a2e53dd51 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 19 Sep 2023 13:48:03 -0400 Subject: [PATCH 10/17] d/aws_fsx_ontap_file_system: Tweak acceptance test. --- .../fsx/ontap_file_system_data_source_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/fsx/ontap_file_system_data_source_test.go b/internal/service/fsx/ontap_file_system_data_source_test.go index d6f3c11a4ac..cfbd3452d71 100644 --- a/internal/service/fsx/ontap_file_system_data_source_test.go +++ b/internal/service/fsx/ontap_file_system_data_source_test.go @@ -26,24 +26,24 @@ func TestAccFSxONTAPFileSystemDataSource_Id(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccONTAPFileSystemDataSourceConfig_id(rName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(datasourceName, "automatic_backup_retention_days", resourceName, "automatic_backup_retention_days"), resource.TestCheckResourceAttrPair(datasourceName, "daily_automatic_backup_start_time", resourceName, "daily_automatic_backup_start_time"), resource.TestCheckResourceAttrPair(datasourceName, "deployment_type", resourceName, "deployment_type"), - resource.TestCheckResourceAttrPair(datasourceName, "disk_iops_configuration", resourceName, "disk_iops_configuration"), + resource.TestCheckResourceAttrPair(datasourceName, "disk_iops_configuration.#", resourceName, "disk_iops_configuration.#"), resource.TestCheckResourceAttrPair(datasourceName, "dns_name", resourceName, "dns_name"), resource.TestCheckResourceAttrPair(datasourceName, "endpoint_ip_address_range", resourceName, "endpoint_ip_address_range"), - resource.TestCheckResourceAttrPair(datasourceName, "endpoints", resourceName, "endpoints"), - resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "endpoints.#", resourceName, "endpoints.#"), resource.TestCheckResourceAttrPair(datasourceName, "kms_key_id", resourceName, "kms_key_id"), - resource.TestCheckResourceAttrPair(datasourceName, "network_interface_ids", resourceName, "network_interface_ids"), + resource.TestCheckResourceAttrPair(datasourceName, "network_interface_ids.#", resourceName, "network_interface_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "owner_id", resourceName, "owner_id"), resource.TestCheckResourceAttrPair(datasourceName, "preferred_subnet_id", resourceName, "preferred_subnet_id"), - resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids", resourceName, "route_table_ids"), + resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_capacity", resourceName, "storage_capacity"), resource.TestCheckResourceAttrPair(datasourceName, "storage_type", resourceName, "storage_type"), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), + resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(datasourceName, "throughput_capacity", resourceName, "throughput_capacity"), resource.TestCheckResourceAttrPair(datasourceName, "vpc_id", resourceName, "vpc_id"), resource.TestCheckResourceAttrPair(datasourceName, "weekly_maintenance_start_time", resourceName, "weekly_maintenance_start_time"), From 967a4949b513c89b89e5d82054e2511e1627a5d4 Mon Sep 17 00:00:00 2001 From: "terraform-aws-provider[bot]" <139392249+terraform-aws-provider[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 13:56:49 -0400 Subject: [PATCH 11/17] docs: update resource counts (#33534) Co-authored-by: jar-b --- website/docs/index.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 79c5db03cc0..e31b41feb7e 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -11,7 +11,7 @@ Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS. You must configure the provider with the proper credentials before you can use it. -Use the navigation to the left to read about the available resources. There are currently 1251 resources and 514 data sources available in the provider. +Use the navigation to the left to read about the available resources. There are currently 1253 resources and 514 data sources available in the provider. To learn the basics of Terraform using this provider, follow the hands-on [get started tutorials](https://learn.hashicorp.com/tutorials/terraform/infrastructure-as-code?in=terraform/aws-get-started&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS). Interact with AWS services, From b4715be78dc324ac60de02e050931e2d35d3db24 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Tue, 19 Sep 2023 20:03:22 +0200 Subject: [PATCH 12/17] docs(docs/ami.html.markdown): remove duplicate attribute (#33528) --- website/docs/r/ami.html.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/website/docs/r/ami.html.markdown b/website/docs/r/ami.html.markdown index 8884f14d7ae..c7451e50a94 100644 --- a/website/docs/r/ami.html.markdown +++ b/website/docs/r/ami.html.markdown @@ -111,7 +111,6 @@ This resource exports the following attributes in addition to the arguments abov * `image_owner_alias` - AWS account alias (for example, amazon, self) or the AWS account ID of the AMI owner. * `image_type` - Type of image. * `hypervisor` - Hypervisor type of the image. -* `owner_id` - AWS account ID of the image owner. * `platform` - This value is set to windows for Windows AMIs; otherwise, it is blank. * `public` - Whether the image has public launch permissions. * `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). From d99f19016d58a005468a326918ea83bc13ae1d4a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 19 Sep 2023 14:50:22 -0400 Subject: [PATCH 13/17] Add copyright headers. --- internal/service/fsx/ontap_file_system_data_source.go | 3 +++ internal/service/fsx/ontap_file_system_data_source_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go index ea68b044992..bef59df0332 100644 --- a/internal/service/fsx/ontap_file_system_data_source.go +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package fsx import ( diff --git a/internal/service/fsx/ontap_file_system_data_source_test.go b/internal/service/fsx/ontap_file_system_data_source_test.go index cfbd3452d71..950a6fba09b 100644 --- a/internal/service/fsx/ontap_file_system_data_source_test.go +++ b/internal/service/fsx/ontap_file_system_data_source_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package fsx_test import ( From 976f90cba0fd8a8634700064e3d250b34d229725 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 19 Sep 2023 14:51:38 -0400 Subject: [PATCH 14/17] Fix typo. --- website/docs/d/fsx_ontap_file_system.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/fsx_ontap_file_system.html.markdown b/website/docs/d/fsx_ontap_file_system.html.markdown index 8af7948c34b..065ed1932ca 100644 --- a/website/docs/d/fsx_ontap_file_system.html.markdown +++ b/website/docs/d/fsx_ontap_file_system.html.markdown @@ -16,7 +16,7 @@ Retrieve information on FSx ONTAP File System. ```terraform data "aws_fsx_ontap_file_system" "example" { - id = "fs-12345678 + id = "fs-12345678" } ``` From b2eb12e3078fd97e27ec2dda123d806ff02ed5d0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Tue, 19 Sep 2023 15:52:32 -0400 Subject: [PATCH 15/17] teamcity/performance: Fix script --- .teamcity/scripts/performance.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.teamcity/scripts/performance.sh b/.teamcity/scripts/performance.sh index 940773648ac..87eec9a86bd 100644 --- a/.teamcity/scripts/performance.sh +++ b/.teamcity/scripts/performance.sh @@ -57,12 +57,13 @@ function analysis { if ! command -v pprof &> /dev/null ; then go install github.com/google/pprof@latest goenv rehash - rehash fi if ! command -v pprof &> /dev/null ; then go install github.com/google/pprof@latest goenv rehash - rehash + if command -v rehash &> /dev/null ; then + rehash + fi fi if ! command -v pprof &> /dev/null ; then echo "pprof not found after 3 attempts to install" From 1f0c1ed3afc62f6993a9033767d2d4b99653d6f6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Tue, 19 Sep 2023 15:55:46 -0400 Subject: [PATCH 16/17] make: Bump up timeouts for sweeping, testing --- GNUmakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 786c0a940d4..fa23ff80115 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -4,11 +4,11 @@ SWEEP_DIR ?= ./internal/sweep PKG_NAME ?= internal SVC_DIR ?= ./internal/service TEST_COUNT ?= 1 -ACCTEST_TIMEOUT ?= 180m +ACCTEST_TIMEOUT ?= 360m ACCTEST_PARALLELISM ?= 20 P ?= 20 GO_VER ?= go -SWEEP_TIMEOUT ?= 60m +SWEEP_TIMEOUT ?= 360m ifneq ($(origin PKG), undefined) PKG_NAME = internal/service/$(PKG) From 3068b357cdac4e9a08ddad3673c9d5c8818d8f9b Mon Sep 17 00:00:00 2001 From: changelogbot Date: Tue, 19 Sep 2023 20:17:01 +0000 Subject: [PATCH 17/17] Update CHANGELOG.md for #33538 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29ca37b0c40..65a1e323556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ FEATURES: +* **New Data Source:** `aws_fsx_ontap_file_system` ([#32503](https://github.com/hashicorp/terraform-provider-aws/issues/32503)) * **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))