-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix addr and ID usage for import #24
Conversation
@@ -75,8 +67,8 @@ 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...) | |||
func (t *Terraform) Import(ctx context.Context, address, id string, opts ...ImportOption) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have these as explicit strings here instead of the options model since they are required for this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reasonable, but it means a breaking change for tfexec if terraform import
gains or loses required arguments during future terraform
versions.
To my knowledge there is no other terraform
subcommand with required arguments, but I may be wrong...
Need to add a runtime test |
Failing test:
I think this test is flaky but this is the first time I've caught it in a build. Will fix separately. |
Also reorg test fixtures to prep for more fixtures
Add runtime testing of import across multiple versions of TF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about required arguments for Import
, but would be happy to go with this API and possibly break it later. Otherwise LGTM.
@@ -75,8 +67,8 @@ 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...) | |||
func (t *Terraform) Import(ctx context.Context, address, id string, opts ...ImportOption) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reasonable, but it means a breaking change for tfexec if terraform import
gains or loses required arguments during future terraform
versions.
To my knowledge there is no other terraform
subcommand with required arguments, but I may be wrong...
@@ -40,6 +32,11 @@ func Backup(path string) *BackupOption { | |||
return &BackupOption{path} | |||
} | |||
|
|||
// DisableBackup is a convenience method for Backup("-"), indicating backup state should be disabled. | |||
func DisableBackup() *BackupOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with this direction - we can provide more convenience options as use cases become clear.
Also, fix minor issue of orphaned installed directories.
This is dependent upon #23