From 53ebbed8dff482eee1d7b5bf07209bc3af14af9f Mon Sep 17 00:00:00 2001 From: Andras Ferencz-Szabo Date: Wed, 7 Dec 2016 12:34:58 +0000 Subject: [PATCH] Service role is not updated on AWS for a CodeDeploy deployment group (#9866) Service role is not updated on AWS for a CodeDeploy deployment group --- .../resource_aws_codedeploy_deployment_group.go | 1 + ...esource_aws_codedeploy_deployment_group_test.go | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go b/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go index 930c6bde3..4a6d17211 100644 --- a/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go +++ b/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go @@ -336,6 +336,7 @@ func resourceAwsCodeDeployDeploymentGroupUpdate(d *schema.ResourceData, meta int input := codedeploy.UpdateDeploymentGroupInput{ ApplicationName: aws.String(d.Get("app_name").(string)), CurrentDeploymentGroupName: aws.String(d.Get("deployment_group_name").(string)), + ServiceRoleArn: aws.String(d.Get("service_role_arn").(string)), } if d.HasChange("autoscaling_groups") { diff --git a/builtin/providers/aws/resource_aws_codedeploy_deployment_group_test.go b/builtin/providers/aws/resource_aws_codedeploy_deployment_group_test.go index 90941fbbf..ff2852500 100644 --- a/builtin/providers/aws/resource_aws_codedeploy_deployment_group_test.go +++ b/builtin/providers/aws/resource_aws_codedeploy_deployment_group_test.go @@ -37,6 +37,9 @@ func TestAccAWSCodeDeployDeploymentGroup_basic(t *testing.T) { "aws_codedeploy_deployment_group.foo", "deployment_group_name", "foo_"+rName), resource.TestCheckResourceAttr( "aws_codedeploy_deployment_group.foo", "deployment_config_name", "CodeDeployDefault.OneAtATime"), + resource.TestMatchResourceAttr( + "aws_codedeploy_deployment_group.foo", "service_role_arn", + regexp.MustCompile("arn:aws:iam::[0-9]{12}:role/foo_role_.*")), resource.TestCheckResourceAttr( "aws_codedeploy_deployment_group.foo", "ec2_tag_filter.#", "1"), @@ -65,6 +68,9 @@ func TestAccAWSCodeDeployDeploymentGroup_basic(t *testing.T) { "aws_codedeploy_deployment_group.foo", "deployment_group_name", "bar_"+rName), resource.TestCheckResourceAttr( "aws_codedeploy_deployment_group.foo", "deployment_config_name", "CodeDeployDefault.OneAtATime"), + resource.TestMatchResourceAttr( + "aws_codedeploy_deployment_group.foo", "service_role_arn", + regexp.MustCompile("arn:aws:iam::[0-9]{12}:role/bar_role_.*")), resource.TestCheckResourceAttr( "aws_codedeploy_deployment_group.foo", "ec2_tag_filter.#", "1"), @@ -1042,7 +1048,7 @@ resource "aws_codedeploy_app" "foo_app" { resource "aws_iam_role_policy" "foo_policy" { name = "foo_policy_%s" - role = "${aws_iam_role.foo_role.id}" + role = "${aws_iam_role.bar_role.id}" policy = <