Ask Your Question

How can multiple directories with a primary Terraform file be used in conjunction with Terraform Cloud, Github, and Azure?

asked 2021-08-26 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-10-28 04:00:00 +0000

pufferfish gravatar image

There are several steps to follow to use multiple directories with a primary Terraform file in conjunction with Terraform Cloud, Github, and Azure:

  1. Create a new repository on Github and clone it to your local machine.

  2. Set up Terraform Cloud workspace and link it to your Github repository.

  3. Create a directory structure that separates your Terraform code into multiple directories/modules.

  4. Create the primary Terraform file in the root directory that references the other modules.

  5. Ensure that your modules are self-contained and have their own resources and variables.

  6. In the primary Terraform file, use the module keyword to reference the other modules:

    module "module1" { source = "./module1" }

  7. Set up the Azure provider in your Terraform code.

  8. In the Terraform Cloud workspace, set up the environment variables for your Azure credentials to access your resources.

  9. Test your Terraform code by running it locally and pushing it to Github.

  10. Finally, trigger a plan and apply in your Terraform Cloud workspace to deploy the infrastructure to Azure.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2021-08-26 11:00:00 +0000

Seen: 1 times

Last updated: Oct 28 '22