Skip to content

Commit

Permalink
Merge pull request #36062 from acwwat/f-aws_ram_resource_share-data_s…
Browse files Browse the repository at this point in the history
…ource_name_optional

feat: Mark name arg as optional to match AWS API for aws_ram_resource_share data source
  • Loading branch information
ewbankkit authored Mar 14, 2024
2 parents 6bd6d42 + 56129a9 commit 9623cda
Show file tree
Hide file tree
Showing 27 changed files with 925 additions and 743 deletions.
19 changes: 19 additions & 0 deletions .changelog/36062.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```release-note:enhancement
data-source/aws_ram_resource_share: `name` is Optional
```

```release-note:enhancement
resource/aws_ram_resource_association: Add plan-time validation of `resource_arn` and `resource_share_arn`
```

```release-note:bug
resource/aws_ram_principal_association: Remove from state on resource Read if `principal` is disassociated outside of Terraform
```

```release-note:bug
resource/aws_ram_principal_association: Prevent creation of duplicate Terraform resources
```

```release-note:bug
resource/aws_ram_resource_association: Prevent creation of duplicate Terraform resources
```
4 changes: 2 additions & 2 deletions internal/framework/validators/aws_account_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package validators
import (
"context"

"github.com/YakDriver/regexache"
"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
itypes "github.com/hashicorp/terraform-provider-aws/internal/types"
)

// awsAccountIDValidator validates that a string Attribute's value is a valid AWS account ID.
Expand All @@ -31,7 +31,7 @@ func (validator awsAccountIDValidator) ValidateString(ctx context.Context, reque
}

// https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-identifiers.html.
if !regexache.MustCompile(`^\d{12}$`).MatchString(request.ConfigValue.ValueString()) {
if !itypes.IsAWSAccountID(request.ConfigValue.ValueString()) {
response.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
request.Path,
validator.Description(ctx),
Expand Down
13 changes: 13 additions & 0 deletions internal/service/ram/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package ram

import (
"time"
)

const (
resourceShareInvitationPropagationTimeout = 2 * time.Minute
resourceSharePropagationTimeout = 1 * time.Minute
)
19 changes: 19 additions & 0 deletions internal/service/ram/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package ram

// Exports for use in tests only.
var (
ResourcePrincipalAssociation = resourcePrincipalAssociation
ResourceResourceAssociation = resourceResourceAssociation
ResourceResourceShare = resourceResourceShare
ResourceResourceShareAccepter = resourceResourceShareAccepter
ResourceSharingWithOrganization = resourceSharingWithOrganization

FindPrincipalAssociationByTwoPartKey = findPrincipalAssociationByTwoPartKey
FindResourceAssociationByTwoPartKey = findResourceAssociationByTwoPartKey
FindResourceShareOwnerOtherAccountsByARN = findResourceShareOwnerOtherAccountsByARN
FindResourceShareOwnerSelfByARN = findResourceShareOwnerSelfByARN
FindSharingWithOrganization = findSharingWithOrganization
)
186 changes: 0 additions & 186 deletions internal/service/ram/find.go

This file was deleted.

Loading

0 comments on commit 9623cda

Please sign in to comment.