mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-07 06:22:17 -04:00
cli: fix iam rollback (#1148)
* AB#2897 rename DestroyCluster * #AB2897 error if terraform dir exists * AB#2897 reword DestroyResources
This commit is contained in:
parent
94245416ca
commit
7410cf8038
11 changed files with 92 additions and 32 deletions
|
@ -197,6 +197,10 @@ func (c *iamCreator) create(ctx context.Context) error {
|
|||
}
|
||||
c.log.Debugf("Using flags: %+v", flags)
|
||||
|
||||
if err := c.checkWorkingDir(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !flags.yesFlag {
|
||||
c.cmd.Printf("The following IAM configuration will be created:\n\n")
|
||||
c.providerCreator.printConfirmValues(c.cmd, flags)
|
||||
|
@ -275,6 +279,17 @@ func (c *iamCreator) parseFlagsAndSetupConfig() (iamFlags, error) {
|
|||
return flags, nil
|
||||
}
|
||||
|
||||
// checkWorkingDir checks if the current working directory already contains a Terraform dir or a Constellation config file.
|
||||
func (c *iamCreator) checkWorkingDir() error {
|
||||
if _, err := c.fileHandler.Stat(constants.TerraformIAMWorkingDir); err == nil {
|
||||
return fmt.Errorf("the current working directory already contains the %s directory. Please run the command in a different directory", constants.TerraformIAMWorkingDir)
|
||||
}
|
||||
if _, err := c.fileHandler.Stat(constants.ConfigFilename); err == nil {
|
||||
return fmt.Errorf("the current working directory already contains the %s file. Please run the command in a different directory", constants.ConfigFilename)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// iamFlags contains the parsed flags of the iam create command, including the parsed flags of the selected cloud provider.
|
||||
type iamFlags struct {
|
||||
aws awsFlags
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue