Skip to content

plantimestamp function not available to tests #36858

Open
@KyleKotowick

Description

@KyleKotowick

Terraform Version

Terraform v1.11.3
on windows_amd64

Terraform Configuration Files

Available here as a complete config: https://github.com/Invicton-Labs/terraform-aws-plantimestamp-error

variables.tf

variable "myvar" {
  type     = string
  nullable = false
}

tests/main.tftest.hcl

# This one works fine
run "timestamp" {
  command = plan
  variables {
    myvar = timestamp()
  }
}

# This one does not
run "plantimestamp" {
  command = plan
  variables {
    # This function really should exist: 
    # https://developer.hashicorp.com/terraform/language/functions/plantimestamp
    myvar = plantimestamp()
  }
}

Debug Output

https://gist.github.com/KyleKotowick/cd54de2a28bc33326cdc6aa356163220

Expected Behavior

This function should work in tests, it certainly does exist:
https://developer.hashicorp.com/terraform/language/functions/plantimestamp

Actual Behavior

│ Error: Call to unknown function
│
│   on tests\main.tftest.hcl line 15, in run "plantimestamp":
│   15:     myvar = plantimestamp()
│
│ There is no function named "plantimestamp".

This function apparently doesn't exist for tests.

Steps to Reproduce

  1. terraform test

Additional Context

No response

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions