Fixes for goamz removal.
This commit is contained in:
parent
f7289599cc
commit
8ebbaf550c
|
@ -36,7 +36,7 @@ func resourceAwsVpnGateway() *schema.Resource {
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpnGatewayCreate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsVpnGatewayCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
createOpts := &ec2.CreateVPNGatewayRequest{
|
createOpts := &ec2.CreateVPNGatewayRequest{
|
||||||
AvailabilityZone: aws.String(d.Get("availability_zone").(string)),
|
AvailabilityZone: aws.String(d.Get("availability_zone").(string)),
|
||||||
|
@ -60,7 +60,7 @@ func resourceAwsVpnGatewayCreate(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpnGatewayRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsVpnGatewayRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
vpnGatewayRaw, _, err := vpnGatewayStateRefreshFunc(ec2conn, d.Id())()
|
vpnGatewayRaw, _, err := vpnGatewayStateRefreshFunc(ec2conn, d.Id())()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -80,7 +80,7 @@ func resourceAwsVpnGatewayRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.Set("vpc_id", vpnGateway.VPCAttachments[0].VPCID)
|
d.Set("vpc_id", vpnGateway.VPCAttachments[0].VPCID)
|
||||||
}
|
}
|
||||||
d.Set("availability_zone", vpnGateway.AvailabilityZone)
|
d.Set("availability_zone", vpnGateway.AvailabilityZone)
|
||||||
d.Set("tags", tagsToMapSDK(vpnGateway.Tags))
|
d.Set("tags", tagsToMap(vpnGateway.Tags))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ func resourceAwsVpnGatewayUpdate(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
if err := setTagsSDK(ec2conn, d); err != nil {
|
if err := setTags(ec2conn, d); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func resourceAwsVpnGatewayUpdate(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
// Detach if it is attached
|
// Detach if it is attached
|
||||||
if err := resourceAwsVpnGatewayDetach(d, meta); err != nil {
|
if err := resourceAwsVpnGatewayDetach(d, meta); err != nil {
|
||||||
|
@ -144,7 +144,7 @@ func resourceAwsVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpnGatewayAttach(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsVpnGatewayAttach(d *schema.ResourceData, meta interface{}) error {
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
if d.Get("vpc_id").(string) == "" {
|
if d.Get("vpc_id").(string) == "" {
|
||||||
log.Printf(
|
log.Printf(
|
||||||
|
@ -189,7 +189,7 @@ func resourceAwsVpnGatewayAttach(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpnGatewayDetach(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsVpnGatewayDetach(d *schema.ResourceData, meta interface{}) error {
|
||||||
ec2conn := meta.(*AWSClient).awsEC2conn
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
|
|
||||||
// Get the old VPC ID to detach from
|
// Get the old VPC ID to detach from
|
||||||
vpcID, _ := d.GetChange("vpc_id")
|
vpcID, _ := d.GetChange("vpc_id")
|
||||||
|
|
|
@ -98,7 +98,7 @@ func TestAccVpnGateway_tags(t *testing.T) {
|
||||||
Config: testAccCheckVpnGatewayConfigTags,
|
Config: testAccCheckVpnGatewayConfigTags,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
||||||
testAccCheckTagsSDK(&v.Tags, "foo", "bar"),
|
testAccCheckTags(&v.Tags, "foo", "bar"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ func TestAccVpnGateway_tags(t *testing.T) {
|
||||||
Config: testAccCheckVpnGatewayConfigTagsUpdate,
|
Config: testAccCheckVpnGatewayConfigTagsUpdate,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
||||||
testAccCheckTagsSDK(&v.Tags, "foo", ""),
|
testAccCheckTags(&v.Tags, "foo", ""),
|
||||||
testAccCheckTagsSDK(&v.Tags, "bar", "baz"),
|
testAccCheckTags(&v.Tags, "bar", "baz"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -115,7 +115,7 @@ func TestAccVpnGateway_tags(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckVpnGatewayDestroy(s *terraform.State) error {
|
func testAccCheckVpnGatewayDestroy(s *terraform.State) error {
|
||||||
ec2conn := testAccProvider.Meta().(*AWSClient).awsEC2conn
|
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
||||||
|
|
||||||
for _, rs := range s.RootModule().Resources {
|
for _, rs := range s.RootModule().Resources {
|
||||||
if rs.Type != "aws_vpn_gateway" {
|
if rs.Type != "aws_vpn_gateway" {
|
||||||
|
@ -158,7 +158,7 @@ func testAccCheckVpnGatewayExists(n string, ig *ec2.VPNGateway) resource.TestChe
|
||||||
return fmt.Errorf("No ID is set")
|
return fmt.Errorf("No ID is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := testAccProvider.Meta().(*AWSClient).awsEC2conn
|
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
||||||
resp, err := ec2conn.DescribeVPNGateways(&ec2.DescribeVPNGatewaysRequest{
|
resp, err := ec2conn.DescribeVPNGateways(&ec2.DescribeVPNGatewaysRequest{
|
||||||
VPNGatewayIDs: []string{rs.Primary.ID},
|
VPNGatewayIDs: []string{rs.Primary.ID},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue