Skip to content

Commit

Permalink
Contribution guideline changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Houghton committed Oct 28, 2020
1 parent 5793f2e commit a3b3aa2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
6 changes: 3 additions & 3 deletions aws/data_source_aws_route53_resolver_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/route53resolver"

"github.com/aws/aws-sdk-go/aws"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceAwsRoute53ResolverEndpoint() *schema.Resource {
Expand Down Expand Up @@ -92,11 +92,11 @@ func dataSourceAwsRoute53ResolverEndpointRead(d *schema.ResourceData, meta inter
}

if len(resp.ResolverEndpoints) == 0 && filtersOk {
return fmt.Errorf("Your query returned no results. Please change your search criteria and try again.")
return fmt.Errorf("Your query returned no results. Please change your search criteria and try again")
}

if len(resp.ResolverEndpoints) > 1 && !rIDOk {
return fmt.Errorf("Your query returned more than one resolver. Please change your search criteria and try again.")
return fmt.Errorf("your query returned more than one resolver. Please change your search criteria and try again")
}

if rIDOk {
Expand Down
60 changes: 31 additions & 29 deletions aws/data_source_aws_route53_resolver_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"regexp"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDataSourceAwsRoute53ResolverEndpoint_Basic(t *testing.T) {
Expand All @@ -22,7 +22,7 @@ func TestAccDataSourceAwsRoute53ResolverEndpoint_Basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccDataSourceAwsRoute53ResolverEndpointConfig_NonExistent,
ExpectError: regexp.MustCompile("The ID provided could not be found"),
ExpectError: regexp.MustCompile(`The ID provided could not be found`),
},
{
Config: testAccDataSourceRoute53ResolverEndpointConfig_initial(rInt, direction, name),
Expand All @@ -49,7 +49,7 @@ func TestAccDataSourceAwsRoute53ResolverEndpoint_Filter(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccDataSourceAwsRoute53ResolverEndpointConfig_NonExistentFilter,
ExpectError: regexp.MustCompile("Your query returned no results. Please change your search criteria and try again."),
ExpectError: regexp.MustCompile("Your query returned no results. Please change your search criteria and try again"),
},
{
Config: testAccDataSourceRoute53ResolverEndpointConfig_filter(rInt, direction, name),
Expand Down Expand Up @@ -78,38 +78,38 @@ resource "aws_vpc" "foo" {
data "aws_availability_zones" "available" {}
resource "aws_subnet" "sn1" {
vpc_id = "${aws_vpc.foo.id}"
cidr_block = "${cidrsubnet(aws_vpc.foo.cidr_block, 2, 0)}"
availability_zone = "${data.aws_availability_zones.available.names[0]}"
vpc_id = aws_vpc.foo.id
cidr_block = cidrsubnet(aws_vpc.foo.cidr_block, 2, 0)
availability_zone = data.aws_availability_zones.available.names[0]
tags = {
Name = "tf-acc-r53-resolver-sn1-%d"
}
}
resource "aws_subnet" "sn2" {
vpc_id = "${aws_vpc.foo.id}"
vpc_id = aws_vpc.foo.id
cidr_block = "${cidrsubnet(aws_vpc.foo.cidr_block, 2, 1)}"
availability_zone = "${data.aws_availability_zones.available.names[1]}"
cidr_block = cidrsubnet(aws_vpc.foo.cidr_block, 2, 1)
availability_zone = data.aws_availability_zones.available.names[1]
tags = {
Name = "tf-acc-r53-resolver-sn2-%d"
}
}
resource "aws_subnet" "sn3" {
vpc_id = "${aws_vpc.foo.id}"
cidr_block = "${cidrsubnet(aws_vpc.foo.cidr_block, 2, 2)}"
availability_zone = "${data.aws_availability_zones.available.names[2]}"
vpc_id = aws_vpc.foo.id
cidr_block = cidrsubnet(aws_vpc.foo.cidr_block, 2, 2)
availability_zone = data.aws_availability_zones.available.names[2]
tags = {
Name = "tf-acc-r53-resolver-sn3-%d"
}
}
resource "aws_security_group" "sg1" {
vpc_id = "${aws_vpc.foo.id}"
vpc_id = aws_vpc.foo.id
name = "tf-acc-r53-resolver-sg1-%d"
tags = {
Expand All @@ -118,7 +118,7 @@ resource "aws_security_group" "sg1" {
}
resource "aws_security_group" "sg2" {
vpc_id = "${aws_vpc.foo.id}"
vpc_id = aws_vpc.foo.id
name = "tf-acc-r53-resolver-sg2-%d"
tags = {
Expand All @@ -137,17 +137,17 @@ resource "aws_route53_resolver_endpoint" "foo" {
name = "%s"
security_group_ids = [
"${aws_security_group.sg1.id}",
"${aws_security_group.sg2.id}",
aws_security_group.sg1.id,
aws_security_group.sg2.id,
]
ip_address {
subnet_id = "${aws_subnet.sn1.id}"
subnet_id = aws_subnet.sn1.id
}
ip_address {
subnet_id = "${aws_subnet.sn2.id}"
ip = "${cidrhost(aws_subnet.sn2.cidr_block, 8)}"
subnet_id = aws_subnet.sn2.id
ip = cidrhost(aws_subnet.sn2.cidr_block, 8)
}
tags = {
Expand All @@ -157,7 +157,7 @@ resource "aws_route53_resolver_endpoint" "foo" {
}
data "aws_route53_resolver_endpoint" "foo" {
id = "${aws_route53_resolver_endpoint.foo.id}"
id = aws_route53_resolver_endpoint.foo.id
}
`, testAccDataSourceRoute53ResolverEndpointConfig_base(rInt), direction, name)
}
Expand All @@ -171,17 +171,17 @@ resource "aws_route53_resolver_endpoint" "foo" {
name = "%s"
security_group_ids = [
"${aws_security_group.sg1.id}",
"${aws_security_group.sg2.id}",
aws_security_group.sg1.id,
aws_security_group.sg2.id,
]
ip_address {
subnet_id = "${aws_subnet.sn1.id}"
subnet_id = aws_subnet.sn1.id
}
ip_address {
subnet_id = "${aws_subnet.sn2.id}"
ip = "${cidrhost(aws_subnet.sn2.cidr_block, 8)}"
subnet_id = aws_subnet.sn2.id
ip = cidrhost(aws_subnet.sn2.cidr_block, 8)
}
tags = {
Expand All @@ -192,9 +192,11 @@ resource "aws_route53_resolver_endpoint" "foo" {
data "aws_route53_resolver_endpoint" "foo" {
filter {
name = "NAME"
values = ["${aws_route53_resolver_endpoint.foo.name}"]
name = "Name"
values = [aws_route53_resolver_endpoint.foo.name]
}
depends_on = [aws_route53_resolver_endpoint.foo]
}
`, testAccDataSourceRoute53ResolverEndpointConfig_base(rInt), direction, name)
}
Expand All @@ -208,7 +210,7 @@ data "aws_route53_resolver_endpoint" "foo" {
const testAccDataSourceAwsRoute53ResolverEndpointConfig_NonExistentFilter = `
data "aws_route53_resolver_endpoint" "foo" {
filter {
name = "NAME"
name = "Name"
values = ["None-Existent-Resource"]
}
}
Expand Down

0 comments on commit a3b3aa2

Please sign in to comment.