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 +``` 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/.github/workflows/cdktf-documentation.yml b/.github/workflows/cdktf-documentation.yml index 46f2c480f2c..4b39cc3ce1b 100644 --- a/.github/workflows/cdktf-documentation.yml +++ b/.github/workflows/cdktf-documentation.yml @@ -16,10 +16,11 @@ 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 }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{secrets.APP_PEM }} cdktfDocs: 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: diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 15e35ae298b..f679c00d482 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -29,10 +29,11 @@ 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 }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Add needs-triage for non-maintainer' @@ -86,10 +87,11 @@ 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 }} + 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 f459ef5c844..08d4cc36158 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -30,10 +30,11 @@ 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 }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{ secrets.APP_PEM }} - name: 'Add needs-triage for non-maintainers' @@ -122,10 +123,11 @@ 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 }} + 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 c1cb994ad33..4f9b2a1c779 100644 --- a/.github/workflows/resource-counts.yml +++ b/.github/workflows/resource-counts.yml @@ -12,10 +12,11 @@ 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 }} + installation_retrieval_mode: id + installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{secrets.APP_PEM }} - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - run: | 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" diff --git a/CHANGELOG.md b/CHANGELOG.md index 420e1b48cfe..65a1e323556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## 5.18.0 (Unreleased) +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)) + 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)) 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) diff --git a/go.mod b/go.mod index 5750f55efc6..f881de14aeb 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.3.0 diff --git a/go.sum b/go.sum index ffc0fc1cb6c..5aa726eda53 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/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go new file mode 100644 index 00000000000..bef59df0332 --- /dev/null +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -0,0 +1,214 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +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.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}, + }, + }, + }, + }, + }, + }, + }, + "id": { + Type: schema.TypeString, + Required: true, + }, + "kms_key_id": { + Type: schema.TypeString, + Computed: true, + }, + "network_interface_ids": { + Type: schema.TypeList, + 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.TypeSet, + 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.TypeList, + 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 := FindONTAPFileSystemByID(ctx, conn, id) + + if err != nil { + return sdkdiag.AppendErrorf(diags, "reading FSx for NetApp ONTAP File System (%s): %s", id, err) + } + + 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("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..950a6fba09b --- /dev/null +++ b/internal/service/fsx/ontap_file_system_data_source_test.go @@ -0,0 +1,65 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +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, + Steps: []resource.TestStep{ + { + Config: testAccONTAPFileSystemDataSourceConfig_id(rName), + 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, "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, "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, "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"), + ), + }, + }, + }) +} + +func testAccONTAPFileSystemDataSourceConfig_id(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 39d013f49d7..c4e04838800 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/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..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 -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. 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,,,,,, 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..065ed1932ca --- /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. 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, 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).