Skip to content

Commit

Permalink
Merge branch 'main' into glue-awssdkv2-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonaj committed Jul 22, 2024
2 parents 0f3ab1c + 73f9aa6 commit 6c83b7c
Show file tree
Hide file tree
Showing 18 changed files with 272 additions and 184 deletions.
7 changes: 7 additions & 0 deletions .changelog/38437.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
resource/aws_rds_cluster: Mark `ca_certificate_identifier` as Computed
```

```release-note:bug
resource/aws_rds_cluster: Wait for no pending modified values on Update if `apply_immediately` is `true`. This fixes `InvalidParameterCombination` errors when updating `engine_version`
```
4 changes: 3 additions & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ jobs:
body-includes: "Please note that typically Go dependency changes"

- name: Leave a New Comment if One Does Not Exist
if: steps.prc.outputs.comment-id == ''
if: |
steps.prc.outcome == 'success'
&& steps.prc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ BUG FIXES:
* data-source/aws_fsx_openzfs_snapshot: Correctly set `tags` on Read ([#38343](https://github.com/hashicorp/terraform-provider-aws/issues/38343))
* resource/aws_ce_cost_category: Fix perpetual diff with the `rule` argument on update ([#38449](https://github.com/hashicorp/terraform-provider-aws/issues/38449))
* resource/aws_fsx_openzfs_volume: Correctly set `tags` on Read ([#38343](https://github.com/hashicorp/terraform-provider-aws/issues/38343))
* resource/aws_rds_cluster: Mark `ca_certificate_identifier` as Computed ([#38437](https://github.com/hashicorp/terraform-provider-aws/issues/38437))
* resource/aws_rds_cluster: Wait for no pending modified values on Update if `apply_immediately` is `true`. This fixes `InvalidParameterCombination` errors when updating `engine_version` ([#38437](https://github.com/hashicorp/terraform-provider-aws/issues/38437))

## 5.59.0 (July 19, 2024)

Expand Down
36 changes: 31 additions & 5 deletions internal/service/bedrockagent/agent_action_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ func TestAccBedrockAgentAgentActionGroup_basic(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "action_group_name", rName),
resource.TestCheckResourceAttr(resourceName, "action_group_state", "ENABLED"),
resource.TestCheckResourceAttrPair(resourceName, "agent_id", "aws_bedrockagent_agent.test", "agent_id"),
resource.TestCheckResourceAttr(resourceName, "agent_version", "DRAFT"),
resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "Basic Agent Action"),
resource.TestCheckNoResourceAttr(resourceName, "parent_action_group_signature"),
resource.TestCheckResourceAttr(resourceName, "skip_resource_in_use_check", acctest.CtTrue),
resource.TestCheckResourceAttr(resourceName, "action_group_executor.#", acctest.Ct1),
resource.TestCheckNoResourceAttr(resourceName, "action_group_executor.0.custom_control"),
resource.TestCheckResourceAttrPair(resourceName, "action_group_executor.0.lambda", "aws_lambda_function.test_lambda", names.AttrARN),
resource.TestCheckResourceAttr(resourceName, "api_schema.#", acctest.Ct1),
resource.TestCheckResourceAttrSet(resourceName, "api_schema.0.payload"),
resource.TestCheckResourceAttr(resourceName, "api_schema.0.s3.#", acctest.Ct0),
resource.TestCheckResourceAttr(resourceName, "function_schema.#", acctest.Ct0),
),
},
{
Expand Down Expand Up @@ -65,8 +78,12 @@ func TestAccBedrockAgentAgentActionGroup_APISchema_s3(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "action_group_name", rName),
resource.TestCheckResourceAttr(resourceName, "action_group_executor.#", acctest.Ct1),
resource.TestCheckResourceAttrSet(resourceName, "action_group_executor.0.lambda"),
resource.TestCheckNoResourceAttr(resourceName, names.AttrDescription),
resource.TestCheckResourceAttr(resourceName, "api_schema.#", acctest.Ct1),
resource.TestCheckNoResourceAttr(resourceName, "api_schema.0.payload"),
resource.TestCheckResourceAttr(resourceName, "api_schema.0.s3.#", acctest.Ct1),
resource.TestCheckResourceAttrPair(resourceName, "api_schema.0.s3.0.s3_bucket_name", "aws_s3_bucket.test", names.AttrBucket),
resource.TestCheckResourceAttrPair(resourceName, "api_schema.0.s3.0.s3_object_key", "aws_s3_object.test", names.AttrKey),
),
},
{
Expand Down Expand Up @@ -96,6 +113,12 @@ func TestAccBedrockAgentAgentActionGroup_update(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "action_group_name", rName),
resource.TestCheckNoResourceAttr(resourceName, names.AttrDescription),
resource.TestCheckResourceAttr(resourceName, "api_schema.#", acctest.Ct1),
resource.TestCheckNoResourceAttr(resourceName, "api_schema.0.payload"),
resource.TestCheckResourceAttr(resourceName, "api_schema.0.s3.#", acctest.Ct1),
resource.TestCheckResourceAttrPair(resourceName, "api_schema.0.s3.0.s3_bucket_name", "aws_s3_bucket.test", names.AttrBucket),
resource.TestCheckResourceAttrPair(resourceName, "api_schema.0.s3.0.s3_object_key", "aws_s3_object.test", names.AttrKey),
),
},
{
Expand All @@ -110,6 +133,9 @@ func TestAccBedrockAgentAgentActionGroup_update(t *testing.T) {
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "action_group_name", rName),
resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "Basic Agent Action"),
resource.TestCheckResourceAttr(resourceName, "api_schema.#", acctest.Ct1),
resource.TestCheckResourceAttrSet(resourceName, "api_schema.0.payload"),
resource.TestCheckResourceAttr(resourceName, "api_schema.0.s3.#", acctest.Ct0),
),
},
{
Expand Down Expand Up @@ -183,6 +209,7 @@ func TestAccBedrockAgentAgentActionGroup_ActionGroupExecutor_customControl(t *te
resource.TestCheckResourceAttr(resourceName, "action_group_name", rName),
resource.TestCheckResourceAttr(resourceName, "action_group_executor.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "action_group_executor.0.custom_control", "RETURN_CONTROL"),
resource.TestCheckNoResourceAttr(resourceName, "action_group_executor.0.lambda"),
),
},
{
Expand Down Expand Up @@ -270,7 +297,7 @@ resource "aws_s3_bucket" "test" {
}
resource "aws_s3_object" "test" {
bucket = aws_s3_bucket.test.id
bucket = aws_s3_bucket.test.bucket
key = "api_schema.yaml"
source = "${path.module}/test-fixtures/api_schema.yaml"
}
Expand All @@ -285,7 +312,7 @@ resource "aws_bedrockagent_agent_action_group" "test" {
}
api_schema {
s3 {
s3_bucket_name = aws_s3_bucket.test.id
s3_bucket_name = aws_s3_bucket.test.bucket
s3_object_key = aws_s3_object.test.key
}
}
Expand Down Expand Up @@ -335,7 +362,6 @@ resource "aws_bedrockagent_agent_action_group" "test" {
action_group_name = %[1]q
agent_id = aws_bedrockagent_agent.test.agent_id
agent_version = "DRAFT"
description = "Basic Agent Action"
skip_resource_in_use_check = true
action_group_executor {
lambda = aws_lambda_function.test_lambda.arn
Expand Down
9 changes: 4 additions & 5 deletions internal/service/fsx/lustre_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,17 @@ func resourceLustreFileSystemStorageCapacityCustomizeDiff(_ context.Context, d *
func resourceLustreFileSystemMetadataConfigCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta any) error {
//metadata_configuration is only supported when deployment_type is persistent2
if v, ok := d.GetOk("metadata_configuration"); ok {
if len(v.([]any)) > 0 {
deploymentType := d.Get("deployment_type").(string)
if deploymentType != string(awstypes.LustreDeploymentTypePersistent2) {
return fmt.Errorf("metadata_configuration can only be set when deployment type is " + string(awstypes.LustreDeploymentTypePersistent2))
if len(v.([]interface{})) > 0 {
if deploymentType := awstypes.LustreDeploymentType(d.Get("deployment_type").(string)); deploymentType != awstypes.LustreDeploymentTypePersistent2 {
return fmt.Errorf("metadata_configuration can only be set when deployment type is %s", awstypes.LustreDeploymentTypePersistent2)
}
}
}

// we want to force a new resource if the new Iops is less than the old one
if d.HasChange("metadata_configuration") {
if v, ok := d.GetOk("metadata_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
if mode := d.Get("metadata_configuration.0.mode"); mode == awstypes.MetadataConfigurationModeUserProvisioned {
if mode := awstypes.MetadataConfigurationMode(d.Get("metadata_configuration.0.mode").(string)); mode == awstypes.MetadataConfigurationModeUserProvisioned {
o, n := d.GetChange("metadata_configuration")

oldV := o.([]interface{})
Expand Down
6 changes: 3 additions & 3 deletions internal/service/fsx/ontap_storage_virtual_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,18 @@ func TestAccFSxONTAPStorageVirtualMachine_activeDirectoryJoin(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccONTAPStorageVirtualMachineConfig_basic(rName),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckONTAPStorageVirtualMachineExists(ctx, resourceName, &storageVirtualMachine1),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.#", acctest.Ct0),
),
},
{
Config: testAccONTAPStorageVirtualMachineConfig_selfManagedActiveDirectory(rName, netBiosName, domainNetbiosName, domainName, domainPassword),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckONTAPStorageVirtualMachineExists(ctx, resourceName, &storageVirtualMachine2),
testAccCheckONTAPStorageVirtualMachineNotRecreated(&storageVirtualMachine1, &storageVirtualMachine2),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.0.netbios_name", netBiosName),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.0.netbios_name", strings.ToUpper(netBiosName)),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.0.self_managed_active_directory_configuration.0.domain_name", domainName),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.0.self_managed_active_directory_configuration.0.file_system_administrators_group", "Admins"),
resource.TestCheckResourceAttr(resourceName, "active_directory_configuration.0.self_managed_active_directory_configuration.0.organizational_unit_distinguished_name", fmt.Sprintf("OU=computers,OU=%s", domainNetbiosName)),
Expand Down
97 changes: 48 additions & 49 deletions internal/service/fsx/openzfs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,72 +703,70 @@ func expandDiskIopsConfiguration(cfg []interface{}) *awstypes.DiskIopsConfigurat
return &out
}

func expandOpenZFSCreateRootVolumeConfiguration(cfg []interface{}) *awstypes.OpenZFSCreateRootVolumeConfiguration {
if len(cfg) < 1 {
func expandOpenZFSCreateRootVolumeConfiguration(tfList []interface{}) *awstypes.OpenZFSCreateRootVolumeConfiguration {
if len(tfList) < 1 {
return nil
}

conf := cfg[0].(map[string]interface{})

out := awstypes.OpenZFSCreateRootVolumeConfiguration{}
tfMap := tfList[0].(map[string]interface{})
apiObject := &awstypes.OpenZFSCreateRootVolumeConfiguration{}

if v, ok := conf["copy_tags_to_snapshots"].(bool); ok {
out.CopyTagsToSnapshots = aws.Bool(v)
if v, ok := tfMap["copy_tags_to_snapshots"].(bool); ok {
apiObject.CopyTagsToSnapshots = aws.Bool(v)
}

if v, ok := conf["data_compression_type"].(string); ok {
out.DataCompressionType = awstypes.OpenZFSDataCompressionType(v)
if v, ok := tfMap["data_compression_type"].(string); ok {
apiObject.DataCompressionType = awstypes.OpenZFSDataCompressionType(v)
}

if v, ok := conf["read_only"].(bool); ok {
out.ReadOnly = aws.Bool(v)
if v, ok := tfMap["nfs_exports"].([]interface{}); ok {
apiObject.NfsExports = expandOpenZFSNfsExports(v)
}

if v, ok := conf["record_size_kib"].(int); ok {
out.RecordSizeKiB = aws.Int32(int32(v))
if v, ok := tfMap["read_only"].(bool); ok {
apiObject.ReadOnly = aws.Bool(v)
}

if v, ok := conf["user_and_group_quotas"]; ok {
out.UserAndGroupQuotas = expandOpenZFSUserOrGroupQuotas(v.(*schema.Set).List())
if v, ok := tfMap["record_size_kib"].(int); ok {
apiObject.RecordSizeKiB = aws.Int32(int32(v))
}

if v, ok := conf["nfs_exports"].([]interface{}); ok {
out.NfsExports = expandOpenZFSNfsExports(v)
if v, ok := tfMap["user_and_group_quotas"]; ok {
apiObject.UserAndGroupQuotas = expandOpenZFSUserOrGroupQuotas(v.(*schema.Set).List())
}

return &out
return apiObject
}

func expandUpdateOpenZFSVolumeConfiguration(cfg []interface{}) *awstypes.UpdateOpenZFSVolumeConfiguration {
if len(cfg) < 1 {
func expandUpdateOpenZFSVolumeConfiguration(tfList []interface{}) *awstypes.UpdateOpenZFSVolumeConfiguration {
if len(tfList) < 1 {
return nil
}

conf := cfg[0].(map[string]interface{})

out := awstypes.UpdateOpenZFSVolumeConfiguration{}
tfMap := tfList[0].(map[string]interface{})
apiObject := &awstypes.UpdateOpenZFSVolumeConfiguration{}

if v, ok := conf["data_compression_type"].(string); ok {
out.DataCompressionType = awstypes.OpenZFSDataCompressionType(v)
if v, ok := tfMap["data_compression_type"].(string); ok {
apiObject.DataCompressionType = awstypes.OpenZFSDataCompressionType(v)
}

if v, ok := conf["read_only"].(bool); ok {
out.ReadOnly = aws.Bool(v)
if v, ok := tfMap["nfs_exports"].([]interface{}); ok {
apiObject.NfsExports = expandOpenZFSNfsExports(v)
}

if v, ok := conf["record_size_kib"].(int); ok {
out.RecordSizeKiB = aws.Int32(int32(v))
if v, ok := tfMap["read_only"].(bool); ok {
apiObject.ReadOnly = aws.Bool(v)
}

if v, ok := conf["user_and_group_quotas"]; ok {
out.UserAndGroupQuotas = expandOpenZFSUserOrGroupQuotas(v.(*schema.Set).List())
if v, ok := tfMap["record_size_kib"].(int); ok {
apiObject.RecordSizeKiB = aws.Int32(int32(v))
}

if v, ok := conf["nfs_exports"].([]interface{}); ok {
out.NfsExports = expandOpenZFSNfsExports(v)
if v, ok := tfMap["user_and_group_quotas"]; ok {
apiObject.UserAndGroupQuotas = expandOpenZFSUserOrGroupQuotas(v.(*schema.Set).List())
}

return &out
return apiObject
}

func flattenDiskIopsConfiguration(rs *awstypes.DiskIopsConfiguration) []interface{} {
Expand All @@ -785,30 +783,31 @@ func flattenDiskIopsConfiguration(rs *awstypes.DiskIopsConfiguration) []interfac
return []interface{}{m}
}

func flattenOpenZFSFileSystemRootVolume(rs *awstypes.Volume) []interface{} {
if rs == nil {
func flattenOpenZFSFileSystemRootVolume(apiObject *awstypes.Volume) []interface{} {
if apiObject == nil {
return []interface{}{}
}

m := make(map[string]interface{})
if rs.OpenZFSConfiguration.CopyTagsToSnapshots != nil {
m["copy_tags_to_snapshots"] = aws.ToBool(rs.OpenZFSConfiguration.CopyTagsToSnapshots)
tfMap := make(map[string]interface{})

if apiObject.OpenZFSConfiguration.CopyTagsToSnapshots != nil {
tfMap["copy_tags_to_snapshots"] = aws.ToBool(apiObject.OpenZFSConfiguration.CopyTagsToSnapshots)
}
m["data_compression_type"] = string(rs.OpenZFSConfiguration.DataCompressionType)
if rs.OpenZFSConfiguration.NfsExports != nil {
m["nfs_exports"] = flattenOpenZFSNfsExports(rs.OpenZFSConfiguration.NfsExports)
tfMap["data_compression_type"] = string(apiObject.OpenZFSConfiguration.DataCompressionType)
if apiObject.OpenZFSConfiguration.NfsExports != nil {
tfMap["nfs_exports"] = flattenOpenZFSNfsExports(apiObject.OpenZFSConfiguration.NfsExports)
}
if rs.OpenZFSConfiguration.ReadOnly != nil {
m["read_only"] = aws.ToBool(rs.OpenZFSConfiguration.ReadOnly)
if apiObject.OpenZFSConfiguration.ReadOnly != nil {
tfMap["read_only"] = aws.ToBool(apiObject.OpenZFSConfiguration.ReadOnly)
}
if rs.OpenZFSConfiguration.RecordSizeKiB != nil {
m["record_size_kib"] = aws.ToInt32(rs.OpenZFSConfiguration.RecordSizeKiB)
if apiObject.OpenZFSConfiguration.RecordSizeKiB != nil {
tfMap["record_size_kib"] = aws.ToInt32(apiObject.OpenZFSConfiguration.RecordSizeKiB)
}
if rs.OpenZFSConfiguration.UserAndGroupQuotas != nil {
m["user_and_group_quotas"] = flattenOpenZFSUserOrGroupQuotas(rs.OpenZFSConfiguration.UserAndGroupQuotas)
if apiObject.OpenZFSConfiguration.UserAndGroupQuotas != nil {
tfMap["user_and_group_quotas"] = flattenOpenZFSUserOrGroupQuotas(apiObject.OpenZFSConfiguration.UserAndGroupQuotas)
}

return []interface{}{m}
return []interface{}{tfMap}
}

func findOpenZFSFileSystemByID(ctx context.Context, conn *fsx.Client, id string) (*awstypes.FileSystem, error) {
Expand Down
2 changes: 2 additions & 0 deletions internal/service/fsx/openzfs_file_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func init() {
func testAccErrorCheckSkip(t *testing.T) resource.ErrorCheckFunc {
return acctest.ErrorCheckSkipMessagesContaining(t,
"Amazon FSx does not currently support OpenZFS file system creation in the following Availability Zones",
// "ServiceLimitExceeded: Account 123456789012 can have at most 10240 MB/s of throughput capacity total across file systems"
"throughput capacity total across file systems",
)
}

Expand Down
Loading

0 comments on commit 6c83b7c

Please sign in to comment.