Skip to content

Commit

Permalink
Merge branch 'master' into feature/4990_pinpoint_apns_voip_channel
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad authored Oct 25, 2018
2 parents c92c78d + c29d369 commit 1a4f99e
Show file tree
Hide file tree
Showing 57 changed files with 16,922 additions and 6,052 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
## 1.42.0 (Unreleased)

NOTES:

* This release will be delayed one week due to HashiConf.

FEATURES:

* **New Resource:** `aws_pinpoint_apns_sandbox_channel` [GH-6233]

ENHANCEMENTS:

* resource/aws_flow_log: Add `log_destination` and `log_destination_type` arguments (support sending to S3) [GH-5509]

BUG FIXES:

* resource/aws_network_acl_rule: Suppress `protocol` differences between name and number [GH-2454]

## 1.41.0 (October 18, 2018)

FEATURES:
Expand Down
1 change: 1 addition & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ func Provider() terraform.ResourceProvider {
"aws_pinpoint_app": resourceAwsPinpointApp(),
"aws_pinpoint_adm_channel": resourceAwsPinpointADMChannel(),
"aws_pinpoint_apns_channel": resourceAwsPinpointAPNSChannel(),
"aws_pinpoint_apns_sandbox_channel": resourceAwsPinpointAPNSSandboxChannel(),
"aws_pinpoint_apns_voip_channel": resourceAwsPinpointAPNSVoipChannel(),
"aws_pinpoint_baidu_channel": resourceAwsPinpointBaiduChannel(),
"aws_pinpoint_email_channel": resourceAwsPinpointEmailChannel(),
Expand Down
53 changes: 45 additions & 8 deletions aws/resource_aws_flow_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)

func resourceAwsFlowLog() *schema.Resource {
Expand All @@ -22,14 +23,37 @@ func resourceAwsFlowLog() *schema.Resource {
Schema: map[string]*schema.Schema{
"iam_role_arn": {
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
},

"log_group_name": {
"log_destination": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"log_group_name"},
ValidateFunc: validateArn,
},

"log_destination_type": {
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
Default: ec2.LogDestinationTypeCloudWatchLogs,
ValidateFunc: validation.StringInSlice([]string{
ec2.LogDestinationTypeCloudWatchLogs,
ec2.LogDestinationTypeS3,
}, false),
},

"log_group_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"log_destination"},
Deprecated: "use 'log_destination' argument instead",
},

"vpc_id": {
Expand Down Expand Up @@ -89,11 +113,22 @@ func resourceAwsLogFlowCreate(d *schema.ResourceData, meta interface{}) error {
}

opts := &ec2.CreateFlowLogsInput{
DeliverLogsPermissionArn: aws.String(d.Get("iam_role_arn").(string)),
LogGroupName: aws.String(d.Get("log_group_name").(string)),
ResourceIds: []*string{aws.String(resourceId)},
ResourceType: aws.String(resourceType),
TrafficType: aws.String(d.Get("traffic_type").(string)),
LogDestinationType: aws.String(d.Get("log_destination_type").(string)),
ResourceIds: []*string{aws.String(resourceId)},
ResourceType: aws.String(resourceType),
TrafficType: aws.String(d.Get("traffic_type").(string)),
}

if v, ok := d.GetOk("iam_role_arn"); ok && v != "" {
opts.DeliverLogsPermissionArn = aws.String(v.(string))
}

if v, ok := d.GetOk("log_destination"); ok && v != "" {
opts.LogDestination = aws.String(v.(string))
}

if v, ok := d.GetOk("log_group_name"); ok && v != "" {
opts.LogGroupName = aws.String(v.(string))
}

log.Printf(
Expand Down Expand Up @@ -134,6 +169,8 @@ func resourceAwsLogFlowRead(d *schema.ResourceData, meta interface{}) error {

fl := resp.FlowLogs[0]
d.Set("traffic_type", fl.TrafficType)
d.Set("log_destination", fl.LogDestination)
d.Set("log_destination_type", fl.LogDestinationType)
d.Set("log_group_name", fl.LogGroupName)
d.Set("iam_role_arn", fl.DeliverLogsPermissionArn)

Expand Down
Loading

0 comments on commit 1a4f99e

Please sign in to comment.