Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/vpc_endpoint - add dns_options and ip_address_type argument #25190

Merged
merged 17 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/25190.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_vpc_endpoint: Add `dns_options` and `ip_address_type` arguments
```

```release-note:enhancement
data-source/aws_vpc_endpoint: Add `dns_options` and `ip_address_type` attributes
```
1 change: 1 addition & 0 deletions internal/service/ec2/ec2_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func testAccErrorCheckSkip(t *testing.T) resource.ErrorCheckFunc {
"Unsupported volume type",
"HostLimitExceeded",
"ReservationCapacityExceeded",
"InsufficientInstanceCapacity",
)
}

Expand Down
1 change: 1 addition & 0 deletions internal/service/ec2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
errCodeInvalidPlacementGroupUnknown = "InvalidPlacementGroup.Unknown"
errCodeInvalidPoolIDNotFound = "InvalidPoolID.NotFound"
errCodeInvalidPrefixListIDNotFound = "InvalidPrefixListID.NotFound"
errCodeInvalidPrefixListIdNotFound = "InvalidPrefixListId.NotFound"
errCodeInvalidRouteNotFound = "InvalidRoute.NotFound"
errCodeInvalidRouteTableIDNotFound = "InvalidRouteTableID.NotFound"
errCodeInvalidRouteTableIdNotFound = "InvalidRouteTableId.NotFound"
Expand Down
69 changes: 69 additions & 0 deletions internal/service/ec2/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,16 @@ func FindVPCEndpointServiceConfigurations(conn *ec2.EC2, input *ec2.DescribeVpcE
return output, nil
}

func FindVPCEndpointServiceConfigurationByServiceName(conn *ec2.EC2, name string) (*ec2.ServiceConfiguration, error) {
input := &ec2.DescribeVpcEndpointServiceConfigurationsInput{
Filters: BuildAttributeFilterList(map[string]string{
"service-name": name,
}),
}

return FindVPCEndpointServiceConfiguration(conn, input)
}

func FindVPCEndpointServices(conn *ec2.EC2, input *ec2.DescribeVpcEndpointServicesInput) ([]*ec2.ServiceDetail, []string, error) {
var serviceDetails []*ec2.ServiceDetail
var serviceNames []string
Expand Down Expand Up @@ -4705,6 +4715,65 @@ func FindPlacementGroupByName(conn *ec2.EC2, name string) (*ec2.PlacementGroup,
return placementGroup, nil
}

func FindPrefixList(conn *ec2.EC2, input *ec2.DescribePrefixListsInput) (*ec2.PrefixList, error) {
output, err := FindPrefixLists(conn, input)

if err != nil {
return nil, err
}

if len(output) == 0 || output[0] == nil {
return nil, tfresource.NewEmptyResultError(input)
}

if count := len(output); count > 1 {
return nil, tfresource.NewTooManyResultsError(count, input)
}

return output[0], nil
}

func FindPrefixLists(conn *ec2.EC2, input *ec2.DescribePrefixListsInput) ([]*ec2.PrefixList, error) {
var output []*ec2.PrefixList

err := conn.DescribePrefixListsPages(input, func(page *ec2.DescribePrefixListsOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, v := range page.PrefixLists {
if v != nil {
output = append(output, v)
}
}

return !lastPage
})

if tfawserr.ErrCodeEquals(err, errCodeInvalidPrefixListIdNotFound) {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

return output, nil
}

func FindPrefixListByName(conn *ec2.EC2, name string) (*ec2.PrefixList, error) {
input := &ec2.DescribePrefixListsInput{
Filters: BuildAttributeFilterList(map[string]string{
"prefix-list-name": name,
}),
}

return FindPrefixList(conn, input)
}

func FindVPCEndpointConnectionByServiceIDAndVPCEndpointID(conn *ec2.EC2, serviceID, vpcEndpointID string) (*ec2.VpcEndpointConnection, error) {
input := &ec2.DescribeVpcEndpointConnectionsInput{
Filters: BuildAttributeFilterList(map[string]string{
Expand Down
Loading