Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hashicorp/terraform-provider-aws in…
Browse files Browse the repository at this point in the history
…to 34024
  • Loading branch information
danquack committed Feb 21, 2024
2 parents 600b93a + 5af43cb commit 637aa05
Show file tree
Hide file tree
Showing 1,822 changed files with 12,378 additions and 11,165 deletions.
15 changes: 15 additions & 0 deletions .changelog/34364.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:enhancement
resource/aws_lb_target_group: Add `load_balancer_arns` attribute
```

```release-note:enhancement
data-source/aws_lb_target_group: Add `load_balancer_arns` attribute
```

```release-note:enhancement
resource/aws_alb_target_group: Add `load_balancer_arns` attribute
```

```release-note:enhancement
data-source/aws_alb_target_group: Add `load_balancer_arns` attribute
```
3 changes: 3 additions & 0 deletions .changelog/35879.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_transfer_server: Add `TransferSecurityPolicy-2024-01` and `TransferSecurityPolicy-FIPS-2024-01` as valid values for `security_policy_name`
```
3 changes: 3 additions & 0 deletions .changelog/35900.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_cloudsearch_domain: Prevent panic when reading nil `index_field` options response values
```
2 changes: 1 addition & 1 deletion .ci/providerlint/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint
go 1.21

require (
github.com/aws/aws-sdk-go v1.50.21
github.com/aws/aws-sdk-go v1.50.22
github.com/bflad/tfproviderlint v0.29.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.32.0
golang.org/x/tools v0.13.0
Expand Down
4 changes: 2 additions & 2 deletions .ci/providerlint/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/aws/aws-sdk-go v1.50.21 h1:W8awpwiInOt4qHQE6JghRYQJhHcf/cDJS3mlZYqioSQ=
github.com/aws/aws-sdk-go v1.50.21/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.50.22 h1:BUhSaO2qLk2jkcyLebcvDmbdOunVe/Wq8RsCyI8szL0=
github.com/aws/aws-sdk-go v1.50.22/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU=
github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA=
github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow=
Expand Down
2 changes: 1 addition & 1 deletion .ci/providerlint/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ github.com/agext/levenshtein
# github.com/apparentlymart/go-textseg/v15 v15.0.0
## explicit; go 1.16
github.com/apparentlymart/go-textseg/v15/textseg
# github.com/aws/aws-sdk-go v1.50.21
# github.com/aws/aws-sdk-go v1.50.22
## explicit; go 1.19
github.com/aws/aws-sdk-go/aws/awserr
github.com/aws/aws-sdk-go/aws/endpoints
Expand Down
41 changes: 41 additions & 0 deletions .ci/semgrep/migrate/aws_service_id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
rules:
- id: error-check-service-id
languages: [go]
message: Use the corresponding `names.<service>ServiceID` instead of the endpoint ID
patterns:
- pattern-either:
- pattern: |
acctest.ErrorCheck($T, $SVCV1.EndpointsID)
- patterns:
- pattern: |
acctest.ErrorCheck($T, names.$ENDPOINTID)
- metavariable-regex:
metavariable: $ENDPOINTID
regex: ^\w+EndpointID$
severity: ERROR

- id: register-error-check-service-id
languages: [go]
message: Use the corresponding `names.<service>ServiceID` instead of the endpoint ID
patterns:
- pattern-either:
- pattern: |
acctest.RegisterServiceErrorCheckFunc($SVCV1.EndpointsID, ...)
- patterns:
- pattern: |
acctest.RegisterServiceErrorCheckFunc(names.$ENDPOINTID, ...)
- metavariable-regex:
metavariable: $ENDPOINTID
regex: ^\w+EndpointID$
severity: ERROR

- id: partition-has-service-endpoint-id
languages: [go]
message: Use the corresponding `names.<service>EndpointID` instead of the service ID
patterns:
- pattern: |
acctest.PreCheckPartitionHasService($T, names.$SERVICEID)
- metavariable-regex:
metavariable: $SERVICEID
regex: ^\w+ServiceID$
severity: ERROR
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ ENHANCEMENTS:
* resource/aws_db_instance: Add plan-time validation of `performance_insights_retention_period` ([#35870](https://github.com/hashicorp/terraform-provider-aws/issues/35870))
* resource/aws_elasticache_subnet_group: Add `vpc_id` attribute ([#35887](https://github.com/hashicorp/terraform-provider-aws/issues/35887))
* resource/aws_redshiftserverless_workgroup: Add `max_capacity` argument ([#35720](https://github.com/hashicorp/terraform-provider-aws/issues/35720))
* resource/aws_transfer_server: Add `TransferSecurityPolicy-2024-01` and `TransferSecurityPolicy-FIPS-2024-01` as valid values for `security_policy_name` ([#35879](https://github.com/hashicorp/terraform-provider-aws/issues/35879))

BUG FIXES:

* data-source/aws_caller_identity: Fix authentication signature error when alternate `sts_region` is specified ([#35860](https://github.com/hashicorp/terraform-provider-aws/issues/35860))
* data-source/aws_eks_access_entry: Fix `cluster_name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
* data-source/aws_eks_addon: Fix `cluster_name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
* data-source/aws_eks_cluster: Fix `name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
* resource/aws_cloudsearch_domain: Prevent panic when reading nil `index_field` options response values ([#35900](https://github.com/hashicorp/terraform-provider-aws/issues/35900))
* resource/aws_eks_access_entry: Fix `cluster_name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
* resource/aws_eks_access_policy_association: Fix `cluster_name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
* resource/aws_eks_addon: Fix `cluster_name` plan-time validation, allowing single-character names ([#35874](https://github.com/hashicorp/terraform-provider-aws/issues/35874))
Expand Down
8 changes: 4 additions & 4 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestAccVPCFlowLog_destinationError(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckFlowLogDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestAccVPCFlowLog_destinationError(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckFlowLogDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestAccVPCFlowLog_destinationError(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckFlowLogDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -233,7 +233,7 @@ func TestAccVPCFlowLog_destinationError(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckFlowLogDestroy(ctx),
Steps: []resource.TestStep{
Expand Down
2 changes: 1 addition & 1 deletion docs/migrate-from-sdk-to-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestAccExampleResource_MigrateFromPluginSDK(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
CheckDestroy: testAccCheckExampleResourceDestroy(ctx),
Steps: []resource.TestStep{
{
Expand Down
4 changes: 2 additions & 2 deletions docs/resource-name-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestAccServiceThing_nameGenerated(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ServiceServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestAccServiceThing_namePrefix(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ServiceServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down
2 changes: 1 addition & 1 deletion docs/resource-tagging.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func TestAccEKSCluster_tags(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(t) },
ErrorCheck: acctest.ErrorCheck(t, eks.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.EKSServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckClusterDestroy(ctx),
Steps: []resource.TestStep{
Expand Down
24 changes: 12 additions & 12 deletions docs/running-and-writing-acceptance-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestAccCloudWatchDashboard_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, cloudwatch.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.CloudWatchServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckDashboardDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -533,7 +533,7 @@ func TestAccExampleThing_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckExampleThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -666,7 +666,7 @@ func TestAccExampleThing_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
// PreCheck
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
// ... additional checks follow ...
})
}
Expand All @@ -678,7 +678,7 @@ However, some services have special conditions that aren't caught by the common

To add a service-specific ErrorCheck, follow these steps:

1. Make sure there is not already an ErrorCheck for the service you have in mind. For example, search the codebase for `acctest.RegisterServiceErrorCheckFunc(service.EndpointsID` replacing "service" with the package name of the service you're working on (e.g., `ec2`). If there is already an ErrorCheck for the service, add to the existing service-specific ErrorCheck.
1. Make sure there is not already an ErrorCheck for the service you have in mind. For example, search the codebase for `acctest.RegisterServiceErrorCheckFunc(names.ExampleServiceID` replacing "service" with the package name of the service you're working on (e.g., `ec2`). If there is already an ErrorCheck for the service, add to the existing service-specific ErrorCheck.
2. Create the service-specific ErrorCheck in an `_test.go` file for the service. See the example below.
3. Register the new service-specific ErrorCheck in the `init()` at the top of the `_test.go` file. See the example below.
Expand All @@ -687,7 +687,7 @@ An example of adding a service-specific ErrorCheck:
```go
// just after the imports, create or add to the init() function
func init() {
acctest.RegisterServiceErrorCheck(service.EndpointsID, testAccErrorCheckSkipService)
acctest.RegisterServiceErrorCheck(names.ExampleServiceID, testAccErrorCheckSkipService)
}
// ... additional code and tests ...
Expand Down Expand Up @@ -740,7 +740,7 @@ func TestAccExampleThing_disappears(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckExampleThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -784,7 +784,7 @@ func TestAccExampleChildThing_disappears_ParentThing(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckExampleChildThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -815,7 +815,7 @@ func TestAccExampleThing_Description(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckExampleThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -875,7 +875,7 @@ func TestAccExample_basic(t *testing.T) {
acctest.PreCheck(ctx, t)
acctest.PreCheckOrganizationsAccount(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5FactoriesAlternate(ctx, t),
CheckDestroy: testAccCheckExampleDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -939,7 +939,7 @@ func TestAccExample_basic(t *testing.T) {
acctest.PreCheck(ctx, t)
acctest.PreCheckMultipleRegion(t, 2)
},
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5FactoriesMultipleRegions(ctx, t, 2),
CheckDestroy: testAccCheckExampleDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -1038,7 +1038,7 @@ func TestAccExampleThingDataSource_Name(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),
ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckExampleThingDestroy(ctx),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -1279,7 +1279,7 @@ The below are required items that will be noted during submission review and pre
- __Implements Exists Check Function__: Resource testing should include a `TestCheckFunc` function (typically named `testAccCheck{SERVICE}{RESOURCE}Exists`) that calls the API to verify that the Terraform resource has been created or associated as appropriate. Preferably, this function will also accept a pointer to an API object representing the Terraform resource from the API response that can be set for potential usage in later `TestCheckFunc`. More information about these functions can be found in the [SDKv2 Custom Check Functions documentation](https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests/teststep#custom-check-functions).
- __Excludes Provider Declarations__: Test configurations should not include `provider "aws" {...}` declarations. If necessary, only the provider declarations in `acctest.go` should be used for multiple account/region or otherwise specialized testing.
- __Passes in us-west-2 Region__: Tests default to running in `us-west-2` and at a minimum should pass in that region or include necessary `PreCheck` functions to skip the test when ran outside an expected environment.
- __Includes ErrorCheck__: All acceptance tests should include a call to the common ErrorCheck (`ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID),`).
- __Includes ErrorCheck__: All acceptance tests should include a call to the common ErrorCheck (`ErrorCheck: acctest.ErrorCheck(t, names.ExampleServiceID),`).
- __Uses resource.ParallelTest__: Tests should use [`resource.ParallelTest()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#ParallelTest) instead of [`resource.Test()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#Test) except where serialized testing is absolutely required.
- [ ] __Uses fmt.Sprintf()__: Test configurations preferably should to be separated into their own functions (typically named `testAcc{SERVICE}{RESOURCE}Config{PURPOSE}`) that call [`fmt.Sprintf()`](https://golang.org/pkg/fmt/#Sprintf) for variable injection or a string `const` for completely static configurations. Test configurations should avoid `var` or other variable injection functionality such as [`text/template`](https://golang.org/pkg/text/template/).
- __Uses Randomized Infrastructure Naming__: Test configurations that use resources where a unique name is required should generate a random name. Typically this is created via `rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)` in the acceptance test function before generating the configuration.
Expand Down
Loading

0 comments on commit 637aa05

Please sign in to comment.