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

Terraform Apply step failure due to multi-line output #4998

johnsimons opened this issue Oct 18, 2018 · 2 comments


Copy link

commented Oct 18, 2018

Are you a customer of Octopus Deploy? Don't raise the issue here. Please contact our support team so we can triage your issue, making sure it's handled appropriately.


  • I have verified the problem exists in the latest version
  • I have searched open and closed issues to make sure it isn't already reported
  • I have written a descriptive issue title
  • I have linked the original source of this report
  • I have tagged the issue appropriately (area/*, kind/bug, tag/regression?)

The bug

Trying to save output to an output variable. When we have "normal" outputs, i.e. key = value or key = value1,value2 all on a single line, things are great.

However, when we have a multi-line output. This breaks the deploy step even though terraform ran to success.

What I expected to happen

To successfully handles multiline output variables

Steps to reproduce

  1. Create a Terraform Apply step with the following template:
    locals {
      config-map-aws-auth = <<CONFIGMAPAWSAUTH
    apiVersion: v1
    kind: ConfigMap
      name: aws-auth
      namespace: kube-system
      mapRoles: |
        - rolearn: arbitrary text
          username: system:node:username
            - system:bootstrappers
            - system:nodes
    output "config-map-aws-auth" {
      value = "${local.config-map-aws-auth}"
  2. Execute deployment

Screen capture

Log exerpt

21:27:40   Info     |       groups:
21:27:40   Info     |       - system:bootstrappers
21:27:40   Info     |       - system:nodes
21:27:40   Error    |       foreach : Exception calling "Substring" with "2" argument(s): "Length cannot
21:27:40   Error    |       be less than zero.
21:27:40   Error    |       Parameter name: length"
21:27:40   Error    |       At C:\Octopus\Work\20181017212737-208711-23\Script.ps1:110 char:11
21:27:40   Error    |       +         | foreach { $_.SubString(0,$_.IndexOf("=")).Trim() } `
21:27:40   Error    |       +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21:27:40   Error    |       + CategoryInfo          : NotSpecified: (:) [ForEach-Object], MethodInvoca
21:27:40   Error    |       tionException
21:27:40   Error    |       + FullyQualifiedErrorId : ArgumentOutOfRangeException,Microsoft.PowerShell
21:27:40   Error    |       .Commands.ForEachObjectCommand
21:27:41   Verbose  |       Process C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in C:\Octopus\Work\20181017212737-208711-23 exited with code 1
21:27:41   Verbose  |       Updating manifest with output variables
21:27:41   Verbose  |       Updating manifest with action evaluated variables
21:27:41   Fatal    |       The remote script failed with exit code 1
21:27:41   Fatal    |       The action dd on the Octopus Server failed

Affected versions

Since Terraform feature was introduced in v2018.3


remove the newlines from the output variables


@johnsimons johnsimons changed the title Terraform deploy step failure due to multi-line output Terraform Apply step failure due to multi-line output Oct 18, 2018
@johnsimons johnsimons closed this Oct 18, 2018
@octoreleasebot octoreleasebot added this to the 2018.9.12 milestone Oct 18, 2018

This comment has been minimized.

Copy link

commented Oct 18, 2018

Release Note: Terraform Apply step now supports multi-line output variables

@johnsimons johnsimons modified the milestones: 2018.9.12, 2018.8.12 Oct 18, 2018

This comment has been minimized.

Copy link

commented Jan 16, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.