Loading...
Loading...
### Terraform Version ```shell Terraform v1.6.4 on linux_amd64 + provider registry.terraform.io/hashicorp/random v3.5.1 # Also same results in 1.5.6. ``` ### Terraform Configuration Files ```terraform ### /main.tf module "good" { source = "./modules" } resource "random_string" "root" { length = 2 special = false keepers = { ts = timestamp() } } ### modules/main.tf resource "random_string" "this" { length = 2 special = false keepers = { ts = timestamp() } } ``` ### Debug Output https://gist.github.com/staranto/896d17262a2058273b246522facfb1f1 ### Expected Behavior I'd expect `terraform console` to allow me to inspect state resources created in modules. If this isn't the case, perhaps the [console docs](https://developer.hashicorp.com/terraform/cli/commands/console) needs changed? In particular, this statement -- > You can use it to test interpolations before using them in configurations and to interact with any values currently saved in state. ### Actual Behavior Error. See below. ### Steps to Reproduce ``` # Clean. No init or state. > ls --tree drwxrwxr-x - 16 Nov 06:12 . drwxrwxr-x - 16 Nov 06:10 ├── modules .rw-rw-r-- 108 16 Nov 06:10 │ └── main.tf .rw-rw-r-- 150 16 Nov 06:08 └── main.tf > terraform init > terraform apply --auto-apply ... Apply complete! Resources: 2 added, 0 changed, 0 destroyed. > terraform state list random_string.root module.good.random_string.this # This works as expected > echo 'random_string.root' | terraform console { "id" = "D6" "keepers" = tomap({ "ts" = "2023-11-16T11:16:27Z" }) } # This fails. Does console not support inspecting # resources in modules? echo 'module.good.random_string.this' | terraform console ╷ │ Error: Unsupported attribute │ │ on line 1: │ (source code not available) │ │ This object does not have an attribute named "random_string". # Terraform recognizes that there is a module.good > echo 'module.good' | terraform console {} > echo 'module.goodXXX' | terraform console ╷ │ Error: Reference to undeclared module │ │ on line 1: │ (source code not available) │ │ No module call named "goodXX" is declared in the root module. Did you mean "good"? ``` ### Additional Context _No response_ ### References _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.