remove Terraform targets (#1970)

This commit is contained in:
Moritz Sanft 2023-06-27 11:27:50 +02:00 committed by GitHub
parent 0a36ce6171
commit fe0b8c1e5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 43 deletions

View file

@ -96,7 +96,7 @@ func (c *Client) PrepareUpgradeWorkspace(path, oldWorkingDir, newWorkingDir, bac
}
// CreateCluster creates a Constellation cluster using Terraform.
func (c *Client) CreateCluster(ctx context.Context, logLevel LogLevel, targets ...string) (CreateOutput, error) {
func (c *Client) CreateCluster(ctx context.Context, logLevel LogLevel) (CreateOutput, error) {
if err := c.setLogLevel(logLevel); err != nil {
return CreateOutput{}, fmt.Errorf("set terraform log level %s: %w", logLevel.String(), err)
}
@ -105,12 +105,7 @@ func (c *Client) CreateCluster(ctx context.Context, logLevel LogLevel, targets .
return CreateOutput{}, fmt.Errorf("terraform init: %w", err)
}
opts := []tfexec.ApplyOption{}
for _, target := range targets {
opts = append(opts, tfexec.Target(target))
}
if err := c.tf.Apply(ctx, opts...); err != nil {
if err := c.tf.Apply(ctx); err != nil {
return CreateOutput{}, fmt.Errorf("terraform apply: %w", err)
}
@ -292,7 +287,7 @@ func (c *Client) CreateIAMConfig(ctx context.Context, provider cloudprovider.Pro
// Plan determines the diff that will be applied by Terraform. The plan output is written to the planFile.
// If there is a diff, the returned bool is true. Otherwise, it is false.
func (c *Client) Plan(ctx context.Context, logLevel LogLevel, planFile string, targets ...string) (bool, error) {
func (c *Client) Plan(ctx context.Context, logLevel LogLevel, planFile string) (bool, error) {
if err := c.setLogLevel(logLevel); err != nil {
return false, fmt.Errorf("set terraform log level %s: %w", logLevel.String(), err)
}
@ -304,9 +299,6 @@ func (c *Client) Plan(ctx context.Context, logLevel LogLevel, planFile string, t
opts := []tfexec.PlanOption{
tfexec.Out(planFile),
}
for _, target := range targets {
opts = append(opts, tfexec.Target(target))
}
return c.tf.Plan(ctx, opts...)
}