From df3ca4772a47467633ba58b6c72a18d1033a8266 Mon Sep 17 00:00:00 2001 From: "Adam R. Wilczek" Date: Wed, 5 Jun 2019 13:44:43 -0500 Subject: [PATCH 01/10] adding the ability to specify an explicit address from the byoip pool for eips. --- aws/resource_aws_eip.go | 14 +++- aws/resource_aws_eip_test.go | 113 ++++++++++++++++++++++++++++++- website/docs/r/eip.html.markdown | 6 ++ 3 files changed, 131 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_eip.go b/aws/resource_aws_eip.go index f03993b09c35..a9527a82a58a 100644 --- a/aws/resource_aws_eip.go +++ b/aws/resource_aws_eip.go @@ -99,6 +99,11 @@ func resourceAwsEip() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "address": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, "carrier_ip": { Type: schema.TypeString, @@ -158,7 +163,14 @@ func resourceAwsEipCreate(d *schema.ResourceData, meta interface{}) error { allocOpts.TagSpecifications = ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeElasticIp) } - if v, ok := d.GetOk("public_ipv4_pool"); ok { + // address if exists + addressV, addressOK := d.GetOk("address") + + if addressOK && domainOpt == ec2.DomainTypeVpc { + // If we are in a VPC and have assigned an address: add it. + allocOpts.Address = aws.String(addressV.(string)) + } else if v, ok := d.GetOk("public_ipv4_pool"); ok { + // If we have not assigned an address but have assigned a public_ipv4_pool: add it allocOpts.PublicIpv4Pool = aws.String(v.(string)) } diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index 78c78b3184cf..ce76022abc4b 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -660,6 +660,92 @@ func TestAccAWSEIP_carrierIP(t *testing.T) { }) } +func TestAccAWSEIP_BYOIPAddress_default(t *testing.T) { + // Test case address not set + var conf ec2.Address + resourceName := "aws_eip.bar" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: resourceName, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEIPDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEIPConfig_BYOIPAddress_custom_default, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPAttributes(&conf), + ), + }, + }, + }) +} + +func TestAccAWSEIP_BYOIPAddress_custom(t *testing.T) { + // Test Case for address being set + + if os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") == "" { + t.Skip("Environment variable AWS_EC2_EIP_BYOIP_ADDRESS is not set") + } + + var conf ec2.Address + resourceName := "aws_eip.bar" + + address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: resourceName, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEIPDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEIPConfig_BYOIPAddress_custom(address), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPAttributes(&conf), + resource.TestCheckResourceAttr(resourceName, "public_ip", address), + ), + }, + }, + }) +} + +func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { + // Test Case for both address and public_ipv4_pool being set + if os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") == "" { + t.Skip("Environment variable AWS_EC2_EIP_BYOIP_ADDRESS is not set") + } + + if os.Getenv("AWS_EC2_EIP_PUBLIC_IPV4_POOL") == "" { + t.Skip("Environment variable AWS_EC2_EIP_PUBLIC_IPV4_POOL is not set") + } + + var conf ec2.Address + resourceName := "aws_eip.bar" + + address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") + poolName := os.Getenv("AWS_EC2_EIP_PUBLIC_IPV4_POOL") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: resourceName, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEIPDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address, poolName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPAttributes(&conf), + resource.TestCheckResourceAttr(resourceName, "public_ip", address), + ), + }, + }, + }) +} + func testAccCheckAWSEIPDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ec2conn @@ -929,7 +1015,32 @@ resource "aws_eip" "test" { `) } -func testAccEIPInstanceConfig() string { +const testAccAWSEIPConfig_BYOIPAddress_custom_default = ` +resource "aws_eip" "bar" { + vpc = true +} +` + +func testAccAWSEIPConfig_BYOIPAddress_custom(address string) string { + return fmt.Sprintf(` +resource "aws_eip" "bar" { + vpc = true + address = "%s" +} +`, address) +} + +func testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address string, poolname string) string { + return fmt.Sprintf(` +resource "aws_eip" "bar" { + vpc = true + address = "%s" + public_ipv4_pool = %s +} +`, address, poolname) +} + +func testAccAWSEIPInstanceConfig() string { return composeConfig( testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.test.availability_zone", "t3.micro", "t2.micro"), diff --git a/website/docs/r/eip.html.markdown b/website/docs/r/eip.html.markdown index 28a5f5d30927..7e6188879414 100644 --- a/website/docs/r/eip.html.markdown +++ b/website/docs/r/eip.html.markdown @@ -97,10 +97,13 @@ resource "aws_eip" "byoip-ip" { The following arguments are supported: +* `address` - (Optional) IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs. * `associate_with_private_ip` - (Optional) User-specified primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address. * `customer_owned_ipv4_pool` - (Optional) ID of a customer-owned address pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing). +* `customer_owned_ipv4_pool` - The ID of a customer-owned address pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) * `instance` - (Optional) EC2 instance ID. * `network_border_group` - (Optional) Location from which the IP address is advertised. Use this parameter to limit the address to this location. +* `network_border_group` - The location from which the IP address is advertised. Use this parameter to limit the address to this location. * `network_interface` - (Optional) Network interface ID to associate with. * `public_ipv4_pool` - (Optional) EC2 IPv4 address pool identifier or `amazon`. This option is only available for VPC EIPs. * `tags` - (Optional) Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. @@ -108,6 +111,9 @@ The following arguments are supported: ~> **NOTE:** You can specify either the `instance` ID or the `network_interface` ID, but not both. Including both will **not** return an error from the AWS API, but will have undefined behavior. See the relevant [AssociateAddress API Call][1] for more information. +~> **NOTE:** Specifying both `public_ipv4_pool` and `address` won't cause an error but `address` will be used in the +case both options are defined as the api only requires one or the other. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: From 72b9559ef7f146c0066406f5b019bfb8d366cde0 Mon Sep 17 00:00:00 2001 From: "Adam R. Wilczek" Date: Mon, 10 Jun 2019 13:42:46 -0500 Subject: [PATCH 02/10] Fixing BYOIP tests to not be parallel as they use the same IP Address. --- aws/resource_aws_eip_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index ce76022abc4b..ade14702d638 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -694,7 +694,7 @@ func TestAccAWSEIP_BYOIPAddress_custom(t *testing.T) { address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: resourceName, Providers: testAccProviders, @@ -728,7 +728,7 @@ func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") poolName := os.Getenv("AWS_EC2_EIP_PUBLIC_IPV4_POOL") - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: resourceName, Providers: testAccProviders, @@ -740,6 +740,7 @@ func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { testAccCheckAWSEIPExists(resourceName, &conf), testAccCheckAWSEIPAttributes(&conf), resource.TestCheckResourceAttr(resourceName, "public_ip", address), + resource.TestCheckResourceAttr(resourceName, "public_ipv4_pool", poolName), ), }, }, @@ -1034,8 +1035,8 @@ func testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address string, return fmt.Sprintf(` resource "aws_eip" "bar" { vpc = true - address = "%s" - public_ipv4_pool = %s + address = "%[1]s" + public_ipv4_pool = "%[2]s" } `, address, poolname) } From b05bcf3ac6ba7ee951270c108196c91ffbdda679 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 2 Apr 2021 09:12:39 -0400 Subject: [PATCH 03/10] r/eip: Lint cleanup --- aws/resource_aws_eip_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index ade14702d638..70c6b97a7190 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -1018,7 +1018,7 @@ resource "aws_eip" "test" { const testAccAWSEIPConfig_BYOIPAddress_custom_default = ` resource "aws_eip" "bar" { - vpc = true + vpc = true } ` @@ -1026,7 +1026,7 @@ func testAccAWSEIPConfig_BYOIPAddress_custom(address string) string { return fmt.Sprintf(` resource "aws_eip" "bar" { vpc = true - address = "%s" + address = %[1]q } `, address) } @@ -1034,9 +1034,9 @@ resource "aws_eip" "bar" { func testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address string, poolname string) string { return fmt.Sprintf(` resource "aws_eip" "bar" { - vpc = true - address = "%[1]s" - public_ipv4_pool = "%[2]s" + vpc = true + address = %[1]q + public_ipv4_pool = %[2]q } `, address, poolname) } From ae3ea7f25e4eb9edac8fb0c292bd42942752b815 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 15 Apr 2021 13:59:30 -0400 Subject: [PATCH 04/10] r/eip: Add ErrorChecks --- aws/resource_aws_eip_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index 70c6b97a7190..808764c2e5f0 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -667,6 +667,7 @@ func TestAccAWSEIP_BYOIPAddress_default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -696,6 +697,7 @@ func TestAccAWSEIP_BYOIPAddress_custom(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -730,6 +732,7 @@ func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, From 664d80506b6b3fad31f0fbd12b4697efe9206565 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 11:36:47 -0400 Subject: [PATCH 05/10] tests/r/eip: Update config to newer name --- aws/resource_aws_eip_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index 808764c2e5f0..89ee1f94a296 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -156,7 +156,7 @@ func TestAccAWSEIP_Instance(t *testing.T) { CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ { - Config: testAccEIPInstanceConfig(), + Config: testAccAWSEIPInstanceConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEIPExists(resourceName, false, &conf), testAccCheckAWSEIPAttributes(&conf), @@ -675,7 +675,7 @@ func TestAccAWSEIP_BYOIPAddress_default(t *testing.T) { { Config: testAccAWSEIPConfig_BYOIPAddress_custom_default, Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPExists(resourceName, false, &conf), testAccCheckAWSEIPAttributes(&conf), ), }, @@ -705,7 +705,7 @@ func TestAccAWSEIP_BYOIPAddress_custom(t *testing.T) { { Config: testAccAWSEIPConfig_BYOIPAddress_custom(address), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPExists(resourceName, false, &conf), testAccCheckAWSEIPAttributes(&conf), resource.TestCheckResourceAttr(resourceName, "public_ip", address), ), @@ -740,7 +740,7 @@ func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { { Config: testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address, poolName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEIPExists(resourceName, &conf), + testAccCheckAWSEIPExists(resourceName, false, &conf), testAccCheckAWSEIPAttributes(&conf), resource.TestCheckResourceAttr(resourceName, "public_ip", address), resource.TestCheckResourceAttr(resourceName, "public_ipv4_pool", poolName), From 07d4a2b4204abffd611713123ba706ff07d86c97 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 12:00:34 -0400 Subject: [PATCH 06/10] r/eip: Sort args --- aws/resource_aws_eip.go | 86 +++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/aws/resource_aws_eip.go b/aws/resource_aws_eip.go index a9527a82a58a..f6cee7362807 100644 --- a/aws/resource_aws_eip.go +++ b/aws/resource_aws_eip.go @@ -41,101 +41,86 @@ func resourceAwsEip() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "vpc": { - Type: schema.TypeBool, + "address": { + Type: schema.TypeString, Optional: true, ForceNew: true, - Computed: true, }, - - "instance": { + "allocation_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, - - "network_interface": { + "associate_with_private_ip": { Type: schema.TypeString, Optional: true, - Computed: true, }, - - "allocation_id": { + "association_id": { Type: schema.TypeString, Computed: true, }, - - "association_id": { + "carrier_ip": { Type: schema.TypeString, Computed: true, }, - - "domain": { + "customer_owned_ip": { Type: schema.TypeString, Computed: true, }, - - "public_ip": { + "customer_owned_ipv4_pool": { Type: schema.TypeString, - Computed: true, + Optional: true, }, - - "public_dns": { + "domain": { Type: schema.TypeString, Computed: true, }, - - "private_ip": { + "instance": { Type: schema.TypeString, + Optional: true, Computed: true, }, - - "private_dns": { + "network_border_group": { Type: schema.TypeString, + Optional: true, Computed: true, + ForceNew: true, }, - - "associate_with_private_ip": { + "network_interface": { Type: schema.TypeString, Optional: true, + Computed: true, }, - "address": { + "private_dns": { Type: schema.TypeString, - Optional: true, - ForceNew: true, + Computed: true, }, - - "carrier_ip": { + "private_ip": { Type: schema.TypeString, Computed: true, }, - - "customer_owned_ipv4_pool": { + "public_dns": { Type: schema.TypeString, - Optional: true, + Computed: true, }, - "customer_owned_ip": { + "public_ip": { Type: schema.TypeString, Computed: true, }, - "public_ipv4_pool": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - - "network_border_group": { - Type: schema.TypeString, + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), + "vpc": { + Type: schema.TypeBool, Optional: true, - Computed: true, ForceNew: true, + Computed: true, }, - - "tags": tagsSchema(), - "tags_all": tagsSchemaComputed(), }, } } @@ -163,14 +148,15 @@ func resourceAwsEipCreate(d *schema.ResourceData, meta interface{}) error { allocOpts.TagSpecifications = ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeElasticIp) } - // address if exists - addressV, addressOK := d.GetOk("address") + if v, ok := d.GetOk("address"); ok { + supportedPlatforms := meta.(*AWSClient).supportedplatforms + if domainOpt != ec2.DomainTypeVpc && len(supportedPlatforms) > 0 && hasEc2Classic(supportedPlatforms) { + return fmt.Errorf("error, address to recover cannot be set for a standard-domain EIP - must be a VPC-domain EIP") + } + allocOpts.Address = aws.String(v.(string)) + } - if addressOK && domainOpt == ec2.DomainTypeVpc { - // If we are in a VPC and have assigned an address: add it. - allocOpts.Address = aws.String(addressV.(string)) - } else if v, ok := d.GetOk("public_ipv4_pool"); ok { - // If we have not assigned an address but have assigned a public_ipv4_pool: add it + if v, ok := d.GetOk("public_ipv4_pool"); ok { allocOpts.PublicIpv4Pool = aws.String(v.(string)) } From 227374f3ab9db0c0bb40d0402e9e84676a62041e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 13:05:04 -0400 Subject: [PATCH 07/10] r/eip: Add changelog --- .changelog/8876.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/8876.txt diff --git a/.changelog/8876.txt b/.changelog/8876.txt new file mode 100644 index 000000000000..a07821ab2ffc --- /dev/null +++ b/.changelog/8876.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_eip: Add `address` argument to recover or an IPv4 address from an address pool, supporting BYOIP +``` \ No newline at end of file From c754cc389767ee9f661e45bf813f27ee9b7dac73 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 13:07:21 -0400 Subject: [PATCH 08/10] tests/r/eip: Make consistent --- aws/resource_aws_eip_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index 89ee1f94a296..761b003d411d 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -663,7 +663,7 @@ func TestAccAWSEIP_carrierIP(t *testing.T) { func TestAccAWSEIP_BYOIPAddress_default(t *testing.T) { // Test case address not set var conf ec2.Address - resourceName := "aws_eip.bar" + resourceName := "aws_eip.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -691,7 +691,7 @@ func TestAccAWSEIP_BYOIPAddress_custom(t *testing.T) { } var conf ec2.Address - resourceName := "aws_eip.bar" + resourceName := "aws_eip.test" address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") @@ -725,7 +725,7 @@ func TestAccAWSEIP_BYOIPAddress_custom_with_PublicIpv4Pool(t *testing.T) { } var conf ec2.Address - resourceName := "aws_eip.bar" + resourceName := "aws_eip.test" address := os.Getenv("AWS_EC2_EIP_BYOIP_ADDRESS") poolName := os.Getenv("AWS_EC2_EIP_PUBLIC_IPV4_POOL") @@ -997,7 +997,7 @@ func testAccEIPPublicIPv4PoolCustomConfig(poolName string) string { return fmt.Sprintf(` resource "aws_eip" "test" { vpc = true - public_ipv4_pool = "%s" + public_ipv4_pool = %[1]q } `, poolName) } @@ -1020,14 +1020,14 @@ resource "aws_eip" "test" { } const testAccAWSEIPConfig_BYOIPAddress_custom_default = ` -resource "aws_eip" "bar" { +resource "aws_eip" "test" { vpc = true } ` func testAccAWSEIPConfig_BYOIPAddress_custom(address string) string { return fmt.Sprintf(` -resource "aws_eip" "bar" { +resource "aws_eip" "test" { vpc = true address = %[1]q } @@ -1036,7 +1036,7 @@ resource "aws_eip" "bar" { func testAccAWSEIPConfig_BYOIPAddress_custom_with_PublicIpv4Pool(address string, poolname string) string { return fmt.Sprintf(` -resource "aws_eip" "bar" { +resource "aws_eip" "test" { vpc = true address = %[1]q public_ipv4_pool = %[2]q From 32162ecf1b9d2de2f42c13c089a2feaa1581d082 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 13:08:36 -0400 Subject: [PATCH 09/10] docs/r/eip: Remove duplicate docs --- website/docs/r/eip.html.markdown | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/docs/r/eip.html.markdown b/website/docs/r/eip.html.markdown index 7e6188879414..ce3ab474a846 100644 --- a/website/docs/r/eip.html.markdown +++ b/website/docs/r/eip.html.markdown @@ -100,10 +100,8 @@ The following arguments are supported: * `address` - (Optional) IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs. * `associate_with_private_ip` - (Optional) User-specified primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address. * `customer_owned_ipv4_pool` - (Optional) ID of a customer-owned address pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing). -* `customer_owned_ipv4_pool` - The ID of a customer-owned address pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) * `instance` - (Optional) EC2 instance ID. * `network_border_group` - (Optional) Location from which the IP address is advertised. Use this parameter to limit the address to this location. -* `network_border_group` - The location from which the IP address is advertised. Use this parameter to limit the address to this location. * `network_interface` - (Optional) Network interface ID to associate with. * `public_ipv4_pool` - (Optional) EC2 IPv4 address pool identifier or `amazon`. This option is only available for VPC EIPs. * `tags` - (Optional) Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From cc300ad1df0e62d467f3814a15110328311bce45 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 28 Apr 2021 13:09:56 -0400 Subject: [PATCH 10/10] docs/r/eip: Clean up docs --- website/docs/r/eip.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/eip.html.markdown b/website/docs/r/eip.html.markdown index ce3ab474a846..88bbab6f5db2 100644 --- a/website/docs/r/eip.html.markdown +++ b/website/docs/r/eip.html.markdown @@ -16,7 +16,7 @@ Provides an Elastic IP resource. ## Example Usage -Single EIP associated with an instance: +### Single EIP associated with an instance ```terraform resource "aws_eip" "lb" { @@ -25,7 +25,7 @@ resource "aws_eip" "lb" { } ``` -Multiple EIPs associated with a single network interface: +### Multiple EIPs associated with a single network interface ```terraform resource "aws_network_interface" "multi-ip" { @@ -46,7 +46,7 @@ resource "aws_eip" "two" { } ``` -Attaching an EIP to an Instance with a pre-assigned private ip (VPC Only): +### Attaching an EIP to an Instance with a pre-assigned private ip (VPC Only) ```terraform resource "aws_vpc" "default" { @@ -84,7 +84,7 @@ resource "aws_eip" "bar" { } ``` -Allocating EIP from the BYOIP pool: +### Allocating EIP from the BYOIP pool ```terraform resource "aws_eip" "byoip-ip" {