Skip to content

Commit

Permalink
remove incorrect option
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Aug 19, 2022
1 parent 23c89bc commit 01c0dca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
13 changes: 1 addition & 12 deletions tfexec/force_unlock.go
Expand Up @@ -5,20 +5,14 @@ import (
"os/exec"
)

type forceUnlockConfig struct {
dir string
}
type forceUnlockConfig struct{}

var defaultForceUnlockOptions = forceUnlockConfig{}

type ForceUnlockOption interface {
configureForceUnlock(*forceUnlockConfig)
}

func (opt *DirOption) configureForceUnlock(conf *forceUnlockConfig) {
conf.dir = opt.path
}

// ForceUnlock represents the `terraform force-unlock` command
func (tf *Terraform) ForceUnlock(ctx context.Context, lockID string, opts ...ForceUnlockOption) error {
unlockCmd := tf.forceUnlockCmd(ctx, lockID, opts...)
Expand All @@ -41,10 +35,5 @@ func (tf *Terraform) forceUnlockCmd(ctx context.Context, lockID string, opts ...
// positional arguments
args = append(args, lockID)

// optional positional arguments
if c.dir != "" {
args = append(args, c.dir)
}

return tf.buildTerraformCmd(ctx, nil, args...)
}
11 changes: 0 additions & 11 deletions tfexec/force_unlock_test.go
Expand Up @@ -28,15 +28,4 @@ func TestForceUnlockCmd(t *testing.T) {
"12345",
}, nil, forceUnlockCmd)
})

t.Run("override all defaults", func(t *testing.T) {
forceUnlockCmd := tf.forceUnlockCmd(context.Background(), "12345", Dir("mydir"))

assertCmd(t, []string{
"force-unlock",
"-no-color",
"-force",
"mydir",
}, nil, forceUnlockCmd)
})
}

0 comments on commit 01c0dca

Please sign in to comment.