provider/aws: Fix ECS Task Definition Acceptance tests
``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEcsTaskDefinition_withNetworkMode' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/02/10 12:12:32 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSEcsTaskDefinition_withNetworkMode -timeout 120m === RUN TestAccAWSEcsTaskDefinition_withNetworkMode --- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (13.70s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 13.741s ``` ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEcsTaskDefinition_withTaskRoleArn' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/02/10 12:22:40 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSEcsTaskDefinition_withTaskRoleArn -timeout 120m === RUN TestAccAWSEcsTaskDefinition_withTaskRoleArn --- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (14.70s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 14.728s ```
This commit is contained in:
parent
06aaa44a80
commit
1cd98c76c0
|
@ -347,62 +347,61 @@ func testAccAWSEcsTaskDefinitionWithTaskRoleArn(rInt int) string {
|
||||||
name = "tf_old_name-%d"
|
name = "tf_old_name-%d"
|
||||||
path = "/test/"
|
path = "/test/"
|
||||||
assume_role_policy = <<EOF
|
assume_role_policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
"Statement": [
|
"Statement": [
|
||||||
{
|
{
|
||||||
"Action": "sts:AssumeRole",
|
"Action": "sts:AssumeRole",
|
||||||
"Principal": {
|
"Principal": {
|
||||||
"Service": "ec2.amazonaws.com"
|
"Service": "ec2.amazonaws.com"
|
||||||
},
|
},
|
||||||
"Effect": "Allow",
|
"Effect": "Allow",
|
||||||
"Sid": ""
|
"Sid": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_role_policy" "role_test" {
|
resource "aws_iam_role_policy" "role_test" {
|
||||||
name = "role_update_test-%d"
|
name = "role_update_test-%d"
|
||||||
role = "${aws_iam_role.role_test.id}"
|
role = "${aws_iam_role.role_test.id}"
|
||||||
policy = <<EOF
|
policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
"Statement": [
|
"Statement": [
|
||||||
{
|
{
|
||||||
"Effect": "Allow",
|
"Effect": "Allow",
|
||||||
"Action": [
|
"Action": [
|
||||||
"s3:GetBucketLocation",
|
"s3:GetBucketLocation",
|
||||||
"s3:ListAllMyBuckets"
|
"s3:ListAllMyBuckets"
|
||||||
],
|
],
|
||||||
"Resource": "arn:aws:s3:::*"
|
"Resource": "arn:aws:s3:::*"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ecs_task_definition" "sleep" {
|
resource "aws_ecs_task_definition" "sleep" {
|
||||||
family = "terraform-acc-sc-volume-test"
|
family = "terraform-acc-sc-volume-test"
|
||||||
task_role_arn = "${aws_iam_role.role_test.arn}"
|
task_role_arn = "${aws_iam_role.role_test.arn}"
|
||||||
container_definitions = <<TASK_DEFINITION
|
container_definitions = <<TASK_DEFINITION
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "sleep",
|
"name": "sleep",
|
||||||
"image": "busybox",
|
"image": "busybox",
|
||||||
"cpu": 10,
|
"cpu": 10,
|
||||||
"command": ["sleep","360"],
|
"command": ["sleep","360"],
|
||||||
"memory": 10,
|
"memory": 10,
|
||||||
"essential": true
|
"essential": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
TASK_DEFINITION
|
TASK_DEFINITION
|
||||||
|
|
||||||
volume {
|
volume {
|
||||||
name = "database_scratch"
|
name = "database_scratch"
|
||||||
}
|
}
|
||||||
}`, rInt, rInt)
|
}`, rInt, rInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccAWSEcsTaskDefinitionWithNetworkMode(rInt int) string {
|
func testAccAWSEcsTaskDefinitionWithNetworkMode(rInt int) string {
|
||||||
|
@ -411,39 +410,39 @@ func testAccAWSEcsTaskDefinitionWithNetworkMode(rInt int) string {
|
||||||
name = "tf_old_name-%d"
|
name = "tf_old_name-%d"
|
||||||
path = "/test/"
|
path = "/test/"
|
||||||
assume_role_policy = <<EOF
|
assume_role_policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
"Statement": [
|
"Statement": [
|
||||||
{
|
{
|
||||||
"Action": "sts:AssumeRole",
|
"Action": "sts:AssumeRole",
|
||||||
"Principal": {
|
"Principal": {
|
||||||
"Service": "ec2.amazonaws.com"
|
"Service": "ec2.amazonaws.com"
|
||||||
},
|
},
|
||||||
"Effect": "Allow",
|
"Effect": "Allow",
|
||||||
"Sid": ""
|
"Sid": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_role_policy" "role_test" {
|
resource "aws_iam_role_policy" "role_test" {
|
||||||
name = "role_update_test-%d"
|
name = "role_update_test-%d"
|
||||||
role = "${aws_iam_role.role_test.id}"
|
role = "${aws_iam_role.role_test.id}"
|
||||||
policy = <<EOF
|
policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
"Statement": [
|
"Statement": [
|
||||||
{
|
{
|
||||||
"Effect": "Allow",
|
"Effect": "Allow",
|
||||||
"Action": [
|
"Action": [
|
||||||
"s3:GetBucketLocation",
|
"s3:GetBucketLocation",
|
||||||
"s3:ListAllMyBuckets"
|
"s3:ListAllMyBuckets"
|
||||||
],
|
],
|
||||||
"Resource": "arn:aws:s3:::*"
|
"Resource": "arn:aws:s3:::*"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,17 +451,17 @@ func testAccAWSEcsTaskDefinitionWithNetworkMode(rInt int) string {
|
||||||
task_role_arn = "${aws_iam_role.role_test.arn}"
|
task_role_arn = "${aws_iam_role.role_test.arn}"
|
||||||
network_mode = "bridge"
|
network_mode = "bridge"
|
||||||
container_definitions = <<TASK_DEFINITION
|
container_definitions = <<TASK_DEFINITION
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "sleep",
|
"name": "sleep",
|
||||||
"image": "busybox",
|
"image": "busybox",
|
||||||
"cpu": 10,
|
"cpu": 10,
|
||||||
"command": ["sleep","360"],
|
"command": ["sleep","360"],
|
||||||
"memory": 10,
|
"memory": 10,
|
||||||
"essential": true
|
"essential": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
TASK_DEFINITION
|
TASK_DEFINITION
|
||||||
|
|
||||||
volume {
|
volume {
|
||||||
name = "database_scratch"
|
name = "database_scratch"
|
||||||
|
|
Loading…
Reference in New Issue