Hacker News new | ask | show | jobs
by pushpop 2653 days ago
Yeah I got that. My point is that ‘workspace’ isn’t a Boolean flag in terraform. It requires additional flags to function, eg

  terraform workspace new granra
‘workspace’ is effectively the CLI flags equivalent of a submenu.
1 comments

Oh I see. It looks like docli sets the flag as true if it was passed as a parameter to the program.

So you do:

var terraform Terraform

args.Bind(&terraform)

if terraform.Workspace {

  // do workspace stuff
}

I think.

EDIT: I don't know how hackernews formatting works :/

That seems really messy to be honest because you can’t then ensure flags are nested correctly.

I guess for simple purposes this is fine though.