aws / aws/aws-toolkit-azure-devops
Running Terraform output command returns no result
- Dominant language
- TypeScript
- Stars
- 258
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I run terraform output command in the AWSShellScript task (after a successfult terraform apply task) it returns {}, However if I group it with terraform apply it provides all the outputs without any problem.
So basically this returns just {} with no outputs whatsoever -
```
- task: AWSShellScript@1
displayName: 'display output variables'
name: TerraformOutput
inputs:
workingDirectory: $(Pipeline.Workspace)/terraform
scriptType: 'inline'
inlineScript: |
terraform output -json
awsCredentials: ${{ parameters.awsCreds }}
```
But if instead of having a separate task for terraform apply, if I include terraform apply in the same task, it works perfectly fine.
```
- task: AWSShellScript@1
displayName: 'display output variables'
name: TerraformOutput
inputs:
workingDirectory: $(Pipeline.Workspace)/terraform
scriptType: 'inline'
inlineScript: |
terraform apply --auto-approve
terraform output -json
awsCredentials: ${{ parameters.awsCreds }}
```
**Expected behavior**
Running just terraform output should return the output as result in logs
**Your Environment**
- On-prem or cloud based?: AWS cloud
- AWS Toolkit for Azure DevOps version: 1.13.0
Contributor guide
Research direction
Start by reproducing the report with the two AWSShellScript@1 examples, using a separate terraform apply task followed by terraform output -json in the stated working directory. Compare that with both commands in one task and verify whether the separate command returns the Terraform outputs in the logs as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, terraform
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100