0
votes

I'm utilizing a common terraform module for my organization and it is located in GitHub. So, I'm accessing it through the terraform code as shown below.

module "resourcegroup" {
  source = "git::https://github.com/hashicorp/example.git//azure-modules/resourcegroup"
}

I performed the Terraform development through VS Code, so logged in to GitHub through VS Code and was able to deploy to Azure. Now, since the terraform files that I've created are located in a repo in Azure DevOps. I'm creating a build and release pipeline to automate the terraform tasks.

My build pipeline contains the following:

  • My resource is an Azure Repos Git
  • There's a Copy Files to: task and a Publish Artifact: drop task

The release pipeline contains the Terraform tasks created using the Microsoft DevLabs extension:

  • Install Terraform task
  • Terraform Init task which reads the Configuration Directory from the folder where the Build Pipeline places it.
  • Then there's the Terraform plan and apply tasks

I had also created a service connection by going to Project Settings > Service Connection > Other Git > provided the URL to GitHub where the module is located, username and the token (created through GitHub) and the checkboxes to use this connection for all pipelines are enabled

The issue that I'm having is:

  • Since the terraform files point to GitHub for building the modules, the release pipeline hangs in the task - Terraform Init
  • The error message is: Waiting for console output from an agent... (-input=false was also provided in the Terraform Init task under Additional command arguments but it didn't resolve the issue)
  • There is no option to mention the Service Connection in the Release pipeline

Since I need to access GitHub for creating the terraform modules and also use the Azure subscription under AzureRM backend configuration in Terraform Init. How do I get the pipeline working?

1

1 Answers

0
votes

The error message is: Waiting for console output from an agent...

This is normal behavior. Normally the logs pop up after the completion of the pipeline. If you want to see detailed logs please set "system.debug" as true in pipeline variables and re-run the pipeline.

Here is the case on github you can refer to.