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

Code Pipeline - failing to apply - unexpected EOF #2396

Closed
hashibot opened this issue Nov 22, 2017 · 5 comments · Fixed by #2998
Closed

Code Pipeline - failing to apply - unexpected EOF #2396

hashibot opened this issue Nov 22, 2017 · 5 comments · Fixed by #2998
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/codepipeline Issues and PRs that pertain to the codepipeline service.
Milestone

Comments

@hashibot
Copy link

This issue was originally opened by @mick999 as hashicorp/terraform#16733. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.0

  • provider.aws v1.1.0
  • provider.template v1.0.0

Terraform Configuration Files

...
resource "aws_codepipeline" "pipeline" {
        name            = "${var.environment}-${var.Dept}-${var.service_name}"
        role_arn        = "${var.codepipeline_role_arn}"

        artifact_store {
                location = "${var.artifact_bucket}"
                type     = "S3"
                       }

        stage {
                name = "getSourceCode"
                action {
                        name            = "SourceCode"
                        category        = "Source"
                        owner           = "AWS"
                        provider        = "CodeCommit"
                        version         = "1"
                        output_artifacts= ["sourceCode"]
                        run_order       = 1

                        configuration {
                                PollForSourceChanges    = false
                                BranchName              = "${var.sourceBranch}"
                                RepositoryName          = "${var.sourceRepoName}"
                                }
                        }
                }

        stage {
                name = "buildCode"
                action {
                        name            = "build"
                        category        = "Build"
                        owner           = "AWS"
                        provider        = "CodeBuild"
                        version         = "1"
                        output_artifacts = ["build"]
                        run_order       = 1
                        configuration   {
                                ProjectName = "${aws_codebuild_project.service.name}"
                                        }
                        input_artifacts = ["sourceCode"]
                        }

                }

        stage {
                name = "testAndCoverage"
                action {
                        name            = "testAndCoverage"
                        category        = "Invoke"
                        owner           = "AWS"
                        provider        = "Lambda"
                        version         = "1"
                        output_artifacts = [""]
                        run_order       = 1
                        configuration   {
                                FunctionName = "${var.testAndCoverageLamdbaFunction}"
                                UserParameters = <<EOF
{"Action":"TestCoverage",
"TestTask": "",
"cluster" : "${var.environment}-${var.Dept}",
"CoverageThreshold" : "${var.CoverageThreshold}",
"ExclusionThreshold" : "${var.ExclusionThreshold}",
"Output" : {
           "bucket" : "${var.testArtifactBucket}",
           "keyPrefix" : "${var.testArtifactKeyPrefix}/${var.service_name}/testresults"
           }
}
EOF
                                        }
                        input_artifacts = ["sourceCode","build"]
                        }
                }

    stage {
                name = "deploymentApprovalGate"
                action {
                        name            = "TriggerManualApprovalCheck"
                        category        = "Approval"
                        owner           = "AWS"
                        provider        = "Manual"
                        version         = "1"
                        run_order       = 1
                        configuration   {
                                NotificationArn = "${aws_sns_topic.approval.arn}"
                                CustomData = "Approve Code Deployment to Production"
                                      }
                        }
                }

   stage {
                name = "ProductionDeployment"
                action {
                        name            = "Deployment"
                        category        = "Invoke"
                        owner           = "AWS"
                        provider        = "Lambda"
                        version         = "1"
                        input_artifacts = ["sourceCode","build"]
                        run_order       = 1
                        configuration   {
                                FunctionName    = "${var.deploymentLambdaFunction}"
                                UserParameters   = <<EOF
{"cluster": "${var.environment}-${var.Dept}",
"services" : [
                "${aws_ecs_service.serviceHTTP.name}",
                "${aws_ecs_service.serviceQueue.name}"
             ]
}
EOF
                                     }
                        }
                }
}

# create the SNS topic for manual approval notifications
resource "aws_sns_topic" "approval" {
        name = "${var.Dept}-${var.service_name}-Deployment_Approval"
        }

data "template_file" "testing" {
        template = "${file("${path.module}/templates/container_definition_testing.json")}"

        vars {
                service_name            = "${var.service_name}"
                imageURI                = "${aws_ecr_repository.service.repository_url}"
                region                  = "${var.region}"
                containerCPUUnits       = "${var.containerCPUUnits["http"]}"
                containerMemory         = "${var.containerMemory["http"]}"
                service_type            = "HTTP"
                service_config_file     = "${var.service_config_file["http"]}"
                service_file            = "${var.service_file["http"]}"
                environment             = "${var.environment}"
                log_group               = "${aws_cloudwatch_log_group.service.name}"
             }
        }

# create the task definition for the testing use
resource "aws_ecs_task_definition" "taskTesting" {
        family                  = "${data.aws_ecs_cluster.cluster.cluster_name}-${var.service_name}-testing"
        container_definitions   = "${data.template_file.testing.rendered}"
        network_mode            = "bridge"
        task_role_arn           = "${var.ecs_task_role_arn}"
        }

Crash Output

...

2017/11/21 17:09:57 [TRACE] [walkApply] Exiting eval tree: provider.aws
2017/11/21 17:09:57 [TRACE] dag/walk: walking "aws_codepipeline.pipeline"
2017/11/21 17:09:57 [TRACE] vertex 'root.aws_codepipeline.pipeline': walking
2017/11/21 17:09:57 [TRACE] vertex 'root.aws_codepipeline.pipeline': evaluating
2017/11/21 17:09:57 [TRACE] [walkApply] Entering eval tree: aws_codepipeline.pipeline
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalSequence
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalInstanceInfo
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalReadDiff
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalIf
2017/11/21 17:09:57 [TRACE] root: eval: terraform.EvalNoop
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalIf
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalInterpolate
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalGetProvider
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalReadState
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalValidateResource
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalDiff
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalReadDiff
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalCompareDiff
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalGetProvider
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalReadState
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalApplyPre
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalApply
2017/11/21 17:09:57 [DEBUG] apply: aws_codepipeline.pipeline: executing Apply
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: panic: interface conversion: interface {} is nil, not string
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: goroutine 415 [running]:
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.expandAwsCodePipelineActionsOutputArtifacts(0xc420eb3040, 0x1, 0x1, 0x10, 0xc420bb73d8, 0xc420c597b0)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codepipeline.go:415 +0x26a
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.expandAwsCodePipelineActions(0xc420eb2f00, 0x1, 0x1, 0x6, 0xc420bc5dd8, 0xc420eb3420)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codepipeline.go:330 +0x92f
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.expandAwsCodePipelineStages(0xc420395c00, 0xc4207ae7e0, 0x40, 0x409290)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codepipeline.go:281 +0x171
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.expandAwsCodePipeline(0xc420395c00, 0x0)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codepipeline.go:231 +0x5b
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsCodePipelineCreate(0xc420395c00, 0x1dadbc0, 0xc420546200, 0x24, 0x3595460)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codepipeline.go:203 +0x6c
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc420cfda40, 0xc420ea8b40, 0xc4207a3fe0, 0x1dadbc0, 0xc420546200, 0x1, 0xc420e97860, 0xc420a3f410)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:193 +0x3b6
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc4206c3110, 0xc420ea8af0, 0xc420ea8b40, 0xc4207a3fe0, 0x7f577d97e000, 0x0, 0x18)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:259 +0xa4
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc420697ec0, 0xc4207a3a80, 0xc420eb2a80, 0x0, 0x0)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: reflect.Value.call(0xc420356e40, 0xc420ddffa0, 0x13, 0x20aacdf, 0x4, 0xc4206d8f20, 0x3, 0x3, 0x0, 0x0, ...)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /usr/local/go/src/reflect/value.go:434 +0x906
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: reflect.Value.Call(0xc420356e40, 0xc420ddffa0, 0x13, 0xc420d43f20, 0x3, 0x3, 0xc420ac0420, 0xc420ac04e0, 0xc4201d5220)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /usr/local/go/src/reflect/value.go:302 +0xa4
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: net/rpc.(*service).call(0xc420c9c600, 0xc42081e550, 0xc4206bec80, 0xc420b54680, 0xc4206a84a0, 0x1a35280, 0xc4207a3a80, 0x16, 0x1a352c0, 0xc420eb2a80, ...)
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /usr/local/go/src/net/rpc/server.go:381 +0x142
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4: created by net/rpc.(*Server).ServeCodec
2017-11-21T17:09:57.787-0600 [DEBUG] plugin.terraform-provider-aws_v1.1.0_x4:   /usr/local/go/src/net/rpc/server.go:475 +0x36b
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalWriteState
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalIf
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalWriteState
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalWriteDiff
2017/11/21 17:09:57 [TRACE] root: eval: *terraform.EvalApplyPost
2017/11/21 17:09:57 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_codepipeline.pipeline: unexpected EOF
2017/11/21 17:09:57 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_codepipeline.pipeline: unexpected EOF
2017/11/21 17:09:57 [TRACE] [walkApply] Exiting eval tree: aws_codepipeline.pipeline
2017/11/21 17:09:57 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2017/11/21 17:09:57 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2017/11/21 17:09:57 [TRACE] dag/walk: upstream errored, not walking "root"
2017/11/21 17:09:57 [TRACE] Preserving existing state lineage "3697d12f-5b1c-4d7d-94ed-6c431089974a"
2017-11-21T17:09:57.793-0600 [DEBUG] plugin: plugin process exited: path=/home/cloud-user/terraform/xxx_infra_awsbasesetup/teamresources/Finance/sandbox/ecs/services/.terraform/plugins/linux_amd64/terraform-provider-aws_v1.1.0_x4
2017/11/21 17:09:57 [TRACE] Preserving existing state lineage "3697d12f-5b1c-4d7d-94ed-6c431089974a"
2017/11/21 17:09:57 [TRACE] Preserving existing state lineage "3697d12f-5b1c-4d7d-94ed-6c431089974a"
2017/11/21 17:09:57 [TRACE] Preserving existing state lineage "3697d12f-5b1c-4d7d-94ed-6c431089974a"
2017/11/21 17:09:57 [DEBUG] plugin: waiting for all plugin processes to complete...
2017-11-21T17:09:57.804-0600 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2017-11-21T17:09:57.806-0600 [DEBUG] plugin: plugin process exited: path=/home/cloud-user/terraform/xxx_infra_awsbasesetup/teamresources/Finance/sandbox/ecs/services/.terraform/plugins/linux_amd64/terraform-provider-template_v1.0.0_x4

Expected Behavior

Apply should create the AWS CodePipeline.

Actual Behavior

Crash Log

Steps to Reproduce

terraform plan - works as expected
terraform apply - fails with crash log

Important Factoids

running commands using aws-vault (tried without that and same issue)

This particular script is part of wider setup which creates ECS task definitions, aws codebuild.

@hashibot hashibot added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Nov 22, 2017
@mick999
Copy link

mick999 commented Nov 22, 2017

this is the issue

                    output_artifacts = [""]

Removed this and it now works.

@radeksimko radeksimko added the service/codepipeline Issues and PRs that pertain to the codepipeline service. label Jan 12, 2018
@radeksimko radeksimko added this to the v1.7.1 milestone Jan 15, 2018
@radeksimko radeksimko self-assigned this Jan 15, 2018
@bflad
Copy link
Contributor

bflad commented Jan 22, 2018

This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@karimmaosud
Copy link

@bflad @radeksimko
I am facing a similar issue.
Here are the error lines.

2018/05/09 13:09:39 [ERROR] root: eval: *terraform.EvalConfigProvider, err: unexpected EOF
2018-05-09T13:09:39.237Z [DEBUG] plugin.terraform-provider-aws_v1.17.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/config.go:404 +0x487c
2018-05-09T13:09:39.237Z [DEBUG] plugin: plugin process exited: path=$CODE_PATH/terraform/.terraform/plugins/linux_amd64/terraform-provider-aws_v1.17.0_x4
2018/05/09 13:09:39 [ERROR] root: eval: *terraform.EvalSequence, err: unexpected EOF
2018/05/09 13:09:39 [ERROR] root: eval: *terraform.EvalOpFilter, err: unexpected EOF
2018/05/09 13:09:39 [ERROR] root: eval: *terraform.EvalSequence, err: unexpected EOF

The final response from Terraform is the following:

2018/05/09 13:09:40 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-05-09T13:09:40.334Z [WARN ] plugin: error closing client during Kill: err="connection is shut down"
Error: Error running plan: 1 error(s) occurred:

* provider.aws: unexpected EOF

Any help is highly appreciated.
Any idea what may be the problem?

@bflad
Copy link
Contributor

bflad commented May 9, 2018

@mirak94 sorry you are running into trouble. Please open a new issue rather than commenting a closed one. It looks like the credential provider might not be set when using the fallback credential lookup.

@ghost
Copy link

ghost commented Apr 6, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/codepipeline Issues and PRs that pertain to the codepipeline service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants