Coder Social home page Coder Social logo

terraform-runtriggers-azure's Introduction

Terraform Run Triggers (Azure)

Terraform Run Triggers are a way to connect a child workspace to one or more source (root) workspaces. Run Triggers allow runs to queue automatically in your child workspace(s) on successful apply of runs in any of the source workspaces.

This example repo aims to simulate Run Triggers in an Azure environment.

  • source-workspace creates an Azure Service Principal for authentication and outputs details
    • Outputs are marked as 'sensitive' to prevent plaintext storage in Terraform state
  • child-workspace calls this newly created SP via the Remote State Data Source, authenticates to Azure, and creates resources (a simple resource group)

Important Notes

  • This example can be modified to provision multiple SPs using for_each for multi-tenant deployments.
  • The SP created by source-workspace must have specific permissions (you can use 'Owner' for testing purposes)
    • Contributor and one of the following sets:
      • AppRoleAssignment.ReadWrite.All and Application.Read.All; or
      • AppRoleAssignment.ReadWrite.All and Directory.Read.All; or
      • Application.ReadWrite.All; or
      • Directory.ReadWrite.All

Usage

  1. Clone or fork this repo
  2. Set org name in backend.tf in each workspace directory and in remote_state.tf in child-workspace
  3. Commit changes (if using Version Control workflow) or save changes (if using CLI-driven workflow)
  4. Create two workspaces in TFC/E:
    • az-srcwksp
    • az-chwksp
  5. If using VC workflow, be sure to specify the path for each workspace
    • Ex. /source-workspace/ for az-srcwksp
  6. Add 'src-wksp' to 'ch-wksp' as a source workspace via instructions here
  7. Authenticate to Azure
  8. Perform a successful run on the source workspace
    • once complete, a plan will automatically run on the child workspace

Other Resources

HashiCorp Learn - Run Triggers

Remote State Data Source

Cross-Workspace State Access

Workspace Permissions

terraform-runtriggers-azure's People

Contributors

officialjaware avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.