Skip to content

Commit

Permalink
Merge pull request #21285 from drewmullen/f-aws-vpc-flow-logs-parquet
Browse files Browse the repository at this point in the history
enhancement: aws/resource_aws_vpc_flow_log destination_options parquet
  • Loading branch information
ewbankkit authored Oct 13, 2021
2 parents e08d31e + 868e4d3 commit 027a9b9
Show file tree
Hide file tree
Showing 6 changed files with 554 additions and 196 deletions.
3 changes: 3 additions & 0 deletions .changelog/21285.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_vpc_flow_log: Add `destination_options` block argument which can now enable parquet log file format
```
4 changes: 4 additions & 0 deletions aws/internal/service/ec2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ const (
ErrCodeInvalidPermissionNotFound = "InvalidPermission.NotFound"
)

const (
ErrCodeInvalidFlowLogIdNotFound = "InvalidFlowLogId.NotFound"
)

const (
ErrCodeInvalidPlacementGroupUnknown = "InvalidPlacementGroup.Unknown"
)
Expand Down
22 changes: 22 additions & 0 deletions aws/internal/service/ec2/finder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,28 @@ func VpnGatewayByID(conn *ec2.EC2, id string) (*ec2.VpnGateway, error) {
return output.VpnGateways[0], nil
}

func FlowLogByID(conn *ec2.EC2, id string) (*ec2.FlowLog, error) {
input := &ec2.DescribeFlowLogsInput{
FlowLogIds: aws.StringSlice([]string{id}),
}

output, err := conn.DescribeFlowLogs(input)

if err != nil {
return nil, err
}

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

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

return output.FlowLogs[0], nil
}

func ManagedPrefixListByID(conn *ec2.EC2, id string) (*ec2.ManagedPrefixList, error) {
input := &ec2.DescribeManagedPrefixListsInput{
PrefixListIds: aws.StringSlice([]string{id}),
Expand Down
Loading

0 comments on commit 027a9b9

Please sign in to comment.