unable to execute terraform apply in azure devops

0 votes

I am trying to execute terraform scripts through Azure DevOps. I am not able to apply and validate through different tasks, though terraform plan is successful terraform apply is failing.

##[error]TypeError: Cannot read property 'includes' of null

Here are the terraform tasks which I am using. I have tried two different tasks

1.

- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV2@2
  displayName: 'Terraform : apply -auto-approve'
  inputs:
    command: apply
    workingDirectory: '$(System.DefaultWorkingDirectory)/Terraform'
    commandOptions: '-auto-approve'
    environmentServiceNameAzureRM: 'ps-vs-sc'
    backendAzureRmResourceGroupName: '$(rgname)'
    backendAzureRmStorageAccountName: $(strname)
    backendAzureRmContainerName: $(tfContainer)
    backendAzureRmKey: '$(storagekey)'
- task: TerraformTaskV2@2
  inputs:
    provider: 'azurerm'
    command: 'apply'
    workingDirectory: '$(System.DefaultWorkingDirectory)/Terraform'
    commandOptions: '--auto-approve'
    environmentServiceNameAzureRM: 'ps-vs1-sc'

Here is my terraform file.

provider "azurerm" {
features {}
}

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "2.74.0"
    }
  }
}

data "azurerm_api_management" "example" {
  name                = var.apimName
  resource_group_name = var.rgName
}

resource "azurerm_api_management_api" "example" {
  name                = var.apName
  resource_group_name = var.rgName
  api_management_name = var.apimname
  revision            = "1"
  display_name        = "Example API1"
  path                = "example1"
  protocols           = ["https"]
  service_url         = "http://123.0.0.0:8000"
  subscription_required  = true

  import {
    content_format = "openapi+json"
    content_value  = #{storageaccountlink}#
     
}
Any answers would be helpful.

Mar 29 in Other DevOps Questions by Kichu
• 17,230 points
34 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

0 votes
1 answer
0 votes
1 answer

Is it possible to have a link to raw content of file in Azure DevOps

Sure, here's the call for the rests: GET ...READ MORE

answered Feb 10 in Other DevOps Questions by Bhavitha
• 980 points
59 views
0 votes
1 answer

How to include Different Types of Workitems in Boards of Azure DevOps?

Predefined backlog levels in Azure DevOps may ...READ MORE

answered Feb 11 in Other DevOps Questions by Bhavitha
• 980 points
123 views
0 votes
0 answers
0 votes
0 answers
0 votes
0 answers

Terraform and Azure DevOps pipelines

I am accessing the terraform module through ...READ MORE

Apr 22 in Other DevOps Questions by Kichu
• 17,230 points
20 views
0 votes
1 answer

Which is better azure devops or aws devops?

Hi, It depends according to your use case. ...READ MORE

answered Sep 21, 2020 in Cloud Computing by MD
• 95,340 points
1,188 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP