Skip to content

Commit

Permalink
Merge branch 'main' into td-migrate-internetmonitor-to-aws-sdk-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jul 3, 2023
2 parents 613fee7 + 7636407 commit e099c73
Show file tree
Hide file tree
Showing 80 changed files with 4,237 additions and 3,442 deletions.
3 changes: 3 additions & 0 deletions .changelog/31915.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_secretsmanager_secret_rotation: Fix `InvalidParameterException: You cannot specify both rotation frequency and schedule expression together` errors on resource Update
```
3 changes: 3 additions & 0 deletions .changelog/32226.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-data-source
aws_opensearchserverless_security_policy
```
3 changes: 3 additions & 0 deletions .changelog/32283.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_glue_catalog_database: Add `target_database.region` argument
```
3 changes: 3 additions & 0 deletions .changelog/32321.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-data-source
aws_opensearchserverless_security_config
```
3 changes: 3 additions & 0 deletions .changelog/32339.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_aws_keyspaces_table: Add `client_side_timestamps` configuration block
```
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.20

require (
github.com/aws/aws-sdk-go v1.44.292
github.com/aws/aws-sdk-go v1.44.294
github.com/bflad/tfproviderlint v0.29.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0
golang.org/x/tools v0.8.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 @@ -7,8 +7,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/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/aws/aws-sdk-go v1.44.292 h1:sPDmWCIv69lunIh18zDkCBNXCbHoqTx9O4uYNHNrSKo=
github.com/aws/aws-sdk-go v1.44.292/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.294 h1:3x7GaEth+pDU9HwFcAU0awZlEix5CEdyIZvV08SlHa8=
github.com/aws/aws-sdk-go v1.44.294/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU=
github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA=
github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow=
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/v13 v13.0.0
## explicit; go 1.16
github.com/apparentlymart/go-textseg/v13/textseg
# github.com/aws/aws-sdk-go v1.44.292
# github.com/aws/aws-sdk-go v1.44.294
## explicit; go 1.11
github.com/aws/aws-sdk-go/aws/awserr
github.com/aws/aws-sdk-go/aws/endpoints
Expand Down
2 changes: 1 addition & 1 deletion .ci/tools/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/tools
go 1.20

require (
github.com/YakDriver/tfproviderdocs v0.3.0
github.com/YakDriver/tfproviderdocs v0.4.0
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.53.3
github.com/hashicorp/go-changelog v0.0.0-20201005170154-56335215ce3a
Expand Down
4 changes: 2 additions & 2 deletions .ci/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/
github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/YakDriver/tfproviderdocs v0.3.0 h1:qH6IK3OE8KQMmwy83w9Muys5rmdxjMuE6bxs3Eqv1Tc=
github.com/YakDriver/tfproviderdocs v0.3.0/go.mod h1:exzn3DQfLxdiJwVM344Ob7OgL1wJFYa0prAbdaqPA+8=
github.com/YakDriver/tfproviderdocs v0.4.0 h1:43cZSzzZvOy17nNBj1yNJqyXJ32pN+6gLjYGt38jdyo=
github.com/YakDriver/tfproviderdocs v0.4.0/go.mod h1:exzn3DQfLxdiJwVM344Ob7OgL1wJFYa0prAbdaqPA+8=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
## 5.6.2 (Unreleased)
## 5.7.0 (Unreleased)

FEATURES:

* **New Data Source:** `aws_opensearchserverless_security_config` ([#32321](https://github.com/hashicorp/terraform-provider-aws/issues/32321))
* **New Data Source:** `aws_opensearchserverless_security_policy` ([#32226](https://github.com/hashicorp/terraform-provider-aws/issues/32226))

ENHANCEMENTS:

* resource/aws_aws_keyspaces_table: Add `client_side_timestamps` configuration block ([#32339](https://github.com/hashicorp/terraform-provider-aws/issues/32339))
* resource/aws_glue_catalog_database: Add `target_database.region` argument ([#32283](https://github.com/hashicorp/terraform-provider-aws/issues/32283))

BUG FIXES:

* resource/aws_secretsmanager_secret_rotation: Fix `InvalidParameterException: You cannot specify both rotation frequency and schedule expression together` errors on resource Update ([#31915](https://github.com/hashicorp/terraform-provider-aws/issues/31915))

## 5.6.2 (June 30, 2023)

BUG FIXES:

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.294
github.com/aws/aws-sdk-go-v2 v1.18.1
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.4
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.19.14
Expand All @@ -29,6 +29,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.3.0
github.com/aws/aws-sdk-go-v2/service/ivschat v1.4.7
github.com/aws/aws-sdk-go-v2/service/kendra v1.41.0
github.com/aws/aws-sdk-go-v2/service/keyspaces v1.3.2
github.com/aws/aws-sdk-go-v2/service/lambda v1.37.0
github.com/aws/aws-sdk-go-v2/service/lightsail v1.27.1
github.com/aws/aws-sdk-go-v2/service/medialive v1.31.6
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.44.293 h1:oBPrQqsyMYe61Sl/xKVvQFflXjPwYH11aKi8QR3Nhts=
github.com/aws/aws-sdk-go v1.44.293/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.294 h1:3x7GaEth+pDU9HwFcAU0awZlEix5CEdyIZvV08SlHa8=
github.com/aws/aws-sdk-go v1.44.294/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2 v1.18.1 h1:+tefE750oAb7ZQGzla6bLkOwfcQCEtC5y2RqoqCeqKo=
github.com/aws/aws-sdk-go-v2 v1.18.1/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
Expand Down Expand Up @@ -88,6 +88,8 @@ github.com/aws/aws-sdk-go-v2/service/ivschat v1.4.7 h1:pI950CQHVEFW2/+UklRO4TWzH
github.com/aws/aws-sdk-go-v2/service/ivschat v1.4.7/go.mod h1:oOLFrfP14cyQdTsc3I8VohdYb8g86I7xduoMALyKLj0=
github.com/aws/aws-sdk-go-v2/service/kendra v1.41.0 h1:QZIaiIYfU8KCUuT4nCif9fifXryv+/pI/ounZMB4/0s=
github.com/aws/aws-sdk-go-v2/service/kendra v1.41.0/go.mod h1:huU0BQC+O9qcc3vrANhwkC9KP0hGg1quffiyfbJ1Ktg=
github.com/aws/aws-sdk-go-v2/service/keyspaces v1.3.2 h1:nL5UBozBBCgCV5nv03YvDnuuCH11iI4pNjH/EchcBEU=
github.com/aws/aws-sdk-go-v2/service/keyspaces v1.3.2/go.mod h1:kce6B9bwqIlk810LDwZC4bT928MQc9c88OtXkqGIymc=
github.com/aws/aws-sdk-go-v2/service/lambda v1.37.0 h1:xzyM5ZR9kZW0/Bkw5EiihOy6B+BYclp5K+yb6OHjc7s=
github.com/aws/aws-sdk-go-v2/service/lambda v1.37.0/go.mod h1:Q8zQi5nZpjUF/H55dKEpKfEvFWJkgZzjjqvDb2AR5b4=
github.com/aws/aws-sdk-go-v2/service/lightsail v1.27.1 h1:q9YZIsBPkeafzYPAJUquHZW5WkdmsLLu4jWlWzNEyjI=
Expand Down
6 changes: 3 additions & 3 deletions internal/conns/awsclient_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ func New(ctx context.Context) (*schema.Provider, error) {
interceptors := interceptorItems{}

if v.Tags != nil {
schema := r.SchemaMap()

// The resource has opted in to transparent tagging.
// Ensure that the schema look OK.
if v, ok := r.Schema[names.AttrTags]; ok {
if v, ok := schema[names.AttrTags]; ok {
if v.Computed {
errs = multierror.Append(errs, fmt.Errorf("`%s` attribute cannot be Computed: %s", names.AttrTags, typeName))
continue
Expand All @@ -334,7 +336,7 @@ func New(ctx context.Context) (*schema.Provider, error) {
errs = multierror.Append(errs, fmt.Errorf("no `%s` attribute defined in schema: %s", names.AttrTags, typeName))
continue
}
if v, ok := r.Schema[names.AttrTagsAll]; ok {
if v, ok := schema[names.AttrTagsAll]; ok {
if !v.Computed {
errs = multierror.Append(errs, fmt.Errorf("`%s` attribute must be Computed: %s", names.AttrTags, typeName))
continue
Expand Down
2 changes: 1 addition & 1 deletion internal/service/autoscaling/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -3882,7 +3882,7 @@ func validateGroupInstanceRefreshTriggerFields(i interface{}, path cty.Path) dia
}
}

schema := ResourceGroup().Schema
schema := ResourceGroup().SchemaMap()
for attr, attrSchema := range schema {
if v == attr {
if attrSchema.Computed && !attrSchema.Optional {
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ec2/ec2_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5426,7 +5426,7 @@ func testAccCheckDetachVolumes(ctx context.Context, instance *ec2.Instance) reso
func TestInstanceHostIDSchema(t *testing.T) {
t.Parallel()

actualSchema := tfec2.ResourceInstance().Schema["host_id"]
actualSchema := tfec2.ResourceInstance().SchemaMap()["host_id"]
expectedSchema := &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand All @@ -5444,7 +5444,7 @@ func TestInstanceHostIDSchema(t *testing.T) {
func TestInstanceCPUCoreCountSchema(t *testing.T) {
t.Parallel()

actualSchema := tfec2.ResourceInstance().Schema["cpu_core_count"]
actualSchema := tfec2.ResourceInstance().SchemaMap()["cpu_core_count"]
expectedSchema := &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Expand All @@ -5464,7 +5464,7 @@ func TestInstanceCPUCoreCountSchema(t *testing.T) {
func TestInstanceCPUThreadsPerCoreSchema(t *testing.T) {
t.Parallel()

actualSchema := tfec2.ResourceInstance().Schema["cpu_threads_per_core"]
actualSchema := tfec2.ResourceInstance().SchemaMap()["cpu_threads_per_core"]
expectedSchema := &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Expand Down
7 changes: 4 additions & 3 deletions internal/service/ec2/ec2_spot_instance_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ func ResourceSpotInstanceRequest() *schema.Resource {

Schema: func() map[string]*schema.Schema {
// The Spot Instance Request Schema is based on the AWS Instance schema.
s := ResourceInstance().Schema
s := ResourceInstance().SchemaMap()

// Everything on a spot instance is ForceNew (except tags).
// Everything on a spot instance is ForceNew (except tags/tags_all).
for k, v := range s {
if v.Computed && !v.Optional {
continue
}
if k == names.AttrTags {
// tags_all is Optional+Computed.
if k == names.AttrTags || k == names.AttrTagsAll {
continue
}
v.ForceNew = true
Expand Down
28 changes: 20 additions & 8 deletions internal/service/ec2/ec2_spot_instance_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestAccEC2SpotInstanceRequest_disappears(t *testing.T) {

func TestAccEC2SpotInstanceRequest_tags(t *testing.T) {
ctx := acctest.Context(t)
var sir ec2.SpotInstanceRequest
var sir1, sir2, sir3 ec2.SpotInstanceRequest
resourceName := "aws_spot_instance_request.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

Expand All @@ -89,7 +89,7 @@ func TestAccEC2SpotInstanceRequest_tags(t *testing.T) {
{
Config: testAccSpotInstanceRequestConfig_tags1(rName, "key1", "value1"),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir),
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir1),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"),
),
Expand All @@ -103,7 +103,8 @@ func TestAccEC2SpotInstanceRequest_tags(t *testing.T) {
{
Config: testAccSpotInstanceRequestConfig_tags2(rName, "key1", "value1updated", "key2", "value2"),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir),
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir2),
testAccCheckSpotInstanceRequestIDsEqual(&sir2, &sir1),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"),
resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"),
Expand All @@ -112,7 +113,8 @@ func TestAccEC2SpotInstanceRequest_tags(t *testing.T) {
{
Config: testAccSpotInstanceRequestConfig_tags1(rName, "key2", "value2"),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir),
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir3),
testAccCheckSpotInstanceRequestIDsEqual(&sir3, &sir2),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"),
),
Expand Down Expand Up @@ -496,7 +498,7 @@ func TestAccEC2SpotInstanceRequest_interruptUpdate(t *testing.T) {
Config: testAccSpotInstanceRequestConfig_interrupt(rName, "terminate"),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckSpotInstanceRequestExists(ctx, resourceName, &sir2),
testAccCheckSpotInstanceRequestRecreated(&sir1, &sir2),
testAccCheckSpotInstanceRequestIDsNotEqual(&sir1, &sir2),
resource.TestCheckResourceAttr(resourceName, "instance_interruption_behavior", "terminate"),
),
},
Expand Down Expand Up @@ -693,10 +695,20 @@ func testAccCheckSpotInstanceRequestAttributesVPC(
}
}

func testAccCheckSpotInstanceRequestRecreated(before, after *ec2.SpotInstanceRequest) resource.TestCheckFunc {
func testAccCheckSpotInstanceRequestIDsEqual(sir1, sir2 *ec2.SpotInstanceRequest) resource.TestCheckFunc {
return func(s *terraform.State) error {
if aws.StringValue(sir1.SpotInstanceRequestId) != aws.StringValue(sir2.SpotInstanceRequestId) {
return fmt.Errorf("Spot Instance Request IDs are not equal")
}

return nil
}
}

func testAccCheckSpotInstanceRequestIDsNotEqual(sir1, sir2 *ec2.SpotInstanceRequest) resource.TestCheckFunc {
return func(s *terraform.State) error {
if before, after := aws.StringValue(before.InstanceId), aws.StringValue(after.InstanceId); before == after {
return fmt.Errorf("Spot Instance (%s) not recreated", before)
if aws.StringValue(sir1.SpotInstanceRequestId) == aws.StringValue(sir2.SpotInstanceRequestId) {
return fmt.Errorf("Spot Instance Request IDs are equal")
}

return nil
Expand Down
12 changes: 12 additions & 0 deletions internal/service/glue/catalog_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func ResourceCatalogDatabase() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"region": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -314,6 +318,10 @@ func expandDatabaseTargetDatabase(tfMap map[string]interface{}) *glue.DatabaseId
apiObject.DatabaseName = aws.String(v)
}

if v, ok := tfMap["region"].(string); ok && v != "" {
apiObject.Region = aws.String(v)
}

return apiObject
}

Expand All @@ -332,6 +340,10 @@ func flattenDatabaseTargetDatabase(apiObject *glue.DatabaseIdentifier) map[strin
tfMap["database_name"] = aws.StringValue(v)
}

if v := apiObject.Region; v != nil {
tfMap["region"] = aws.StringValue(v)
}

return tfMap
}

Expand Down
Loading

0 comments on commit e099c73

Please sign in to comment.