Repository navigation
feat: support Terraform path references - #9
SulimanAbdulrazzaq wants to merge 4 commits into
Conversation
|
@SulimanAbdulrazzaq this is for #5 ? |
The CLI passed the state store workspace id, a generated UUID, as the terraform.workspace value, so expressions saw the UUID instead of the workspace name that Terraform returns (for example "default"). Keep the workspace name on the engine next to the path values and use it when evaluating plan, apply, destroy, and output expressions. State reads and writes still use the workspace id. Add a CLI regression test that applies a configuration whose output is terraform.workspace and checks the stored value.
|
@chaitanya-sistla yes, this is for #5, following the implementation proposal there.
Because of those gaps I changed Validation at 696743c: |
|
@chaitanya-sistla could you approve the CI workflow on this one when you have a moment? As I confirmed above, it's for #5: |
|
approved @SulimanAbdulrazzaq |
|
@chaitanya-sistla thanks for the approval! I pushed 4a6fd1d to get CI green:
|
|
@chaitanya-sistla when you have a moment, could one of you approve the workflow runs and take a look at this one? No checks have run on the current head yet. |
|
@SulimanAbdulrazzaq done |
@SulimanAbdulrazzaq we might have to cut a release for 0.4.5 |
|
@SulimanAbdulrazzaq security and clippy failed. |
… lint async-trait 0.1.89 generates a #[must_use] on its boxed futures, which newer clippy rejects (dtolnay/async-trait#303); 0.1.92 drops it. Only the lockfile changes; syn 3 is added because async-trait 0.1.91 moved to it.
|
@chaitanya-sistla thanks for re-running it. Clippy: it failed on Security Audit: it still fails, and not because of this PR: |
|
@SulimanAbdulrazzaq i triggered again |
Summary
Refs #5.
path.module,path.root, andpath.cwd) and the workspace name into the evaluation context used by plan, apply, destroy, and output evaluationterraform.workspaceas the active workspace's name (for exampledefault), not its state store idoutput "workspace" { value = terraform.workspace }and checks the stored outputNot covered yet:
path.*still resolves to an empty string duringcount/for_eachexpansion, provider configuration, variable defaults, and drift address expansion. The built-in functions listed in the audit in #5 (file(),templatefile(), and others) are left for separate issues, as that proposal suggests.Validation
Run at 696743c in a Linux Codespace (rustc 1.98.1, protoc 3.21.12):
cargo fmt --all -- --check: cleancargo test: 123 passed, 0 failed, 21 ignored (the e2e suite)cargo test --test path_references_test: 4 passed; the new CLI test fails on the previous head, where the output is the workspace UUID instead ofdefaultcargo clippy --all-targets -- -D warnings: fails only onclippy::for_kv_mapinsrc/main.rs, which fails the same way onmain(1f335eb); with that lint allowed, clippy passes with no warningsNot run: the ignored e2e tests, which download providers.