Skip to content

Commit

Permalink
experiments: config_driven_move has concluded
Browse files Browse the repository at this point in the history
Based on feedback during earlier alpha releases, we've decided to move
forward with the current design for the first phase of config-driven
refactoring.

Therefore here we've marked the experiment as concluded with no changes
to the most recent incarnation of the functionality. The other changes
here are all just updating test fixtures to no longer declare that they
are using experimental features.
  • Loading branch information
apparentlymart committed Nov 1, 2021
1 parent 51bf9fd commit 94cbc8f
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 54 deletions.
4 changes: 0 additions & 4 deletions internal/command/testdata/show-json/moved-drift/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ resource "test_instance" "should_refresh_with_move" {
ami = "baz"
}

terraform {
experiments = [ config_driven_move ]
}

moved {
from = test_instance.should_refresh
to = test_instance.should_refresh_with_move
Expand Down
4 changes: 0 additions & 4 deletions internal/command/testdata/show-json/moved/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ resource "test_instance" "baz" {
ami = "baz"
}

terraform {
experiments = [ config_driven_move ]
}

moved {
from = test_instance.foo
to = test_instance.baz
Expand Down
11 changes: 0 additions & 11 deletions internal/configs/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,6 @@ func checkModuleExperiments(m *Module) hcl.Diagnostics {
}
}

if !m.ActiveExperiments.Has(experiments.ConfigDrivenMove) {
for _, mc := range m.Moved {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Config-driven move is experimental",
Detail: "This feature is currently under development and is not yet fully-functional.\n\nIf you'd like to try the partial implementation that exists so far, add config_driven_move to the set of active experiments for this module.",
Subject: mc.DeclRange.Ptr(),
})
}
}

return diags
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
terraform {
# For the moment this is experimental
experiments = [config_driven_move]
}

moved {
from = test.foo
to = test.bar
Expand Down
2 changes: 1 addition & 1 deletion internal/experiments/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func init() {
// a current or a concluded experiment.
registerConcludedExperiment(VariableValidation, "Custom variable validation can now be used by default, without enabling an experiment.")
registerConcludedExperiment(SuppressProviderSensitiveAttrs, "Provider-defined sensitive attributes are now redacted by default, without enabling an experiment.")
registerConcludedExperiment(ConfigDrivenMove, "Declarations of moved resource instances using \"moved\" blocks can now be used by default, without enabling an experiment.")
registerCurrentExperiment(ModuleVariableOptionalAttrs)
registerCurrentExperiment(ConfigDrivenMove)
}

// GetCurrent takes an experiment name and returns the experiment value
Expand Down
12 changes: 6 additions & 6 deletions internal/refactoring/move_statement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func TestImpliedMoveStatements(t *testing.T) {
Implied: true,
DeclRange: tfdiags.SourceRange{
Filename: "testdata/move-statement-implied/move-statement-implied.tf",
Start: tfdiags.SourcePos{Line: 9, Column: 1, Byte: 232},
End: tfdiags.SourcePos{Line: 9, Column: 32, Byte: 263},
Start: tfdiags.SourcePos{Line: 5, Column: 1, Byte: 180},
End: tfdiags.SourcePos{Line: 5, Column: 32, Byte: 211},
},
},
{
Expand All @@ -107,8 +107,8 @@ func TestImpliedMoveStatements(t *testing.T) {
Implied: true,
DeclRange: tfdiags.SourceRange{
Filename: "testdata/move-statement-implied/move-statement-implied.tf",
Start: tfdiags.SourcePos{Line: 14, Column: 11, Byte: 334},
End: tfdiags.SourcePos{Line: 14, Column: 12, Byte: 335},
Start: tfdiags.SourcePos{Line: 10, Column: 11, Byte: 282},
End: tfdiags.SourcePos{Line: 10, Column: 12, Byte: 283},
},
},

Expand All @@ -123,8 +123,8 @@ func TestImpliedMoveStatements(t *testing.T) {
Implied: true,
DeclRange: tfdiags.SourceRange{
Filename: "testdata/move-statement-implied/move-statement-implied.tf",
Start: tfdiags.SourcePos{Line: 50, Column: 1, Byte: 858},
End: tfdiags.SourcePos{Line: 50, Column: 27, Byte: 884},
Start: tfdiags.SourcePos{Line: 46, Column: 1, Byte: 806},
End: tfdiags.SourcePos{Line: 46, Column: 27, Byte: 832},
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# conforms to the statements encoded in the resource names. It's for
# TestImpliedMoveStatements only.

terraform {
experiments = [config_driven_move]
}

resource "foo" "formerly_count" {
# but not count anymore
}
Expand Down
12 changes: 0 additions & 12 deletions internal/terraform/context_plan2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,6 @@ func TestContext2Plan_movedResourceBasic(t *testing.T) {
from = test_object.a
to = test_object.b
}
terraform {
experiments = [config_driven_move]
}
`,
})

Expand Down Expand Up @@ -1026,10 +1022,6 @@ func TestContext2Plan_movedResourceUntargeted(t *testing.T) {
from = test_object.a
to = test_object.b
}
terraform {
experiments = [config_driven_move]
}
`,
})

Expand Down Expand Up @@ -1222,10 +1214,6 @@ func TestContext2Plan_movedResourceRefreshOnly(t *testing.T) {
from = test_object.a
to = test_object.b
}
terraform {
experiments = [config_driven_move]
}
`,
})

Expand Down

0 comments on commit 94cbc8f

Please sign in to comment.