Skip to content

[Automated] Update terraform CLI Options#2572

Merged
thomhurst merged 1 commit into
mainfrom
automated/update-cli-options-terraform
May 3, 2026
Merged

[Automated] Update terraform CLI Options#2572
thomhurst merged 1 commit into
mainfrom
automated/update-cli-options-terraform

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

This PR contains automatically generated updates to terraform CLI options classes.

The generator scraped the latest CLI help output from the installed tool.

Changes

  • Updated options classes to reflect latest CLI documentation
  • Added new commands if any were detected
  • Updated option types and descriptions

Verification

  • Solution builds successfully

🤖 Generated with ModularPipelines.OptionsGenerator

@thomhurst thomhurst added automated dependencies Pull requests that update a dependency file labels May 3, 2026
@thomhurst thomhurst temporarily deployed to Pull Requests May 3, 2026 03:43 — with GitHub Actions Inactive
@thomhurst thomhurst temporarily deployed to Pull Requests May 3, 2026 03:43 — with GitHub Actions Inactive
@thomhurst thomhurst temporarily deployed to Pull Requests May 3, 2026 03:43 — with GitHub Actions Inactive
@thomhurst thomhurst enabled auto-merge (squash) May 3, 2026 03:43
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0 (≤ 20 complexity)

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Automated Terraform CLI Options Update

Overview

This automated PR syncs the Terraform options classes from the installed CLI binary. It adds two new service methods (TerraformState.Pull(), TerraformProviders.Schema()), two new options classes, adds -var-file across 12+ existing options classes, adds -test-directory to a few classes, and fixes a duplicate-word typo in TerraformTestOptions.


⚠️ Primary Concern: -var-file Added to Commands That Don't Support It

This is the most significant issue in the PR. The generator appears to have treated -var-file as a global option and applied it to every subcommand. In Terraform's actual CLI, -var-file is only valid for commands that evaluate configuration and consume input variables: apply, plan, destroy, refresh, import, console, and test.

The following commands do not accept -var-file, so a user setting VarFile on these options classes will get a runtime CLI error with no compile-time warning — which defeats the entire purpose of a strongly-typed options API:

  • terraform state mv / rm / push / pull / replace-provider — state manipulation doesn't use variable files
  • terraform graph — graph output doesn't consume variables
  • terraform providers / providers lock / providers mirror / providers schema
  • terraform modules, terraform init, terraform get, terraform taint, terraform validate

Why this matters architecturally: The value proposition of these generated options classes is correctness — they should represent the actual CLI surface. Exposing VarFile on TerraformStateRmOptions is actively misleading and will cause silent runtime failures.

Recommended fix: Update tools/ModularPipelines.OptionsGenerator/ to filter out options that don't apply to a given subcommand, e.g., via a (command, option) denylist or by parsing per-subcommand help output independently from global help output. This is a generator-level fix, not a generated-file fix.


⚠️ VarFile Typed as string? But Supports Multiple Values

Every VarFile property carries the doc comment:

"Use this option more than once to include more than one variables file."

Yet the property is typed as string?, which only allows one file. A user needing multiple var files has no type-safe way to express that.

Suggested type: IEnumerable<string>? (or string[]?), assuming the [CliOption] attribute in this framework supports collection rendering. This is a pre-existing issue that this PR expands the surface area of.


⚠️ New TerraformProvidersSchemaOptions Is Missing Its Key Flag

terraform providers schema requires -json — without it the command is not useful (it's the only output mode). The new options class only exposes VarFile (which, per the above, doesn't apply) and omits -json. A complete class would be:

[CliFlag("-json")]
public bool? Json { get; set; }

⚠️ New TerraformStatePullOptions Has No Applicable Options

terraform state pull takes no flags — it simply dumps the state to stdout. The generated class only contains VarFile, which is inapplicable. The class should either be empty or contain only inheritable common options that genuinely apply.


✅ Positives

  • TerraformState.Pull() and TerraformProviders.Schema() are legitimate missing methods — these are real, useful Terraform subcommands and adding them to the service layer is correct.
  • Docstring typo fix in TerraformTestOptions ("using the the -cloud-run option""using the -cloud-run option") is a clean improvement.
  • The overall generation pattern is consistent with existing classes.

Summary

The two new service methods and the typo fix are good changes. However, the -var-file propagation to non-applicable commands is a systematic generator issue that risks shipping a misleading public API. The root fix belongs in the generator's option-filtering logic. Merging as-is means 13+ options classes will expose a property that silently causes runtime failures when used.

@thomhurst thomhurst merged commit ac31a13 into main May 3, 2026
12 checks passed
@thomhurst thomhurst deleted the automated/update-cli-options-terraform branch May 3, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant