Git Product home page Git Product logo

terraform-on-demand-trigger-demo's Introduction

Terraform On-Demand Trigger Demo

This repository demonstrates a specific issue encountered with dynamic updates in Terraform and provides a solution leveraging the features introduced in Terraform >= 1.4.

The Issue

In cloud provisioning scenarios—such as deploying EC2 instances, it's often easier to dynamically fetching the latest available version of a resource. This is typically achieved using a data block or fetching the recommended version from AWS Systems Manager (SSM). The challenge arises because these updates are not under direct control: re-applying the Terraform configuration, even without changes, might inadvertently trigger an update if a new version becomes available. This behavior can lead to unintended deployments and configuration drift.

The Solution

Terraform 1.4 introduces the terraform_data resource, which can be considered an enhanced version of the traditional null_resource. A key feature of the terraform_data resource is its ability to store any value within the Terraform state. Like null_resource, terraform_data is a resource object, which allows for the use of lifecycle policies to control its value. Specifically, one can use ignore_changes to prevent updates to the input, while updating its value can be managed through the replace_triggered_by, which conditions the recreation of the resource on changes to a manually adjustable value. This approach provides a controlled environment for managing updates, ensuring that changes are deliberate and predictable.

terraform-on-demand-trigger-demo's People

Contributors

ammarlakis 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.