Giter VIP home page Giter VIP logo

Comments (5)

japsen avatar japsen commented on July 26, 2024

Having this would have saved me many hours of manual work.

from terraform-provider-digitalocean.

ksanderer avatar ksanderer commented on July 26, 2024

@japsen I've achieved such functionality by encapsulating persistent infrastructure in separate terraform project. It looks like this:

  1. Create teraform project with persistant objects, describe volumes and add them to the output.tf
  2. In the main terraform project:
// -----------------------------------------------
// External persistent state (volumes, ssh_keys, etc)
// -----------------------------------------------

data "terraform_remote_state" "persistent" {
  backend = "local"

  config {
    path = "${path.cwd}/persistent/terraform.tfstate"
  }
}

Now you can reach volumes from the external terraform state like this:

${data.terraform_remote_state.persistent.do_ssh_key}

And they can't be affected by any operation in the main terraform project.

from terraform-provider-digitalocean.

japsen avatar japsen commented on July 26, 2024

@ksanderer wow, that's a great solution. Way better than creating volumes manually and fetching their id's via the DO API. I Will definitely implement it when deploying a new project if the 'detach_only' option is not available yet by then.

from terraform-provider-digitalocean.

ap1969 avatar ap1969 commented on July 26, 2024

@ksanderer Thanks for sharing the solution. This is a great idea, and can be used in lots of other situations as well. Appreciate your advice.

from terraform-provider-digitalocean.

danielsreichenbach avatar danielsreichenbach commented on July 26, 2024

This seems to be the perfect use case for using distinct environments to deploy pieces of infrastructure that should have only immutable access to other resources.

This talk describes the concepts quite nicely.

from terraform-provider-digitalocean.

Related Issues (20)

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.