Skip to content

Commit

Permalink
Merge pull request #39454 from mumoumit/f-fix-vpce-test
Browse files Browse the repository at this point in the history
Add fix for OpenSearch Serverless VPCE test
  • Loading branch information
ewbankkit authored Sep 24, 2024
2 parents ae1327b + 9dc286b commit 8257fc0
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 212 deletions.
11 changes: 11 additions & 0 deletions .changelog/39454.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:bug
resource/aws_opensearchserverless_vpc_endpoint: Change `name` and `vpc_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew)
```

```release-note:bug
resource/aws_opensearchserverless_vpc_endpoint: Correctly set `security_group_ids`. This requires a call to the EC2 `DescribeVpcEndpoints` API
```

```release-note:bug
data-source/aws_opensearchserverless_vpc_endpoint: Correctly set `security_group_ids`. This requires a call to the EC2 `DescribeVpcEndpoints` API
```
2 changes: 1 addition & 1 deletion internal/service/opensearchserverless/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var (
ResourceLifecyclePolicy = newResourceLifecyclePolicy
ResourceSecurityConfig = newResourceSecurityConfig
ResourceSecurityPolicy = newResourceSecurityPolicy
ResourceVPCEndpoint = newResourceVPCEndpoint
ResourceVPCEndpoint = newVPCEndpointResource

FindAccessPolicyByNameAndType = findAccessPolicyByNameAndType
FindCollectionByID = findCollectionByID
Expand Down
25 changes: 0 additions & 25 deletions internal/service/opensearchserverless/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,6 @@ func findSecurityPolicyByNameAndType(ctx context.Context, conn *opensearchserver
return out.SecurityPolicyDetail, nil
}

func findVPCEndpointByID(ctx context.Context, conn *opensearchserverless.Client, id string) (*types.VpcEndpointDetail, error) {
in := &opensearchserverless.BatchGetVpcEndpointInput{
Ids: []string{id},
}
out, err := conn.BatchGetVpcEndpoint(ctx, in)

if err != nil {
var nfe *types.ResourceNotFoundException
if errors.As(err, &nfe) {
return nil, &retry.NotFoundError{
LastError: err,
LastRequest: in,
}
}

return nil, err
}

if out == nil || out.VpcEndpointDetails == nil || len(out.VpcEndpointDetails) == 0 {
return nil, tfresource.NewEmptyResultError(in)
}

return &out.VpcEndpointDetails[0], nil
}

func findLifecyclePolicyByNameAndType(ctx context.Context, conn *opensearchserverless.Client, name, policyType string) (*types.LifecyclePolicyDetail, error) {
in := &opensearchserverless.BatchGetLifecyclePolicyInput{
Identifiers: []types.LifecyclePolicyIdentifier{
Expand Down
6 changes: 4 additions & 2 deletions internal/service/opensearchserverless/service_package_gen.go

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

Loading

0 comments on commit 8257fc0

Please sign in to comment.