Terraform: aws_codedeploy_deployment_group on_premises_instance_tag_filter not added after apply

Created on 10 May 2016  ยท  5Comments  ยท  Source: hashicorp/terraform

I have a simple deployment group defined as

resource "aws_codedeploy_deployment_group" "qa" {
  app_name = "${aws_codedeploy_app.my_app.name}"
  deployment_group_name = "qa"
  service_role_arn      = "${terraform_remote_state.codedeploy.output.aws_iam_role_codedeploy_service_role_arn}"
  deployment_config_name = "CodeDeployDefault.OneAtATime"
  on_premises_instance_tag_filter {
    type = "VALUE_ONLY"
    value = "staging-qa"
  }
}

When I run terraform plan, I can see that the deployment group will be created

+ aws_codedeploy_deployment_group.qa
    app_name:                                         "" => "My App"
    deployment_config_name:                           "" => "CodeDeployDefault.OneAtATime"
    deployment_group_name:                            "" => "qa"
    on_premises_instance_tag_filter.#:                "" => "1"
    on_premises_instance_tag_filter.1446378810.key:   "" => ""
    on_premises_instance_tag_filter.1446378810.type:  "" => "VALUE_ONLY"
    on_premises_instance_tag_filter.1446378810.value: "" => "staging-qa"
    service_role_arn:                                 "" => "arn:aws:iam::123456789012:role/CodeDeployServiceRole"

After running terraform apply with no error, when I go into AWS to verify the deployment group, the on premise instance tag is not added.

bug provideaws

Most helpful comment

@jdextraze

just found the bug and opened a PR to fix it - thanks for reporting it

Paul

All 5 comments

Hi @jdextraze

Thanks for the report here - sorry this has caught you! I am trying to recreate this right now to see if we can get to the bottom of it

One thing I have found is that on a second apply, the tags actually do get added - so I am debugging this now

Paul

@stack72 second apply added the tag for me too, but crash terraform and corrupt state file.

panic: runtime error: invalid memory address or nil pointer dereference
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: [signal 0xb code=0x1 addr=0x8 pc=0x4ffa5a]
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: goroutine 133 [running]:
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: panic(0x14027e0, 0xc82000a0f0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/go/src/runtime/panic.go:481 +0x3e6
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.onPremisesTagFiltersToMap(0xc8200297e0, 0x1, 0x1, 0x0, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go:403 +0x11a
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsCodeDeployDeploymentGroupRead(0xc820384fc0, 0x10970e0, 0xc820396000, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go:252 +0x761
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsCodeDeployDeploymentGroupUpdate(0xc820384fc0, 0x10970e0, 0xc820396000, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_codedeploy_deployment_group.go:306 +0xa90
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc8204248c0, 0xc8201dec00, 0xc8204624e0, 0x10970e0, 0xc820396000, 0xc820108101, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:152 +0x3b9
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc82048ba40, 0xc820310d80, 0xc8201dec00, 0xc8204624e0, 0x227f501, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:162 +0x1ed
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: github.com/hashicorp/terraform/rpc.(*ResourceProviderServer).Apply(0xc8204ca420, 0xc820488920, 0xc820462580, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/gopath/src/github.com/hashicorp/terraform/rpc/resource_provider.go:323 +0x76
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: reflect.Value.call(0x133bf20, 0x16481d8, 0x13, 0x16fff20, 0x4, 0xc82035bed8, 0x3, 0x3, 0x0, 0x0, ...)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/go/src/reflect/value.go:435 +0x120d
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: reflect.Value.Call(0x133bf20, 0x16481d8, 0x13, 0xc82035bed8, 0x3, 0x3, 0x0, 0x0, 0x0)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/go/src/reflect/value.go:303 +0xb1
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: net/rpc.(*service).call(0xc82033cc40, 0xc82033cc00, 0xc8204c5620, 0xc82041c400, 0xc82048d180, 0x1097f80, 0xc820488920, 0x16, 0x1097fe0, 0xc820462580, ...)
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/go/src/net/rpc/server.go:383 +0x1c2
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws: created by net/rpc.(*Server).ServeCodec
2016/05/11 15:57:10 [DEBUG] terraform-provider-aws:     /opt/go/src/net/rpc/server.go:477 +0x49d

hi @jdextraze

That is exactly what i am trying to debug right now :)

P.

@jdextraze

just found the bug and opened a PR to fix it - thanks for reporting it

Paul

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings