provider/aws: customer gateway has to parse bgn_asn as int

This commit is contained in:
Mitchell Hashimoto 2016-04-20 17:59:19 -07:00
parent 0722f0b138
commit 3013d1d2d1
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 18 additions and 6 deletions

View File

@ -86,6 +86,8 @@ BUG FIXES:
* provider/aws: Don't read back `aws_opsworks_stack` cookbooks source password [GH-6203]
* provider/aws: Resolves DefaultOS and ConfigurationManager conflict on `aws_opsworks_stack` [GH-6244]
* provider/aws: Renaming `aws_elastic_beanstalk_configuration_template``option_settings` to `setting` [GH-6043]
* provider/aws: `aws_customer_gateway` will properly populate `bgp_asn`
on refresh. [no issue]
* provider/azurerm: Fix detection of `azurerm_storage_account` resources removed manually [GH-5878]
* provider/docker: Docker Image will be deleted on destroy [GH-5801]
* provider/openstack: Fix Disabling DHCP on Subnets [GH-6052]

View File

@ -3,6 +3,7 @@ package aws
import (
"fmt"
"log"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws"
@ -145,11 +146,19 @@ func resourceAwsCustomerGatewayRead(d *schema.ResourceData, meta interface{}) er
}
customerGateway := resp.CustomerGateways[0]
d.Set("bgp_asn", customerGateway.BgpAsn)
d.Set("ip_address", customerGateway.IpAddress)
d.Set("type", customerGateway.Type)
d.Set("tags", tagsToMap(customerGateway.Tags))
if *customerGateway.BgpAsn != "" {
val, err := strconv.ParseInt(*customerGateway.BgpAsn, 0, 0)
if err != nil {
return fmt.Errorf("error parsing bgp_asn: %s", err)
}
d.Set("bgp_asn", int(val))
}
return nil
}

View File

@ -15,6 +15,7 @@ import (
func TestAccAWSCustomerGateway_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
IDRefreshName: "aws_customer_gateway.foo",
Providers: testAccProviders,
CheckDestroy: testAccCheckCustomerGatewayDestroy,
Steps: []resource.TestStep{