Skip to content

Commit

Permalink
Merge pull request #20 from hashicorp/implement-import
Browse files Browse the repository at this point in the history
implement Import
  • Loading branch information
kmoe authored Jul 8, 2020
2 parents 119839f + ad28ed0 commit b853ce3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tfexec/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,20 @@ func (opt *VarFileOption) configureImport(conf *importConfig) {
conf.varFile = opt.path
}

func (t *Terraform) Import(ctx context.Context, opts ...ImportOption) error {
importCmd := t.ImportCmd(ctx, opts...)

var errBuf strings.Builder
importCmd.Stderr = &errBuf

err := importCmd.Run()
if err != nil {
return parseError(errBuf.String())
}

return nil
}

type outputConfig struct {
state string
json bool
Expand Down

0 comments on commit b853ce3

Please sign in to comment.