provider/aws: customer gateway has to parse bgn_asn as int
This commit is contained in:
parent
0722f0b138
commit
3013d1d2d1
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,10 @@ import (
|
|||
|
||||
func TestAccAWSCustomerGateway_basic(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_customer_gateway.foo",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccCustomerGatewayConfig,
|
||||
|
|
Loading…
Reference in New Issue