2014-07-14 23:59:08 +02:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-07-28 18:04:58 +02:00
|
|
|
"strings"
|
2014-07-14 23:59:08 +02:00
|
|
|
"testing"
|
|
|
|
|
2015-06-03 20:36:57 +02:00
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
|
|
"github.com/aws/aws-sdk-go/service/ec2"
|
2014-07-14 23:59:08 +02:00
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
2015-06-08 01:04:38 +02:00
|
|
|
func TestAccAWSEIP_basic(t *testing.T) {
|
2014-07-14 23:59:08 +02:00
|
|
|
var conf ec2.Address
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-22 07:17:14 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_eip.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSEIPDestroy,
|
2014-07-14 23:59:08 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &conf),
|
|
|
|
testAccCheckAWSEIPAttributes(&conf),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2014-07-27 00:53:26 +02:00
|
|
|
func TestAccAWSEIP_instance(t *testing.T) {
|
|
|
|
var conf ec2.Address
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-22 07:17:14 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_eip.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSEIPDestroy,
|
2014-07-27 00:53:26 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPInstanceConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &conf),
|
|
|
|
testAccCheckAWSEIPAttributes(&conf),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPInstanceConfig2,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &conf),
|
|
|
|
testAccCheckAWSEIPAttributes(&conf),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-04-26 04:30:37 +02:00
|
|
|
func TestAccAWSEIP_network_interface(t *testing.T) {
|
|
|
|
var conf ec2.Address
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-22 07:17:14 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_eip.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSEIPDestroy,
|
2015-04-26 04:30:37 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPNetworkInterfaceConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &conf),
|
|
|
|
testAccCheckAWSEIPAttributes(&conf),
|
|
|
|
testAccCheckAWSEIPAssociated(&conf),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
func TestAccAWSEIP_twoEIPsOneNetworkInterface(t *testing.T) {
|
|
|
|
var one, two ec2.Address
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-22 07:17:14 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_eip.one",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSEIPDestroy,
|
2016-04-07 19:15:00 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPMultiNetworkInterfaceConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.one", &one),
|
|
|
|
testAccCheckAWSEIPAttributes(&one),
|
|
|
|
testAccCheckAWSEIPAssociated(&one),
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.two", &two),
|
|
|
|
testAccCheckAWSEIPAttributes(&two),
|
|
|
|
testAccCheckAWSEIPAssociated(&two),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-05-06 22:38:39 +02:00
|
|
|
// This test is an expansion of TestAccAWSEIP_instance, by testing the
|
|
|
|
// associated Private EIPs of two instances
|
|
|
|
func TestAccAWSEIP_associated_user_private_ip(t *testing.T) {
|
|
|
|
var one ec2.Address
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_eip.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSEIPDestroy,
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPInstanceConfig_associated,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &one),
|
|
|
|
testAccCheckAWSEIPAttributes(&one),
|
|
|
|
testAccCheckAWSEIPAssociated(&one),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccAWSEIPInstanceConfig_associated_switch,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSEIPExists("aws_eip.bar", &one),
|
|
|
|
testAccCheckAWSEIPAttributes(&one),
|
|
|
|
testAccCheckAWSEIPAssociated(&one),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2014-07-14 23:59:08 +02:00
|
|
|
func testAccCheckAWSEIPDestroy(s *terraform.State) error {
|
2015-04-16 22:05:55 +02:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2014-09-17 02:44:42 +02:00
|
|
|
for _, rs := range s.RootModule().Resources {
|
2014-07-14 23:59:08 +02:00
|
|
|
if rs.Type != "aws_eip" {
|
|
|
|
continue
|
2014-07-15 00:30:31 +02:00
|
|
|
}
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2015-12-22 14:34:06 +01:00
|
|
|
if strings.Contains(rs.Primary.ID, "eipalloc") {
|
|
|
|
req := &ec2.DescribeAddressesInput{
|
|
|
|
AllocationIds: []*string{aws.String(rs.Primary.ID)},
|
|
|
|
}
|
|
|
|
describe, err := conn.DescribeAddresses(req)
|
|
|
|
if err != nil {
|
|
|
|
// Verify the error is what we want
|
|
|
|
if ae, ok := err.(awserr.Error); ok && ae.Code() == "InvalidAllocationID.NotFound" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
return err
|
2014-07-14 23:59:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-22 14:34:06 +01:00
|
|
|
if len(describe.Addresses) > 0 {
|
|
|
|
return fmt.Errorf("still exists")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
req := &ec2.DescribeAddressesInput{
|
|
|
|
PublicIps: []*string{aws.String(rs.Primary.ID)},
|
|
|
|
}
|
|
|
|
describe, err := conn.DescribeAddresses(req)
|
|
|
|
if err != nil {
|
|
|
|
// Verify the error is what we want
|
|
|
|
if ae, ok := err.(awserr.Error); ok && ae.Code() == "InvalidAllocationID.NotFound" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
2014-07-15 00:30:31 +02:00
|
|
|
|
2015-12-22 14:34:06 +01:00
|
|
|
if len(describe.Addresses) > 0 {
|
|
|
|
return fmt.Errorf("still exists")
|
|
|
|
}
|
2014-07-14 23:59:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func testAccCheckAWSEIPAttributes(conf *ec2.Address) resource.TestCheckFunc {
|
|
|
|
return func(s *terraform.State) error {
|
2015-08-17 20:27:16 +02:00
|
|
|
if *conf.PublicIp == "" {
|
2014-07-14 23:59:08 +02:00
|
|
|
return fmt.Errorf("empty public_ip")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-26 04:30:37 +02:00
|
|
|
func testAccCheckAWSEIPAssociated(conf *ec2.Address) resource.TestCheckFunc {
|
|
|
|
return func(s *terraform.State) error {
|
2016-04-07 19:15:00 +02:00
|
|
|
if conf.AssociationId == nil || *conf.AssociationId == "" {
|
2015-04-26 04:30:37 +02:00
|
|
|
return fmt.Errorf("empty association_id")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-15 00:30:31 +02:00
|
|
|
func testAccCheckAWSEIPExists(n string, res *ec2.Address) resource.TestCheckFunc {
|
2014-07-14 23:59:08 +02:00
|
|
|
return func(s *terraform.State) error {
|
2014-09-17 02:44:42 +02:00
|
|
|
rs, ok := s.RootModule().Resources[n]
|
2014-07-14 23:59:08 +02:00
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("Not found: %s", n)
|
|
|
|
}
|
|
|
|
|
2014-09-17 02:44:42 +02:00
|
|
|
if rs.Primary.ID == "" {
|
2014-07-14 23:59:08 +02:00
|
|
|
return fmt.Errorf("No EIP ID is set")
|
|
|
|
}
|
|
|
|
|
2015-04-16 22:05:55 +02:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2014-09-17 02:44:42 +02:00
|
|
|
if strings.Contains(rs.Primary.ID, "eipalloc") {
|
2015-04-07 17:37:17 +02:00
|
|
|
req := &ec2.DescribeAddressesInput{
|
2015-08-17 20:27:16 +02:00
|
|
|
AllocationIds: []*string{aws.String(rs.Primary.ID)},
|
2015-03-03 18:45:27 +01:00
|
|
|
}
|
|
|
|
describe, err := conn.DescribeAddresses(req)
|
2014-07-28 18:04:58 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2014-07-28 18:04:58 +02:00
|
|
|
if len(describe.Addresses) != 1 ||
|
2015-08-17 20:27:16 +02:00
|
|
|
*describe.Addresses[0].AllocationId != rs.Primary.ID {
|
2014-07-28 18:04:58 +02:00
|
|
|
return fmt.Errorf("EIP not found")
|
|
|
|
}
|
2015-04-07 17:37:17 +02:00
|
|
|
*res = *describe.Addresses[0]
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2014-07-28 18:04:58 +02:00
|
|
|
} else {
|
2015-04-07 17:37:17 +02:00
|
|
|
req := &ec2.DescribeAddressesInput{
|
2015-08-17 20:27:16 +02:00
|
|
|
PublicIps: []*string{aws.String(rs.Primary.ID)},
|
2015-03-03 18:45:27 +01:00
|
|
|
}
|
|
|
|
describe, err := conn.DescribeAddresses(req)
|
2014-07-28 18:04:58 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2014-07-14 23:59:08 +02:00
|
|
|
|
2014-07-28 18:04:58 +02:00
|
|
|
if len(describe.Addresses) != 1 ||
|
2015-08-17 20:27:16 +02:00
|
|
|
*describe.Addresses[0].PublicIp != rs.Primary.ID {
|
2014-07-28 18:04:58 +02:00
|
|
|
return fmt.Errorf("EIP not found")
|
|
|
|
}
|
2015-04-07 17:37:17 +02:00
|
|
|
*res = *describe.Addresses[0]
|
2014-07-28 18:04:58 +02:00
|
|
|
}
|
2014-07-14 23:59:08 +02:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const testAccAWSEIPConfig = `
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
}
|
|
|
|
`
|
2014-07-27 00:53:26 +02:00
|
|
|
|
|
|
|
const testAccAWSEIPInstanceConfig = `
|
|
|
|
resource "aws_instance" "foo" {
|
|
|
|
# us-west-2
|
|
|
|
ami = "ami-4fccb37f"
|
|
|
|
instance_type = "m1.small"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
instance = "${aws_instance.foo.id}"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccAWSEIPInstanceConfig2 = `
|
|
|
|
resource "aws_instance" "bar" {
|
|
|
|
# us-west-2
|
|
|
|
ami = "ami-4fccb37f"
|
|
|
|
instance_type = "m1.small"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
instance = "${aws_instance.bar.id}"
|
|
|
|
}
|
|
|
|
`
|
2016-04-07 19:15:00 +02:00
|
|
|
|
2016-05-06 22:38:39 +02:00
|
|
|
const testAccAWSEIPInstanceConfig_associated = `
|
|
|
|
resource "aws_vpc" "default" {
|
|
|
|
cidr_block = "10.0.0.0/16"
|
|
|
|
enable_dns_hostnames = true
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_internet_gateway" "gw" {
|
|
|
|
vpc_id = "${aws_vpc.default.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "main"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_subnet" "tf_test_subnet" {
|
|
|
|
vpc_id = "${aws_vpc.default.id}"
|
|
|
|
cidr_block = "10.0.0.0/24"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
|
|
|
|
depends_on = ["aws_internet_gateway.gw"]
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "tf_test_subnet"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "foo" {
|
|
|
|
# us-west-2
|
|
|
|
ami = "ami-5189a661"
|
|
|
|
instance_type = "t2.micro"
|
|
|
|
|
|
|
|
private_ip = "10.0.0.12"
|
|
|
|
subnet_id = "${aws_subnet.tf_test_subnet.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "foo instance"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "bar" {
|
|
|
|
# us-west-2
|
|
|
|
|
|
|
|
ami = "ami-5189a661"
|
|
|
|
|
|
|
|
instance_type = "t2.micro"
|
|
|
|
|
|
|
|
private_ip = "10.0.0.19"
|
|
|
|
subnet_id = "${aws_subnet.tf_test_subnet.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "bar instance"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
vpc = true
|
|
|
|
|
|
|
|
instance = "${aws_instance.bar.id}"
|
|
|
|
associate_with_private_ip = "10.0.0.19"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
const testAccAWSEIPInstanceConfig_associated_switch = `
|
|
|
|
resource "aws_vpc" "default" {
|
|
|
|
cidr_block = "10.0.0.0/16"
|
|
|
|
enable_dns_hostnames = true
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_internet_gateway" "gw" {
|
|
|
|
vpc_id = "${aws_vpc.default.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "main"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_subnet" "tf_test_subnet" {
|
|
|
|
vpc_id = "${aws_vpc.default.id}"
|
|
|
|
cidr_block = "10.0.0.0/24"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
|
|
|
|
depends_on = ["aws_internet_gateway.gw"]
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "tf_test_subnet"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "foo" {
|
|
|
|
# us-west-2
|
|
|
|
ami = "ami-5189a661"
|
|
|
|
instance_type = "t2.micro"
|
|
|
|
|
|
|
|
private_ip = "10.0.0.12"
|
|
|
|
subnet_id = "${aws_subnet.tf_test_subnet.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "foo instance"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "bar" {
|
|
|
|
# us-west-2
|
|
|
|
|
|
|
|
ami = "ami-5189a661"
|
|
|
|
|
|
|
|
instance_type = "t2.micro"
|
|
|
|
|
|
|
|
private_ip = "10.0.0.19"
|
|
|
|
subnet_id = "${aws_subnet.tf_test_subnet.id}"
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "bar instance"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
vpc = true
|
|
|
|
|
|
|
|
instance = "${aws_instance.foo.id}"
|
|
|
|
associate_with_private_ip = "10.0.0.12"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccAWSEIPInstanceConfig_associated_update = `
|
|
|
|
resource "aws_instance" "bar" {
|
|
|
|
# us-west-2
|
|
|
|
ami = "ami-4fccb37f"
|
|
|
|
instance_type = "m1.small"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
instance = "${aws_instance.bar.id}"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2015-04-26 04:30:37 +02:00
|
|
|
const testAccAWSEIPNetworkInterfaceConfig = `
|
|
|
|
resource "aws_vpc" "bar" {
|
|
|
|
cidr_block = "10.0.0.0/24"
|
|
|
|
}
|
|
|
|
resource "aws_internet_gateway" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
availability_zone = "us-west-2a"
|
|
|
|
cidr_block = "10.0.0.0/24"
|
|
|
|
}
|
|
|
|
resource "aws_network_interface" "bar" {
|
|
|
|
subnet_id = "${aws_subnet.bar.id}"
|
|
|
|
private_ips = ["10.0.0.10"]
|
|
|
|
security_groups = [ "${aws_vpc.bar.default_security_group_id}" ]
|
|
|
|
}
|
|
|
|
resource "aws_eip" "bar" {
|
|
|
|
vpc = "true"
|
|
|
|
network_interface = "${aws_network_interface.bar.id}"
|
|
|
|
}
|
|
|
|
`
|
2016-04-07 19:15:00 +02:00
|
|
|
|
|
|
|
const testAccAWSEIPMultiNetworkInterfaceConfig = `
|
|
|
|
resource "aws_vpc" "bar" {
|
2016-05-06 22:38:39 +02:00
|
|
|
cidr_block = "10.0.0.0/24"
|
2016-04-07 19:15:00 +02:00
|
|
|
}
|
2016-05-06 22:38:39 +02:00
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
resource "aws_internet_gateway" "bar" {
|
2016-05-06 22:38:39 +02:00
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
2016-04-07 19:15:00 +02:00
|
|
|
}
|
2016-05-06 22:38:39 +02:00
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
resource "aws_subnet" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
availability_zone = "us-west-2a"
|
|
|
|
cidr_block = "10.0.0.0/24"
|
|
|
|
}
|
2016-05-06 22:38:39 +02:00
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
resource "aws_network_interface" "bar" {
|
|
|
|
subnet_id = "${aws_subnet.bar.id}"
|
2016-05-06 22:38:39 +02:00
|
|
|
private_ips = ["10.0.0.10", "10.0.0.11"]
|
|
|
|
security_groups = ["${aws_vpc.bar.default_security_group_id}"]
|
2016-04-07 19:15:00 +02:00
|
|
|
}
|
2016-05-06 22:38:39 +02:00
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
resource "aws_eip" "one" {
|
2016-05-06 22:38:39 +02:00
|
|
|
vpc = "true"
|
|
|
|
network_interface = "${aws_network_interface.bar.id}"
|
|
|
|
associate_with_private_ip = "10.0.0.10"
|
2016-04-07 19:15:00 +02:00
|
|
|
}
|
2016-05-06 22:38:39 +02:00
|
|
|
|
2016-04-07 19:15:00 +02:00
|
|
|
resource "aws_eip" "two" {
|
2016-05-06 22:38:39 +02:00
|
|
|
vpc = "true"
|
|
|
|
network_interface = "${aws_network_interface.bar.id}"
|
|
|
|
associate_with_private_ip = "10.0.0.11"
|
2016-04-07 19:15:00 +02:00
|
|
|
}
|
|
|
|
`
|