Loading...
Loading...
### Terraform Version ```shell Terraform v1.12.1 on linux_amd64 + provider registry.terraform.io/hashicorp/aws v5.99.1 + provider registry.terraform.io/hashicorp/vault v5.0.0 ``` ### Terraform Configuration Files _main.tf_: ```terraform data "aws_route53_zone" "main" { zone_id = "Z00014942GTRQHK3TIW6N" } ``` _tests/00_mock_bools.tftest.hcl_: ```terraform mock_provider "aws" { alias = "aws_mock" override_data { target = data.aws_route53_zone.main values = { arn = "arn:aws:route53:::hostedzone/Z00014942GTRQHK3TIW6N", id = "Z00014942GTRQHK3TIW6N", name = "example.com", name_servers = [ "ns-133.awsdns-41.com", "ns-1374.awsdns-51.org", "ns-536.awsdns-17.net", "ns-1688.awsdns-41.co.uk" ], primary_name_server = "ns-133.awsdns-41.com", private_zone = false, # <= This attribute is `Optional: true` resource_record_set_count = 11, tags = {}, vpc_id = null, zone_id = "Z00014942GTRQHK3TIW6N" } } } run "bools_are_null" { providers = { aws = aws.aws_mock } assert { condition = data.aws_route53_zone.main.private_zone != null error_message = <<-EOS Warning: data.aws_route53_zone.main.private_zone should not be null: ${yamlencode(data.aws_route53_zone.main.private_zone)} EOS } } ``` ### Debug Output ``` https://gist.github.com/freakinhippie/8b3cede13effa0f2f7e0751ee4320668 ``` ### Expected Behavior `terraform test` should complete successfully ### Actual Behavior ```sh > terraform test tests/00_mock_bools.tftest.hcl... in progress run "bools_are_null"... fail ╷ │ Error: Test assertion failed │ │ on tests/00_mock_bools.tftest.hcl line 32, in run "bools_are_null": │ 32: condition = data.aws_route53_zone.main.private_zone != null │ ├──────────────── │ │ Warning: LHS and RHS values are of different types │ │ │ Warning: data.aws_route53_zone.main.private_zone should not be null: │ │ null │ ... ╵ tests/00_mock_bools.tftest.hcl... tearing down tests/00_mock_bools.tftest.hcl... fail Failure! 0 passed, 1 failed. ``` ### Steps to Reproduce ```sh # clone the demo repo git clone https://github.com/freakinhippie/terraform-bug-reports.git # move into the repo and checkout the appropriate revision cd terraform-bug-reports/ git checkout schema.TypeBool # move into the stack directory to illustrate the error cd stacks/tfmock_optional_bool/ # run terraform terraform init terraform test ``` ### Additional Context N/A ### References _No response_ ### Generative AI / LLM assisted development? 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.