What are the plans for the terraform test command road map

I’m not sure where the main discussion for the terraform test command lives so I started this topic because I’d like to know what plans there are for its future?

I’ve just started using it in the last month. I’ve made a few modules that use the command exclusively as a test framework.

I would like to be able to write integration and unit test in Terraform as opposed to using a framework based on another language like Go, Python, etc.

My argument for that is because it creates a barrier. I work at a company with over 1000 engineers, we have a large Terraform code base. We exclusively use Terratest. Its difficult to get new developers to dive into learning Terraform and then also right into writing test since they need to learn the Go language, at least enough to understand how to write basic integration test. As a result, the load has been put off to a chosen few to keep writing test for modules we develop.

I believe that if terrafom test were further developed and pulled out of experimental phase and into full development phase, I could easily make an argument for switching for the following reasons:

  1. You can write test in the same language as the module you are developing.
  2. It would be considered supported by HashiCorp long-term and safe to use.
  3. Existing limitations we could vote for to be fixed based on urgency.

Right now you can do a lot of basic test with the experiment as it stands. This aws-tf-s3-website module I have developed recently sets up a website (using S3 and CloudFront for HTTPS support). The test sets up all the infrastructure, uploads a simple web page, then asserts on the HTTPS response body:

resource "test_assertions" "website_deployed" {
  component = "website_deployed"

  depends_on = [
    module.main,
    data.http.test_page_response,
  ]

  # assert a domain validation was made

  # asserts that:
  # a bucket with the domain name was made
  # files cab be uploaded to the bucket
  # the policy on the bucket allows access from this CloudFront distribution
  # a valid ACM certificate was issue for the domain
  # HTTPS is working via the CloudFront distribution
  equal "get_response" {
    description = "assert response from fixture test page"
    want        = "hi world!"
    got         = data.http.test_page_response.response_body
  }
}

I’ve said a bit, so let me stop here.

Hey there, thanks for writing this up! My name is Omar and I’m the PM for Terraform Core.

Glad to see you’ve used it. I can completely understand the sentiment and your arguments are completely valid.

We are actually actively thinking about terraform test’s future and what a significantly better UX would look like. Would you be open to chatting? Would love to hear what you ideas you have in mind and understand the types of integration and unit tests you are looking to write.

Feel free to send me an email oismail@hashicorp.com or directly book a time to chat: Calendly - Omar Ismail

Excellent that this finally got released in Terraform version 1.6. I’m already started to upgrade the previous experiments to the official released test framework.