Skip to content

Commit 7c3372a

Browse files
committed
updates
1 parent 15807b6 commit 7c3372a

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

internal/exec/terraform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func ExecuteTerraform(info schema.ConfigAndStacksInfo) error {
228228
- Environment variables: variables set as environment variables using the TF_VAR_ prefix
229229
- Default values in the configuration file: these have the lowest priority
230230
*/
231-
if cliVars, ok := info.ComponentSection[cfg.CliVarsSectionName].(map[string]any); ok && len(cliVars) > 0 {
231+
if cliVars, ok := info.ComponentSection[cfg.TerraformCliVarsSectionName].(map[string]any); ok && len(cliVars) > 0 {
232232
u.LogDebug(atmosConfig, "\nCLI variables (will override the variables defined in the stack manifests):")
233233
if atmosConfig.Logs.Level == u.LogLevelTrace || atmosConfig.Logs.Level == u.LogLevelDebug {
234234
err = u.PrintAsYAMLToFileDescriptor(atmosConfig, cliVars)

internal/exec/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ func ProcessStacks(
674674
if err != nil {
675675
return configAndStacksInfo, err
676676
}
677-
configAndStacksInfo.ComponentSection[cfg.CliVarsSectionName] = cliVars
677+
configAndStacksInfo.ComponentSection[cfg.TerraformCliVarsSectionName] = cliVars
678678

679679
return configAndStacksInfo, nil
680680
}

pkg/config/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const (
6262
InheritanceSectionName = "inheritance"
6363
IntegrationsSectionName = "integrations"
6464
GithubSectionName = "github"
65-
CliVarsSectionName = "cli_vars"
65+
TerraformCliVarsSectionName = "tf_cli_vars"
6666
CliArgsSectionName = "cli_args"
6767

6868
LogsLevelFlag = "--logs-level"

tests/fixtures/scenarios/complete/stacks/schemas/opa/test/template-functions-test/validate-template-functions-test-component.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package atmos
55
# If the 'errors' output contains one or more error messages, Atmos considers the policy failed
66

77
errors["for the 'template-functions-test' component, the variable 'name' must be provided on the command line using the '-var' flag"] {
8-
not input.cli_vars.name
8+
not input.tf_cli_vars.name
99
}
1010

1111
# https://www.openpolicyagent.org/docs/latest/policy-language

website/docs/core-concepts/validate/terraform-variables.mdx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ For example:
2525

2626
<Terminal>
2727
```shell
28-
atmos terraform apply <component> -s <stack> -var name=api
28+
atmos terraform apply <component> -s <stack> -- -var name=api
2929

30-
## double-dash -- can be used to signify the end of the options for Atmos and the start
31-
## of the additional native arguments and flags for the Terraform commands
3230
atmos terraform apply <component> -s <stack> -- -var name=api -var 'tags={"Team":"api", "Group":"web"}'
3331
```
3432
</Terminal>
3533

3634
:::tip
37-
Double-dash `--` can be used to signify the end of the options for Atmos and the start
35+
Use double-dash `--` to signify the end of the options for Atmos and the start
3836
of the additional native arguments and flags for the Terraform commands.
3937

4038
Refer to [Terraform CLI commands usage](/cli/commands/terraform/usage) for more details.
@@ -60,7 +58,7 @@ For example:
6058
<Terminal>
6159
```console
6260
ATMOS_LOGS_LEVEL=Trace /
63-
atmos terraform apply my-component -s plat-ue2-dev -var name=api -var 'tags={"Team":"api", "Group":"web"}'
61+
atmos terraform apply my-component -s plat-ue2-dev -- -var name=api -var 'tags={"Team":"api", "Group":"web"}'
6462

6563
Variables for the component 'my-component' in the stack 'plat-ue2-dev':
6664
environment: ue2
@@ -80,7 +78,7 @@ tags:
8078
```
8179
</Terminal>
8280

83-
Atmos exposes the Terraform variables passed on the command line in the `cli_vars` section, which can be used in
81+
Atmos exposes the Terraform variables passed on the command line in the `tf_cli_vars` section, which can be used in
8482
OPA policies for validation.
8583

8684
## Terraform Variables Validation using OPA Policies
@@ -133,7 +131,7 @@ package atmos
133131
# If the 'errors' output contains one or more error messages, Atmos considers the policy failed.
134132

135133
errors["for the 'my-component' component, the variable 'name' must be provided on the command line using the '-var' flag"] {
136-
not input.cli_vars.name
134+
not input.tf_cli_vars.name
137135
}
138136
```
139137
</File>
@@ -155,7 +153,7 @@ On the other hand, when passing the `name` variable on the command line using th
155153

156154
<Terminal>
157155
```shell
158-
atmos terraform apply my-component -s plat-ue2-dev -var name=api
156+
atmos terraform apply my-component -s plat-ue2-dev -- -var name=api
159157
```
160158
</Terminal>
161159

@@ -169,7 +167,7 @@ add the following OPA policy in the file `stacks/schemas/opa/my-component/valida
169167
package atmos
170168
171169
errors["for the 'my-component' component, the variable 'name' cannot be overridden on the command line using the '-var' flag"] {
172-
input.cli_vars.name
170+
input.tf_cli_vars.name
173171
}
174172
```
175173
</File>
@@ -179,7 +177,7 @@ the component from being provisioned:
179177

180178
<Terminal>
181179
```console
182-
atmos terraform apply my-component -s plat-ue2-dev -var name=api
180+
atmos terraform apply my-component -s plat-ue2-dev -- -var name=api
183181

184182
Validating the component 'my-component' using OPA file 'my-component/validate-my-component.rego'
185183

0 commit comments

Comments
 (0)