Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d/aws_network_interface: AWS Wavelength support #16723

Prev Previous commit
Next Next commit
Fix linter errors.
  • Loading branch information
ewbankkit committed Dec 15, 2020
commit 2e3214437f94314da23f7e241cb0a7300fee3a40
46 changes: 38 additions & 8 deletions aws/data_source_aws_network_interface_test.go
Original file line number Diff line number Diff line change
@@ -122,8 +122,7 @@ func TestAccDataSourceAwsNetworkInterface_EIPAssociation(t *testing.T) {
resource.TestCheckResourceAttrPair(datasourceName, "association.0.association_id", eipAssociationResourceName, "id"),
resource.TestCheckResourceAttr(datasourceName, "association.0.carrier_ip", ""),
testAccCheckResourceAttrAccountID(datasourceName, "association.0.ip_owner_id"),
// EIP does not really get a public DNS name until it's associated with an instance.
//resource.TestCheckResourceAttrPair(datasourceName, "association.0.public_dns_name", eipResourceName, "public_dns"),
// Public DNS name is not set by the EC2 API.
resource.TestCheckResourceAttr(datasourceName, "association.0.public_dns_name", ""),
resource.TestCheckResourceAttrPair(datasourceName, "association.0.public_ip", eipResourceName, "public_ip"),
resource.TestCheckResourceAttr(datasourceName, "attachment.#", "0"),
@@ -150,7 +149,9 @@ func TestAccDataSourceAwsNetworkInterface_EIPAssociation(t *testing.T) {
}

func testAccDataSourceAwsNetworkInterfaceConfigBase(rName string) string {
return fmt.Sprintf(`
return composeConfig(
testAccAvailableAZsNoOptInConfig(),
fmt.Sprintf(`
resource "aws_vpc" "test" {
cidr_block = "10.0.0.0/16"

@@ -183,12 +184,11 @@ resource "aws_network_interface" "test" {
Name = %[1]q
}
}
`, rName)
`, rName))
}

func testAccDataSourceAwsNetworkInterfaceConfigBasic(rName string) string {
return composeConfig(
testAccAvailableAZsNoOptInConfig(),
testAccDataSourceAwsNetworkInterfaceConfigBase(rName),
`
data "aws_network_interface" "test" {
@@ -200,8 +200,40 @@ data "aws_network_interface" "test" {
func testAccDataSourceAwsNetworkInterfaceConfigCarrierIPAssociation(rName string) string {
return composeConfig(
testAccAvailableAZsWavelengthZonesDefaultExcludeConfig(),
testAccDataSourceAwsNetworkInterfaceConfigBase(rName),
fmt.Sprintf(`
resource "aws_vpc" "test" {
cidr_block = "10.0.0.0/16"

tags = {
Name = %[1]q
}
}

resource "aws_subnet" "test" {
cidr_block = "10.0.0.0/24"
availability_zone = data.aws_availability_zones.available.names[0]
vpc_id = aws_vpc.test.id

tags = {
Name = %[1]q
}
}

resource "aws_security_group" "test" {
name = %[1]q
vpc_id = aws_vpc.test.id
}

resource "aws_network_interface" "test" {
subnet_id = aws_subnet.test.id
private_ips = ["10.0.0.50"]
security_groups = [aws_security_group.test.id]

tags = {
Name = %[1]q
}
}

resource "aws_ec2_carrier_gateway" "test" {
vpc_id = aws_vpc.test.id

@@ -236,7 +268,6 @@ data "aws_network_interface" "test" {

func testAccDataSourceAwsNetworkInterfaceConfigEIPAssociation(rName string) string {
return composeConfig(
testAccAvailableAZsNoOptInConfig(),
testAccDataSourceAwsNetworkInterfaceConfigBase(rName),
fmt.Sprintf(`
resource "aws_internet_gateway" "test" {
@@ -268,7 +299,6 @@ data "aws_network_interface" "test" {

func testAccDataSourceAwsNetworkInterfaceConfigFilters(rName string) string {
return composeConfig(
testAccAvailableAZsNoOptInConfig(),
testAccDataSourceAwsNetworkInterfaceConfigBase(rName),
`
data "aws_network_interface" "test" {