Skip to content

Commit

Permalink
implement Import
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Jul 8, 2020
1 parent 374c14c commit ad28ed0
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 ad28ed0

Please sign in to comment.