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

Fix acc test configs (up to VPC endpoint) #14484

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
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
20 changes: 10 additions & 10 deletions aws/data_source_aws_secretsmanager_secret_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ resource "aws_lambda_function" "test" {
filename = "test-fixtures/lambdatest.zip"
function_name = "%[1]s-1"
handler = "exports.example"
role = "${aws_iam_role.iam_for_lambda.arn}"
role = aws_iam_role.iam_for_lambda.arn
runtime = "nodejs12.x"
}

resource "aws_lambda_permission" "test" {
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.test.function_name}"
principal = "secretsmanager.amazonaws.com"
statement_id = "AllowExecutionFromSecretsManager"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.test.function_name
principal = "secretsmanager.amazonaws.com"
statement_id = "AllowExecutionFromSecretsManager"
}

resource "aws_secretsmanager_secret" "test" {
name = "%[1]s"
}

resource "aws_secretsmanager_secret_rotation" "test" {
secret_id = "${aws_secretsmanager_secret.test.id}"
rotation_lambda_arn = "${aws_lambda_function.test.arn}"
secret_id = aws_secretsmanager_secret.test.id
rotation_lambda_arn = aws_lambda_function.test.arn

rotation_rules {
rotation_rules {
automatically_after_days = %[2]d
}
}
}

data "aws_secretsmanager_secret_rotation" "test" {
secret_id = "${aws_secretsmanager_secret_rotation.test.secret_id}"
secret_id = aws_secretsmanager_secret_rotation.test.secret_id
}
`, rName, automaticallyAfterDays)
}
24 changes: 12 additions & 12 deletions aws/data_source_aws_secretsmanager_secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ resource "aws_secretsmanager_secret" "test" {
}

data "aws_secretsmanager_secret" "test" {
arn = "${aws_secretsmanager_secret.test.arn}"
arn = aws_secretsmanager_secret.test.arn
}
`, rName)
}
Expand All @@ -165,7 +165,7 @@ resource "aws_secretsmanager_secret" "test" {
}

data "aws_secretsmanager_secret" "test" {
name = "${aws_secretsmanager_secret.test.name}"
name = aws_secretsmanager_secret.test.name
}
`, rName)
}
Expand All @@ -179,22 +179,22 @@ resource "aws_secretsmanager_secret" "test" {
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableAllPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
{
"Sid": "EnableAllPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
]
}
POLICY
}

data "aws_secretsmanager_secret" "test" {
name = "${aws_secretsmanager_secret.test.name}"
name = aws_secretsmanager_secret.test.name
}
`, rName)
}
Expand Down
14 changes: 7 additions & 7 deletions aws/data_source_aws_secretsmanager_secret_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ resource "aws_secretsmanager_secret" "test" {
}

resource "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret.test.id}"
secret_id = aws_secretsmanager_secret.test.id
secret_string = "test-string"
}

data "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret.test.id}"
version_id = "${aws_secretsmanager_secret_version.test.version_id}"
secret_id = aws_secretsmanager_secret.test.id
version_id = aws_secretsmanager_secret_version.test.version_id
}
`, rName)
}
Expand All @@ -134,13 +134,13 @@ resource "aws_secretsmanager_secret" "test" {
}

resource "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret.test.id}"
secret_id = aws_secretsmanager_secret.test.id
secret_string = "test-string"
version_stages = ["test-stage", "AWSCURRENT"]
}

data "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret_version.test.secret_id}"
secret_id = aws_secretsmanager_secret_version.test.secret_id
version_stage = "test-stage"
}
`, rName)
Expand All @@ -153,12 +153,12 @@ resource "aws_secretsmanager_secret" "test" {
}

resource "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret.test.id}"
secret_id = aws_secretsmanager_secret.test.id
secret_string = "test-string"
}

data "aws_secretsmanager_secret_version" "test" {
secret_id = "${aws_secretsmanager_secret_version.test.secret_id}"
secret_id = aws_secretsmanager_secret_version.test.secret_id
}
`, rName)
}
12 changes: 6 additions & 6 deletions aws/data_source_aws_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ resource "aws_vpc" "test" {
}

resource "aws_security_group" "test" {
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id
name = "test-%d"

tags = {
Expand All @@ -125,28 +125,28 @@ resource "aws_security_group" "test" {
}

data "aws_security_group" "by_id" {
id = "${aws_security_group.test.id}"
id = aws_security_group.test.id
}

data "aws_security_group" "by_name" {
name = "${aws_security_group.test.name}"
name = aws_security_group.test.name
}

data "aws_security_group" "default_by_name" {
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id
name = "default"
}

data "aws_security_group" "by_tag" {
tags = {
Seed = "${aws_security_group.test.tags["Seed"]}"
Seed = aws_security_group.test.tags["Seed"]
}
}

data "aws_security_group" "by_filter" {
filter {
name = "group-name"
values = ["${aws_security_group.test.name}"]
values = [aws_security_group.test.name]
}
}
`, rInt, rInt)
Expand Down
8 changes: 4 additions & 4 deletions aws/data_source_aws_security_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ resource "aws_vpc" "test_tag" {

resource "aws_security_group" "test" {
count = 3
vpc_id = "${aws_vpc.test_tag.id}"
vpc_id = aws_vpc.test_tag.id
name = "tf-%[1]d-${count.index}"

tags = {
Expand All @@ -64,7 +64,7 @@ resource "aws_security_group" "test" {

data "aws_security_groups" "by_tag" {
tags = {
Seed = "${aws_security_group.test.0.tags["Seed"]}"
Seed = aws_security_group.test.0.tags["Seed"]
}
}
`, rInt)
Expand All @@ -82,7 +82,7 @@ resource "aws_vpc" "test_filter" {

resource "aws_security_group" "test" {
count = 3
vpc_id = "${aws_vpc.test_filter.id}"
vpc_id = aws_vpc.test_filter.id
name = "tf-%[1]d-${count.index}"

tags = {
Expand All @@ -93,7 +93,7 @@ resource "aws_security_group" "test" {
data "aws_security_groups" "by_filter" {
filter {
name = "vpc-id"
values = ["${aws_vpc.test_filter.id}"]
values = [aws_vpc.test_filter.id]
}

filter {
Expand Down
6 changes: 4 additions & 2 deletions aws/data_source_aws_sfn_activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ func testAccCheckAWSStepFunctionsActivityDataSourceConfig_ActivityArn(rName stri
resource aws_sfn_activity "test" {
name = "%s"
}

data aws_sfn_activity "test" {
arn = "${aws_sfn_activity.test.id}"
arn = aws_sfn_activity.test.id
}
`, rName)
}
Expand All @@ -53,8 +54,9 @@ func testAccCheckAWSStepFunctionsActivityDataSourceConfig_ActivityName(rName str
resource aws_sfn_activity "test" {
name = "%s"
}

data aws_sfn_activity "test" {
name = "${aws_sfn_activity.test.name}"
name = aws_sfn_activity.test.name
}
`, rName)
}
4 changes: 2 additions & 2 deletions aws/data_source_aws_sfn_state_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ EOF

resource "aws_sfn_state_machine" "test" {
name = "test_sfn_%s"
role_arn = "${aws_iam_role.iam_for_sfn.arn}"
role_arn = aws_iam_role.iam_for_sfn.arn

definition = <<EOF
{
Expand All @@ -72,7 +72,7 @@ EOF
}

data "aws_sfn_state_machine" "test" {
name = "${aws_sfn_state_machine.test.name}"
name = aws_sfn_state_machine.test.name
}
`, rName, rName)
}
2 changes: 1 addition & 1 deletion aws/data_source_aws_sns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ resource "aws_sns_topic" "tf_wrong2" {
}

data "aws_sns_topic" "by_name" {
name = "${aws_sns_topic.tf_test.name}"
name = aws_sns_topic.tf_test.name
}
`
4 changes: 2 additions & 2 deletions aws/data_source_aws_sqs_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ resource "aws_sqs_queue" "test" {
}

data "aws_sqs_queue" "by_name" {
name = "${aws_sqs_queue.test.name}"
name = aws_sqs_queue.test.name
}
`, rName)
}
Expand All @@ -113,7 +113,7 @@ resource "aws_sqs_queue" "test" {
}

data "aws_sqs_queue" "by_name" {
name = "${aws_sqs_queue.test.name}"
name = aws_sqs_queue.test.name
}
`, rName)
}
32 changes: 16 additions & 16 deletions aws/data_source_aws_ssm_document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ resource "aws_ssm_document" "test" {
document_type = "Command"

content = <<DOC
{
"schemaVersion": "1.2",
"description": "Check ip configuration of a Linux instance.",
"parameters": {

},
"runtimeConfig": {
"aws:runShellScript": {
"properties": [
{
"id": "0.aws:runShellScript",
"runCommand": ["ifconfig"]
}
]
}
{
"schemaVersion": "1.2",
"description": "Check ip configuration of a Linux instance.",
"parameters": {},
"runtimeConfig": {
"aws:runShellScript": {
"properties": [
{
"id": "0.aws:runShellScript",
"runCommand": [
"ifconfig"
]
}
]
}
}
}
DOC
}

data "aws_ssm_document" "test" {
name = "${aws_ssm_document.test.name}"
name = aws_ssm_document.test.name
document_format = "%s"
}
`, name, documentFormat)
Expand Down
2 changes: 1 addition & 1 deletion aws/data_source_aws_ssm_parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ resource "aws_ssm_parameter" "test" {
}

data "aws_ssm_parameter" "test" {
name = "${aws_ssm_parameter.test.name}"
name = aws_ssm_parameter.test.name
with_decryption = %s
}
`, name, withDecryption)
Expand Down
32 changes: 16 additions & 16 deletions aws/data_source_aws_ssm_patch_baseline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func TestAccAWSSsmPatchBaselineDataSource_newBaseline(t *testing.T) {
func testAccCheckAwsSsmPatchBaselineDataSourceConfig_existingBaseline() string {
return `
data "aws_ssm_patch_baseline" "test_existing" {
owner = "AWS"
name_prefix = "AWS-"
operating_system = "CENTOS"
owner = "AWS"
name_prefix = "AWS-"
operating_system = "CENTOS"
}
`
}
Expand All @@ -62,23 +62,23 @@ data "aws_ssm_patch_baseline" "test_existing" {
func testAccCheckAwsSsmPatchBaselineDataSourceConfig_newBaseline(name string) string {
return fmt.Sprintf(`
resource "aws_ssm_patch_baseline" "test_new" {
name = "%s"
operating_system = "AMAZON_LINUX_2"
description = "Test"
name = "%s"
operating_system = "AMAZON_LINUX_2"
description = "Test"

approval_rule {
approve_after_days = 5
patch_filter {
key = "CLASSIFICATION"
values = ["*"]
}
}
approval_rule {
approve_after_days = 5
patch_filter {
key = "CLASSIFICATION"
values = ["*"]
}
}
}

data "aws_ssm_patch_baseline" "test_new" {
owner = "Self"
name_prefix = "${aws_ssm_patch_baseline.test_new.name}"
operating_system = "AMAZON_LINUX_2"
owner = "Self"
name_prefix = aws_ssm_patch_baseline.test_new.name
operating_system = "AMAZON_LINUX_2"
}
`, name)
}
Loading