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, 2022 in Other DevOps Questions by Kichu
• 19,050 points
581 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, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
407 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, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
1,345 views
0 votes
0 answers

unable to install mcafee-epo from azure devops

When I run the command 'pip install ...READ MORE

Mar 20, 2022 in Other DevOps Questions by Kichu
• 19,050 points
339 views
0 votes
0 answers

Is there a way to embed a framework for ios build in Azure DevOps?

I want to build an IPA package ...READ MORE

Mar 20, 2022 in Other DevOps Questions by Kichu
• 19,050 points
449 views
0 votes
1 answer
0 votes
0 answers

Terraform and Azure DevOps pipelines

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

Apr 22, 2022 in Other DevOps Questions by Kichu
• 19,050 points
703 views
0 votes
2 answers

Which is better azure devops or aws devops?

Azure DevOps, a part of Microsoft's cloud ...READ MORE

answered Jan 8 in Cloud Computing by anonymous
• 700 points
2,012 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP