Skip to content

Commit

Permalink
Rename cloudcmd plan functions
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Oct 30, 2023
1 parent df61985 commit d4bba80
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/internal/cloudcmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (a *Applier) Plan(ctx context.Context, conf *config.Config) (bool, error) {
return false, fmt.Errorf("creating terraform variables: %w", err)
}

return planApply(
return plan(
ctx, a.terraformClient, a.fileHandler, a.out, a.logLevel, vars,
filepath.Join(constants.TerraformEmbeddedDir, strings.ToLower(conf.GetProvider().String())),
a.workingDir,
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cloudcmd/iamupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewIAMUpgrader(ctx context.Context, existingWorkspace, upgradeWorkspace str
// PlanIAMUpgrade prepares the upgrade workspace and plans the possible Terraform migrations for Constellation's IAM resources (service accounts, permissions etc.).
// In case of possible migrations, the diff is written to outWriter and this function returns true.
func (u *IAMUpgrader) PlanIAMUpgrade(ctx context.Context, outWriter io.Writer, vars terraform.Variables, csp cloudprovider.Provider) (bool, error) {
return planApply(
return plan(
ctx, u.tf, u.fileHandler, outWriter, u.logLevel, vars,
filepath.Join(constants.TerraformEmbeddedDir, "iam", strings.ToLower(csp.String())),
u.existingWorkspace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/edgelesssys/constellation/v2/internal/file"
)

// planApply prepares a workspace and plans the possible Terraform actions.
// plan prepares a workspace and plans the possible Terraform actions.
// This will either create a new workspace or update an existing one.
// In case of possible migrations, the diff is written to outWriter and this function returns true.
func planApply(
func plan(
ctx context.Context, tfClient tfPlanner, fileHandler file.Handler,
outWriter io.Writer, logLevel terraform.LogLevel, vars terraform.Variables,
templateDir, existingWorkspace, backupDir string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestPlanUpgrade(t *testing.T) {
func TestTFPlan(t *testing.T) {
const (
templateDir = "templateDir"
existingWorkspace = "existing"
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestPlanUpgrade(t *testing.T) {
assert := assert.New(t)
fs := tc.prepareFs(require.New(t))

hasDiff, planErr := planApply(
hasDiff, planErr := plan(
context.Background(), tc.tf, fs, io.Discard, terraform.LogLevelDebug,
&terraform.QEMUVariables{},
templateDir, existingWorkspace, backupDir,
Expand Down

0 comments on commit d4bba80

Please sign in to comment.