Skip to content

Commit 57da145

Browse files
remove language experiment, this is guarded by being in an alpha release
1 parent 264d206 commit 57da145

File tree

3 files changed

+8
-48
lines changed

3 files changed

+8
-48
lines changed

internal/experiments/experiment.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ const (
2525
PreconditionsPostconditions = Experiment("preconditions_postconditions")
2626
EphemeralValues = Experiment("ephemeral_values")
2727
UnknownInstances = Experiment("unknown_instances")
28-
Actions = Experiment("actions")
2928
)
3029

3130
func init() {
3231
// Each experiment constant defined above must be registered here as either
3332
// a current or a concluded experiment.
34-
registerCurrentExperiment(Actions)
3533
registerConcludedExperiment(UnknownInstances, "Unknown instances are being rolled into a larger feature for deferring unready resources and modules.")
3634
registerConcludedExperiment(VariableValidation, "Custom variable validation can now be used by default, without enabling an experiment.")
3735
registerConcludedExperiment(VariableValidationCrossRef, "Input variable validation rules may now refer to other objects in the same module without enabling any experiment.")

internal/terraform/context_plan_actions_test.go

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func TestContextPlan_actions(t *testing.T) {
3434
"unreferenced": {
3535
module: map[string]string{
3636
"main.tf": `
37-
terraform { experiments = [actions] }
3837
action "test_unlinked" "hello" {}
3938
`,
4039
},
@@ -44,7 +43,6 @@ action "test_unlinked" "hello" {}
4443
"invalid config": {
4544
module: map[string]string{
4645
"main.tf": `
47-
terraform { experiments = [actions] }
4846
action "test_unlinked" "hello" {
4947
config {
5048
unknown_attr = "value"
@@ -60,8 +58,8 @@ action "test_unlinked" "hello" {
6058
Detail: `An argument named "unknown_attr" is not expected here.`,
6159
Subject: &hcl.Range{
6260
Filename: filepath.Join(m.Module.SourceDir, "main.tf"),
63-
Start: hcl.Pos{Line: 5, Column: 5, Byte: 87},
64-
End: hcl.Pos{Line: 5, Column: 17, Byte: 99},
61+
Start: hcl.Pos{Line: 4, Column: 5, Byte: 49},
62+
End: hcl.Pos{Line: 4, Column: 17, Byte: 61},
6563
},
6664
})
6765
},
@@ -70,7 +68,6 @@ action "test_unlinked" "hello" {
7068
"before_create triggered": {
7169
module: map[string]string{
7270
"main.tf": `
73-
terraform { experiments = [actions] }
7471
action "test_unlinked" "hello" {}
7572
resource "test_object" "a" {
7673
lifecycle {
@@ -88,7 +85,6 @@ resource "test_object" "a" {
8885
"after_create triggered": {
8986
module: map[string]string{
9087
"main.tf": `
91-
terraform { experiments = [actions] }
9288
action "test_unlinked" "hello" {}
9389
resource "test_object" "a" {
9490
lifecycle {
@@ -106,7 +102,6 @@ resource "test_object" "a" {
106102
"before_update triggered - on create": {
107103
module: map[string]string{
108104
"main.tf": `
109-
terraform { experiments = [actions] }
110105
action "test_unlinked" "hello" {}
111106
resource "test_object" "a" {
112107
lifecycle {
@@ -124,7 +119,6 @@ resource "test_object" "a" {
124119
"after_update triggered - on create": {
125120
module: map[string]string{
126121
"main.tf": `
127-
terraform { experiments = [actions] }
128122
action "test_unlinked" "hello" {}
129123
resource "test_object" "a" {
130124
lifecycle {
@@ -142,7 +136,6 @@ resource "test_object" "a" {
142136
"before_update triggered - on update": {
143137
module: map[string]string{
144138
"main.tf": `
145-
terraform { experiments = [actions] }
146139
action "test_unlinked" "hello" {}
147140
resource "test_object" "a" {
148141
lifecycle {
@@ -167,7 +160,6 @@ resource "test_object" "a" {
167160
"after_update triggered - on update": {
168161
module: map[string]string{
169162
"main.tf": `
170-
terraform { experiments = [actions] }
171163
action "test_unlinked" "hello" {}
172164
resource "test_object" "a" {
173165
lifecycle {
@@ -192,7 +184,6 @@ resource "test_object" "a" {
192184
"before_update triggered - on replace": {
193185
module: map[string]string{
194186
"main.tf": `
195-
terraform { experiments = [actions] }
196187
action "test_unlinked" "hello" {}
197188
resource "test_object" "a" {
198189
lifecycle {
@@ -218,7 +209,6 @@ resource "test_object" "a" {
218209
"after_update triggered - on replace": {
219210
module: map[string]string{
220211
"main.tf": `
221-
terraform { experiments = [actions] }
222212
action "test_unlinked" "hello" {}
223213
resource "test_object" "a" {
224214
lifecycle {
@@ -244,7 +234,6 @@ resource "test_object" "a" {
244234
"action for_each": {
245235
module: map[string]string{
246236
"main.tf": `
247-
terraform { experiments = [actions] }
248237
action "test_unlinked" "hello" {
249238
for_each = toset(["a", "b"])
250239
@@ -268,7 +257,6 @@ resource "test_object" "a" {
268257
"action for_each with auto-expansion": {
269258
module: map[string]string{
270259
"main.tf": `
271-
terraform { experiments = [actions] }
272260
action "test_unlinked" "hello" {
273261
for_each = toset(["a", "b"])
274262
@@ -292,7 +280,6 @@ resource "test_object" "a" {
292280
"action count": {
293281
module: map[string]string{
294282
"main.tf": `
295-
terraform { experiments = [actions] }
296283
action "test_unlinked" "hello" {
297284
count = 2
298285
@@ -317,7 +304,6 @@ resource "test_object" "a" {
317304
"action count with auto-expansion": {
318305
module: map[string]string{
319306
"main.tf": `
320-
terraform { experiments = [actions] }
321307
action "test_unlinked" "hello" {
322308
count = 2
323309
@@ -342,7 +328,6 @@ resource "test_object" "a" {
342328
"action for_each invalid access": {
343329
module: map[string]string{
344330
"main.tf": `
345-
terraform { experiments = [actions] }
346331
action "test_unlinked" "hello" {
347332
for_each = toset(["a", "b"])
348333
@@ -373,7 +358,6 @@ resource "test_object" "a" {
373358
"action count invalid access": {
374359
module: map[string]string{
375360
"main.tf": `
376-
terraform { experiments = [actions] }
377361
action "test_unlinked" "hello" {
378362
count = 2
379363
@@ -404,7 +388,6 @@ resource "test_object" "a" {
404388
"expanded resource - unexpanded action": {
405389
module: map[string]string{
406390
"main.tf": `
407-
terraform { experiments = [actions] }
408391
action "test_unlinked" "hello" {}
409392
resource "test_object" "a" {
410393
count = 2
@@ -424,7 +407,6 @@ resource "test_object" "a" {
424407
toBeImplemented: true, // TODO: Not sure why this panics
425408
module: map[string]string{
426409
"main.tf": `
427-
terraform { experiments = [actions] }
428410
action "test_unlinked" "hello" {
429411
count = 2
430412
@@ -450,7 +432,6 @@ resource "test_object" "a" {
450432
"transitive dependencies": {
451433
module: map[string]string{
452434
"main.tf": `
453-
terraform { experiments = [actions] }
454435
resource "test_object" "a" {
455436
name = "a"
456437
}
@@ -476,7 +457,6 @@ resource "test_object" "b" {
476457
"expanded transitive dependencies": {
477458
module: map[string]string{
478459
"main.tf": `
479-
terraform { experiments = [actions] }
480460
resource "test_object" "a" {
481461
name = "a"
482462
}
@@ -528,7 +508,6 @@ resource "test_object" "e" {
528508
"failing actions cancel next ones": {
529509
module: map[string]string{
530510
"main.tf": `
531-
terraform { experiments = [actions] }
532511
action "test_unlinked" "failure" {}
533512
resource "test_object" "a" {
534513
lifecycle {
@@ -563,7 +542,6 @@ resource "test_object" "a" {
563542
"actions cant be accessed in resources": {
564543
module: map[string]string{
565544
"main.tf": `
566-
terraform { experiments = [actions] }
567545
action "test_unlinked" "my_action" {
568546
config {
569547
attr = "value"
@@ -588,8 +566,8 @@ resource "test_object" "a" {
588566
Detail: "Actions can't be referenced in this context, they can only be referenced from within a resources lifecycle events list.",
589567
Subject: &hcl.Range{
590568
Filename: filepath.Join(m.Module.SourceDir, "main.tf"),
591-
Start: hcl.Pos{Line: 9, Column: 10, Byte: 150},
592-
End: hcl.Pos{Line: 9, Column: 40, Byte: 180},
569+
Start: hcl.Pos{Line: 8, Column: 10, Byte: 112},
570+
End: hcl.Pos{Line: 8, Column: 40, Byte: 142},
593571
},
594572
})
595573
},
@@ -598,7 +576,6 @@ resource "test_object" "a" {
598576
"actions cant be accessed in outputs": {
599577
module: map[string]string{
600578
"main.tf": `
601-
terraform { experiments = [actions] }
602579
action "test_unlinked" "my_action" {
603580
config {
604581
attr = "value"
@@ -630,8 +607,8 @@ output "my_output2" {
630607
Detail: "Actions can't be referenced in this context, they can only be referenced from within a resources lifecycle events list.",
631608
Subject: &hcl.Range{
632609
Filename: filepath.Join(m.Module.SourceDir, "main.tf"),
633-
Start: hcl.Pos{Line: 22, Column: 13, Byte: 375},
634-
End: hcl.Pos{Line: 22, Column: 43, Byte: 405},
610+
Start: hcl.Pos{Line: 21, Column: 13, Byte: 337},
611+
End: hcl.Pos{Line: 21, Column: 43, Byte: 367},
635612
},
636613
}).Append(
637614
&hcl.Diagnostic{
@@ -640,8 +617,8 @@ output "my_output2" {
640617
Detail: "Actions can't be referenced in this context, they can only be referenced from within a resources lifecycle events list.",
641618
Subject: &hcl.Range{
642619
Filename: filepath.Join(m.Module.SourceDir, "main.tf"),
643-
Start: hcl.Pos{Line: 18, Column: 13, Byte: 302},
644-
End: hcl.Pos{Line: 18, Column: 43, Byte: 332},
620+
Start: hcl.Pos{Line: 17, Column: 13, Byte: 264},
621+
End: hcl.Pos{Line: 17, Column: 43, Byte: 294},
645622
},
646623
},
647624
)

internal/terraform/node_action.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
package terraform
55

66
import (
7-
"fmt"
8-
97
"github.com/hashicorp/terraform/internal/addrs"
108
"github.com/hashicorp/terraform/internal/configs"
119
"github.com/hashicorp/terraform/internal/dag"
12-
"github.com/hashicorp/terraform/internal/experiments"
1310
"github.com/hashicorp/terraform/internal/lang/langrefs"
1411
"github.com/hashicorp/terraform/internal/providers"
1512
"github.com/hashicorp/terraform/internal/tfdiags"
@@ -97,18 +94,6 @@ func (n *nodeExpandActionDeclaration) DynamicExpand(ctx EvalContext) (*Graph, tf
9794

9895
// Check if the actions language experiment is enabled for this module.
9996
moduleCtx := evalContextForModuleInstance(ctx, module)
100-
allowActions := moduleCtx.LanguageExperimentActive(experiments.Actions)
101-
if !allowActions {
102-
summary := fmt.Sprintf("Actions experiment not enabled for module %s", module)
103-
if module.IsRoot() {
104-
summary = "Actions experiment not enabled"
105-
}
106-
return nil, diags.Append(tfdiags.Sourceless(
107-
tfdiags.Error,
108-
summary,
109-
"The actions experiment must be enabled in order to use actions in your configuration. You can enable it by adding a terraform { experiments = [actions] } block to your configuration.",
110-
))
111-
}
11297

11398
// recordActionData is responsible for informing the expander of what
11499
// repetition mode this resource has, which allows expander.ExpandResource

0 commit comments

Comments
 (0)