Skip to content
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

Merged
merged 3 commits into from
Jul 13, 2020
Merged

Fix addr and ID usage for import #24

merged 3 commits into from
Jul 13, 2020

Conversation

paultyng
Copy link
Contributor

@paultyng paultyng commented Jul 11, 2020

Also, fix minor issue of orphaned installed directories.

This is dependent upon #23

@paultyng paultyng requested a review from kmoe July 11, 2020 01:53
@@ -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 {
Copy link
Contributor Author

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.

Copy link
Member

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...

@paultyng
Copy link
Contributor Author

Need to add a runtime test

@kmoe
Copy link
Member

kmoe commented Jul 13, 2020

Failing test:

--- FAIL: TestCheckpointDisablePropagation (0.11s)
    terraform_test.go:58: expected command env to be [FOOBAR=1 CHECKPOINT_DISABLE=1 TF_LOG=], but it was [CHECKPOINT_DISABLE=1 FOOBAR=1 TF_LOG=]
FAIL

I think this test is flaky but this is the first time I've caught it in a build. Will fix separately.

paultyng added 2 commits July 13, 2020 10:50
Also reorg test fixtures to prep for more fixtures
Add runtime testing of import across multiple versions of TF
Copy link
Member

@kmoe kmoe left a 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 {
Copy link
Member

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 {
Copy link
Member

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.

@paultyng paultyng merged commit 505c2b1 into splitfiles Jul 13, 2020
@paultyng paultyng deleted the fiximport branch July 13, 2020 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants