Giter VIP home page Giter VIP logo

Comments (9)

smitthakkar96 avatar smitthakkar96 commented on June 14, 2024 1

Maybe instead of using -statefile= use https://www.terraform.io/docs/language/files/override.html

from tfmigrate.

minamijoyo avatar minamijoyo commented on June 14, 2024

Hi, thank you for opening this!
Because I'm not terragrunt user, so I'm not sure why is it not enough to run the custom command before the tfmigrate command?

from tfmigrate.

ITJamie avatar ITJamie commented on June 14, 2024

Terragrunt generates files that may not exist in the folder. Having the ability to make tfmigrate run an alternate re-init command is important for users of terragrunt. Literally just running terragrunt init instead of terraform init.

This can be down to the fact that things like remote state config commands are just not in standard tf files in a lot of terragrunt based configs

from tfmigrate.

minamijoyo avatar minamijoyo commented on June 14, 2024

You can replace terraform command to terragrunt with exporting an environment variable TFMIGRATE_EXEC_PATH=terragrunt. I guess it's what you request.

from tfmigrate.

ITJamie avatar ITJamie commented on June 14, 2024

from tfmigrate.

minamijoyo avatar minamijoyo commented on June 14, 2024

Again I'm not terragrunt user, at least please provide executable examples to help us understand what you are trying. There are some issues claimed that the tfmigrate doesn't work with terragrunt, but no one provide executable examples to me.

In addition, if you have any idea to resolve the conflict by adding new pre-plan / pre-apply hooks, could you clarify how to use and how it works. The word pre- is very ambiguous when the hook is invoked.

from tfmigrate.

smitthakkar96 avatar smitthakkar96 commented on June 14, 2024

Hey I think I can provide more context here. Terragrunt has a feature to auto generate remote_state config using a block like below. Before any terragrunt command runs backend.tf is auto-generated. This means you there is no effect when you run terragrunt plan --state=/tmp/hello.plan it will still look for the state file mentioned in the backend.tf which is auto generated.

remote_state = {
  backend = "s3"
  generate = {
    path      = "${get_terragrunt_dir()}/backend.tf"
    if_exists = "overwrite"
  }
  config = {
    encrypt = true
    bucket  = local.env_vars.bucket
    key     = "${local.env_vars.remote_state_path_prefix}/${replace(path_relative_to_include(), "../", "")}/terraform.tfstate"
    region  = local.env_vars.region
    profile = local.env_vars.account
  }
}

Unfortunately I don't have an open-source example, but I am happy to make one and update the comment later in the day.

from tfmigrate.

smitthakkar96 avatar smitthakkar96 commented on June 14, 2024

It would be less complicated if temporarily you update the remote state when running plan and rollback. I know this changes behaviour and might not be desirable to everyone but maybe have a flag to support this.

from tfmigrate.

minamijoyo avatar minamijoyo commented on June 14, 2024

I have no plans to implement this feature as is at this time, but there have been a few reports of the tfmigrate does not work with the terragrunt, so if you have problems with the terragrunt, please feel free to open a new issue with minimal reproductive examples so that someone can help debugging with you. Thanks!

from tfmigrate.

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.