mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-08 01:05:16 -04:00
cli: add --workspace
flag to set base directory for Constellation workspace (#2148)
* Remove `--config` and `--master-secret` falgs * Add `--workspace` flag * In CLI, only work on files with paths created from `cli/internal/cmd` * Properly print values for GCP on IAM create when not directly updating the config --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
ec33530c38
commit
d1ace13713
57 changed files with 966 additions and 1145 deletions
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
||||
"github.com/edgelesssys/constellation/v2/internal/config"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
"github.com/edgelesssys/constellation/v2/internal/imagefetcher"
|
||||
)
|
||||
|
||||
|
@ -31,7 +30,7 @@ import (
|
|||
type Creator struct {
|
||||
out io.Writer
|
||||
image imageFetcher
|
||||
newTerraformClient func(ctx context.Context) (tfResourceClient, error)
|
||||
newTerraformClient func(ctx context.Context, workspace string) (tfResourceClient, error)
|
||||
newLibvirtRunner func() libvirtRunner
|
||||
newRawDownloader func() rawDownloader
|
||||
policyPatcher policyPatcher
|
||||
|
@ -42,8 +41,8 @@ func NewCreator(out io.Writer) *Creator {
|
|||
return &Creator{
|
||||
out: out,
|
||||
image: imagefetcher.New(),
|
||||
newTerraformClient: func(ctx context.Context) (tfResourceClient, error) {
|
||||
return terraform.New(ctx, constants.TerraformWorkingDir)
|
||||
newTerraformClient: func(ctx context.Context, workspace string) (tfResourceClient, error) {
|
||||
return terraform.New(ctx, workspace)
|
||||
},
|
||||
newLibvirtRunner: func() libvirtRunner {
|
||||
return libvirt.New()
|
||||
|
@ -57,10 +56,11 @@ func NewCreator(out io.Writer) *Creator {
|
|||
|
||||
// CreateOptions are the options for creating a Constellation cluster.
|
||||
type CreateOptions struct {
|
||||
Provider cloudprovider.Provider
|
||||
Config *config.Config
|
||||
image string
|
||||
TFLogLevel terraform.LogLevel
|
||||
Provider cloudprovider.Provider
|
||||
Config *config.Config
|
||||
TFWorkspace string
|
||||
image string
|
||||
TFLogLevel terraform.LogLevel
|
||||
}
|
||||
|
||||
// Create creates the handed amount of instances and all the needed resources.
|
||||
|
@ -74,7 +74,7 @@ func (c *Creator) Create(ctx context.Context, opts CreateOptions) (clusterid.Fil
|
|||
}
|
||||
opts.image = image
|
||||
|
||||
cl, err := c.newTerraformClient(ctx)
|
||||
cl, err := c.newTerraformClient(ctx, opts.TFWorkspace)
|
||||
if err != nil {
|
||||
return clusterid.File{}, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue