0

My Azure pipeline is as below:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'
steps:
- task: terraform init
  displayName: 'terraform init'
  inputs:
    provider: aws
    backendServiceAWS: 'tcp-aws-aa'
    backendAWSBucketName: 'terraform-backend-20200102'
    backendAWSKey: dev.plan

- task: terraform fmt
  displayName: 'terraform fmt'
  inputs:
    provider: aws
    command: fmt
    
- task: terraform validate
  displayName: 'terraform validate'
  inputs:
    provider: aws
    command: validate

- task: terraform plan
  displayName: 'terraform plan'
  inputs:
    provider: aws
    command: plan
    environmentServiceNameAWS: 'tcp-aws-aa'

- task: tflint check
  inputs:
    script: tflint .

- task: tfsec check
  inputs:
    script: tfsec .

However, it produces an error as like below

enter image description here

How to have it resolved?

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
learner
  • 2,480
  • 10
  • 50
  • 94

1 Answers1

2

Well it looks like you want to refer to task: TerraformTaskV1@0 (based on the syntax) and the you should use as this:

- task: TerraformTaskV1@0
  inputs:
    provider: 'azurerm'
    command: 'init'
    backendAWSKey: 
    backendAWSBucketName: 

It support these commands:

enter image description here

And of course to use it you need to install this extension. I guessed that this is the one you should use based on the input settings. They are exactly the same like this extension has.

You also have there tflint and tfsec but I didn't found extensions or native solution for them so assuming that you installed them on agent you should rather use them like this:

- script: |
    tflint .
  displayName: 'tflint check'

- script: |
    tfsec .
  displayName: 'tfsec check'

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • I appreciate your answer, however, where it is written to refer to TerraformTaskV1@0 ? and also the later syntax? where do I need to check? Please guide. – learner Dec 01 '20 at 00:33
  • Please check my edit. I added there info out this. If you have more question feel free to ask. – Krzysztof Madej Dec 01 '20 at 08:55