Linked Questions

Popular Questions

Calling Terraform from Ansible

Asked by At

When i am using terraform modules directly being called from shell scripts it works fine.

But when i am wrapping same shell script which is called from an ansible task it fails. validated all the environment variables for ARM credentials which are being passed. All are fine, but somehow not getting any success to run terraform as an ansible task.

Below is the error I get

Error refreshing state: 1 error(s) occurred:\n\n* module.oracle_server.provider.azurerm: Unable to list provider registration status, it is possible that this is due to invalid credentials or the service principal does not have permission to use the Resource Manager API, Azure error: azure.BearerAuthorizer#WithAuthorization: Failed to refresh the Token for request to https://management.azure.com/subscriptions/****/providers?api-version=2016-02-01: StatusCode=0 -- Original Error: adal:

UPDATEd by the editor

Please update your ansible codes here, more than in comment, lost all format.

- name: Terraform Module 
  terraform: 
    project_path: "{{ terraform_module_path }}" 
    state: "{{ item.infra_state }}" 
    variables: 
      platform: "{{ platform }}" 
      application_name: "{{ application_name }}" 
      environment: "{{ env }}"

Related Questions