-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
DNS resolution for inter-region vpc peering #7627
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ var testAccProvidersWithTLS map[string]terraform.ResourceProvider | |
var testAccProviderFactories func(providers *[]*schema.Provider) map[string]terraform.ResourceProviderFactory | ||
var testAccProvider *schema.Provider | ||
var testAccTemplateProvider *schema.Provider | ||
var testAccProviderFunc func() *schema.Provider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can also be used in other cross-region acceptance tests: $ grep 'return testAccProvider' *.go
provider_test.go: testAccProviderFunc = func() *schema.Provider { return testAccProvider }
resource_aws_docdb_cluster_test.go: return testAccCheckDocDBClusterExistsWithProvider(n, v, func() *schema.Provider { return testAccProvider })
resource_aws_instance_test.go: return testAccCheckInstanceExistsWithProvider(n, i, func() *schema.Provider { return testAccProvider })
resource_aws_neptune_cluster_test.go: return testAccCheckAWSNeptuneClusterExistsWithProvider(n, v, func() *schema.Provider { return testAccProvider })
resource_aws_rds_cluster_test.go: return testAccCheckAWSClusterExistsWithProvider(n, v, func() *schema.Provider { return testAccProvider })
resource_aws_route53_zone_association_test.go: return testAccCheckRoute53ZoneAssociationExistsWithProvider(n, zone, func() *schema.Provider { return testAccProvider })
resource_aws_route53_zone_test.go: return testAccCreateRandomRoute53RecordsInZoneIdWithProvider(func() *schema.Provider { return testAccProvider }, zone, recordsCount)
resource_aws_route53_zone_test.go: return testAccCheckRoute53ZoneExistsWithProvider(n, zone, func() *schema.Provider { return testAccProvider })
resource_aws_s3_bucket_test.go: return testAccCheckAWSS3BucketExistsWithProvider(n, func() *schema.Provider { return testAccProvider }) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a Tech Debt issue to tidy these up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe many of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed the merge conflict with the removal of the template provider on merge. |
||
|
||
func init() { | ||
testAccProvider = Provider().(*schema.Provider) | ||
|
@@ -53,6 +54,8 @@ func init() { | |
for k, v := range testAccProviders { | ||
testAccProvidersWithTLS[k] = v | ||
} | ||
|
||
testAccProviderFunc = func() *schema.Provider { return testAccProvider } | ||
} | ||
|
||
func TestProvider(t *testing.T) { | ||
|
@@ -191,6 +194,14 @@ func testAccGetRegion() string { | |
return v | ||
} | ||
|
||
func testAccGetAlternateRegion() string { | ||
v := os.Getenv("AWS_ALTERNATE_REGION") | ||
if v == "" { | ||
return "us-east-1" | ||
} | ||
return v | ||
} | ||
|
||
func testAccGetPartition() string { | ||
if partition, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), testAccGetRegion()); ok { | ||
return partition.ID() | ||
|
@@ -208,6 +219,12 @@ func testAccAlternateAccountPreCheck(t *testing.T) { | |
} | ||
} | ||
|
||
func testAccAlternateRegionPreCheck(t *testing.T) { | ||
if testAccGetRegion() == testAccGetAlternateRegion() { | ||
t.Fatal("AWS_DEFAULT_REGION and AWS_ALTERNATE_REGION must be set to different values for acceptance tests") | ||
} | ||
} | ||
|
||
func testAccEC2ClassicPreCheck(t *testing.T) { | ||
client := testAccProvider.Meta().(*AWSClient) | ||
platforms := client.supportedplatforms | ||
|
@@ -258,6 +275,27 @@ provider "aws" { | |
`, os.Getenv("AWS_ALTERNATE_ACCESS_KEY_ID"), os.Getenv("AWS_ALTERNATE_PROFILE"), os.Getenv("AWS_ALTERNATE_SECRET_ACCESS_KEY")) | ||
} | ||
|
||
func testAccAlternateAccountAlternateRegionProviderConfig() string { | ||
return fmt.Sprintf(` | ||
provider "aws" { | ||
access_key = %[1]q | ||
alias = "alternate" | ||
profile = %[2]q | ||
region = %[3]q | ||
secret_key = %[4]q | ||
} | ||
`, os.Getenv("AWS_ALTERNATE_ACCESS_KEY_ID"), os.Getenv("AWS_ALTERNATE_PROFILE"), testAccGetAlternateRegion(), os.Getenv("AWS_ALTERNATE_SECRET_ACCESS_KEY")) | ||
} | ||
|
||
func testAccAlternateRegionProviderConfig() string { | ||
return fmt.Sprintf(` | ||
provider "aws" { | ||
alias = "alternate" | ||
region = %[1]q | ||
} | ||
`, testAccGetAlternateRegion()) | ||
} | ||
|
||
// Provider configuration hardcoded for us-east-1. | ||
// This should only be necessary for testing ACM Certificates with CloudFront | ||
// related infrastucture such as API Gateway Domain Names for EDGE endpoints, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved up in the file earlier this year, so fixing on merge.