Giter Club home page Giter Club logo

Comments (4)

hideto0710 avatar hideto0710 commented on August 11, 2024

related hashicorp/terraform#21393 ??

I could fix it by using TF_WORKSPACE

from terraform-github-actions.

sudomateo avatar sudomateo commented on August 11, 2024

Good point! Using TF_WORKSPACE is the preferred method. Glad you're unblocked for now.

from terraform-github-actions.

sudomateo avatar sudomateo commented on August 11, 2024

I tested the TF_WORKSPACE environment variable. It's currently the best method to select a workspace during automation.

from terraform-github-actions.

davehewy avatar davehewy commented on August 11, 2024

After following the thread to the bottom a concoction of all your ideas will work.

desired_workspace="test"
export TF_WORKSPACE="default"
terraform init -input=false
# without unsetting the env var it will bork workspace selection command
unset TF_WORKSPACE 
exists=$(terraform workspace list | sed $'s/\r//' | grep -E "(^|\s+)${desired_workspace}$" > /dev/null 2>&1; echo $?)
if [ "${exists}" = "0" ]; then
  terraform workspace select ${desired_workspace}
else
  terraform workspace new ${desired_workspace}
fi

from terraform-github-actions.

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.