Loading...
Loading...
### Terraform Version ``` (base) ubuntu@:~/datakube/modules/terraform_test$ terraform version Terraform v1.1.4 on linux_amd64 ``` ### Terraform Configuration Files the `main.tf` file ```terraform variable "input" { type = string } variable "namespace" { type = string default = "processing" } variable "test_process" { type = string default = "test" } output "foo" { value = "foo value ${var.input}" } output "k8s_creds" { value = kubernetes_secret.uplifted_user_creds.metadata[0].name } resource "kubernetes_secret" "uplifted_user_creds" { metadata { name = "${var.namespace}-aws-creds-${var.test_process}" namespace = var.namespace } data = { } type = "Opaque" } ``` the `test.tf` file ``` terraform { required_providers { test = { source = "terraform.io/builtin/test" } } } module "main" { source = "../.." input = "boop" } resource "test_assertions" "foo" { component = "foo" equal "output" { description = "output \"foo\" value" got = module.main.foo want = "foo value boop" } } resource "test_assertions" "creds" { component = "cred" equal "output" { description = "output \"foo\" value" got = module.main.k8s_creds want = "foo value boop" } } ``` ### Debug Output ``` (base) ubuntu@:~/datakube/modules/terraform_test$ terraform test ╷ │ Warning: The "terraform test" command is experimental │ │ We'd like to invite adventurous module authors to write integration tests for their modules using this command, but all of the behaviors of this command are currently experimental and may change based on feedback. │ │ For more information on the testing experiment, including ongoing research goals and avenues for feedback, see: │ https://www.terraform.io/docs/language/modules/testing-experiment.html ╵ Success! All of the test assertions passed. ``` ### Expected Behavior the `test_assertions` `creds` should fail as the output of `kubernetes_secret.uplifted_user_creds.metadata[0].name` should be `processing-aws-creds-test`. ### Actual Behavior the test for it passed, indicating `terraform test` sees the output of `kubernetes_secret.uplifted_user_creds.metadata[0].name` equal to `foo value boop` ### Steps to Reproduce `terraform test` ### Additional Context Nil ### References N/A
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.