You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(cfn-lang-ext): correct language-extensions precedence order (#9042)
The activation precedence was documented as CLI > env var > samconfig.toml,
but the actual behavior is CLI > samconfig.toml > env var. samconfig values
are loaded into Click's default_map by configuration_callback, so by the
time resolve_language_extensions_enabled runs, flag_value is already
non-None and the env var is never consulted.
Reorder the methods to match runtime behavior, drop the misleading word
"equivalent", and add brief notes explaining why samconfig outranks the
env var and when the env var is actually read.
Copy file name to clipboardExpand all lines: docs/cfn-language-extensions.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ The original template (with `Fn::ForEach` intact) is preserved for CloudFormatio
17
17
18
18
## Enabling Language Extensions
19
19
20
-
Local processing of `AWS::LanguageExtensions` is opt-in per command. Three equivalent activation methods, in priority order:
20
+
Local processing of `AWS::LanguageExtensions` is opt-in per command. Three activation methods, in priority order (highest first):
21
21
22
22
1.**CLI flag** — pass `--language-extensions` on a single invocation:
23
23
@@ -27,19 +27,9 @@ Local processing of `AWS::LanguageExtensions` is opt-in per command. Three equiv
27
27
sam deploy --language-extensions ...
28
28
```
29
29
30
-
`--no-language-extensions` explicitly disables, overriding the env var below.
30
+
`--no-language-extensions` explicitly disables, overriding both samconfig.toml and the env var below.
31
31
32
-
2.**Environment variable** — set `SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1` to enable for the current shell:
33
-
34
-
```bash
35
-
export SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1
36
-
sam build
37
-
sam local invoke MyFunction
38
-
```
39
-
40
-
Truthy values (case-insensitive): `1`, `true`, `yes`. Anything else, including empty string, is off.
41
-
42
-
3.**`samconfig.toml`** — persist the choice per project:
32
+
2.**`samconfig.toml`** — persist the choice per project:
43
33
44
34
```toml
45
35
[default.build.parameters]
@@ -67,6 +57,18 @@ Local processing of `AWS::LanguageExtensions` is opt-in per command. Three equiv
67
57
language_extensions = true
68
58
```
69
59
60
+
A `samconfig.toml` entry is loaded into Click's defaults, so it takes effect as if the flag were passed — and therefore wins over the env var.
61
+
62
+
3.**Environment variable** — set `SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1` to enable for the current shell:
63
+
64
+
```bash
65
+
export SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1
66
+
sam build
67
+
sam local invoke MyFunction
68
+
```
69
+
70
+
Truthy values (case-insensitive): `1`, `true`, `yes`. Anything else, including empty string, is off. The env var is consulted only when neither the CLI flag nor samconfig.toml sets a value.
71
+
70
72
**Each command needs its own activation.** Passing `--language-extensions` to `sam build` does not propagate to a later `sam local invoke` — local processing is decided per command invocation. Use the env var or samconfig entry to enable across commands without repeating the flag.
0 commit comments