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

tests/resource/workspaces_directory: Fix hardcoded region #16602

Merged
merged 3 commits into from
Jan 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions aws/resource_aws_workspaces_directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,18 +647,12 @@ func testAccPreCheckWorkspacesDirectory(t *testing.T) {
}

func testAccAwsWorkspacesDirectoryConfig_Prerequisites(rName string) string {
return fmt.Sprintf(`
return composeConfig(
testAccAvailableAZsNoOptInConfig(),
//lintignore:AWSAT003
fmt.Sprintf(`
data "aws_region" "current" {}

data "aws_availability_zones" "available" {
state = "available"

filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
}

locals {
region_workspaces_az_ids = {
YakDriver marked this conversation as resolved.
Show resolved Hide resolved
"us-east-1" = formatlist("use1-az%%d", [2, 4, 6])
Expand Down Expand Up @@ -709,12 +703,13 @@ resource "aws_directory_service_directory" "main" {
Name = "tf-testacc-workspaces-directory-%[1]s"
}
}
`, rName)
`, rName))
}

func testAccWorkspacesDirectoryConfig(rName string) string {
return composeConfig(
testAccAwsWorkspacesDirectoryConfig_Prerequisites(rName), `
testAccAwsWorkspacesDirectoryConfig_Prerequisites(rName),
fmt.Sprintf(`
resource "aws_workspaces_directory" "main" {
directory_id = aws_directory_service_directory.main.id

Expand All @@ -726,7 +721,7 @@ resource "aws_workspaces_directory" "main" {
data "aws_iam_role" "workspaces-default" {
name = "workspaces_DefaultRole"
}
`)
`, rName))
}

func testAccWorkspacesDirectory_selfServicePermissions(rName string) string {
Expand Down