Skip to content

Commit

Permalink
Drop explicit govcloud check from vpc endpoint type check.
Browse files Browse the repository at this point in the history
h/t @bflad
  • Loading branch information
jmcarp committed Mar 9, 2018
1 parent 7a106be commit e7b035c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aws/data_source_aws_vpc_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ func dataSourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) erro
vpce := resp.VpcEndpoints[0]
d.SetId(aws.StringValue(vpce.VpcEndpointId))

return vpcEndpointAttributes(d, vpce, meta)
return vpcEndpointAttributes(d, vpce, conn)
}
9 changes: 5 additions & 4 deletions aws/resource_aws_vpc_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func resourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) error
return nil
}

return vpcEndpointAttributes(d, vpce.(*ec2.VpcEndpoint), meta)
return vpcEndpointAttributes(d, vpce.(*ec2.VpcEndpoint), conn)
}

func resourceAwsVpcEndpointUpdate(d *schema.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -341,13 +341,14 @@ func vpcEndpointWaitUntilAvailable(d *schema.ResourceData, conn *ec2.EC2) error
return nil
}

func vpcEndpointAttributes(d *schema.ResourceData, vpce *ec2.VpcEndpoint, meta interface{}) error {
func vpcEndpointAttributes(d *schema.ResourceData, vpce *ec2.VpcEndpoint, conn *ec2.EC2) error {
d.Set("state", vpce.State)
d.Set("vpc_id", vpce.VpcId)

serviceName := aws.StringValue(vpce.ServiceName)
d.Set("service_name", serviceName)
if meta.(*AWSClient).IsGovCloud() && aws.StringValue(vpce.VpcEndpointType) == "" {
// VPC endpoints don't have types in GovCloud, so set type to default if empty
if aws.StringValue(vpce.VpcEndpointType) == "" {
d.Set("vpc_endpoint_type", ec2.VpcEndpointTypeGateway)
} else {
d.Set("vpc_endpoint_type", vpce.VpcEndpointType)
Expand All @@ -367,7 +368,7 @@ func vpcEndpointAttributes(d *schema.ResourceData, vpce *ec2.VpcEndpoint, meta i
"prefix-list-name": serviceName,
},
)
resp, err := meta.(*AWSClient).ec2conn.DescribePrefixLists(req)
resp, err := conn.DescribePrefixLists(req)
if err != nil {
return err
}
Expand Down

0 comments on commit e7b035c

Please sign in to comment.