I have been spending quite a bit of time coming up to speed on Terraform. Terraform Enterprise is a SaaS application that helps teams use Terraform together. It manages Terraform runs in a consistent and reliable environment, and includes easy access to shared state and secret data, access controls for approving changes to infrastructure, a private registry for sharing Terraform modules, detailed policy controls for governing the contents of Terraform configurations, and more.
When using Terraform Enterprise, you must create a terraformrc (Linux/MacOS) or terraform.rc (Windows) which contains the credential token for “app.terraform.io”. This is a token you create within the Terraform Enterprise setup.

Inside of your Terraform configuration file, you need to add the terraform section to indicate you want execution and state to happen within the Terraform Enterprise

If you are using Azure DevOps pipelines to perform your Terraform tasks, you will need a way to have this file present when the pipelines kickoff but we don’t want to store something like this in source control. There are a couple of different ways you can do this but I prefer the following approach:
Note: I am assuming you have already configured a pipeline to package/push your Terraform configuration files to the artifacts location.
- Azure DevOps has a feature called Secure Files that allows you to upload files that are encrypted as rest. They cannot been seen or modified once they are uploaded. However, they can be made available to your pipelines. Create your terraform.rc file as indicated above and upload into Azure DevOps Secure Files Library

- Inside your pipeline, Add the Download Secure File task from the Market Place and add a task to your pipeline. Be sure to the set the “Reference Name” in the classic editor or the “name” property in the YAML version so that we can reference this file path later

- Add a Power Shell task to your pipeline that will move the secure file to pipeline agent working location so that Terraform can find it using the “Reference Name” variable we set above

- Add the addition Terraform tasks with simple init, plan, or apply and Terraform will be able to leverage your Enterprise account
Never stop learning and keep moving forward!










