nhurel / terraspec

Terraform unit test framework
Mozilla Public License 2.0
79 stars 7 forks source link

terraform.workspace variable does not seem supported #3

Closed tomelliot16 closed 3 years ago

tomelliot16 commented 4 years ago

terraform workpace is used to create multiple of the same tf stack. The variable terraform.workspace is is used to create unique names for resources to not collide. When terraspecing the tf code it fails with a null pointer exception. My guess is that this is just piping that has not been added yet.

tomelliot16 commented 4 years ago

@nhurel I might try and add this support myself maybe a

terraform_mock {
   workspace = "my-very-special-workspace"
}
nhurel commented 4 years ago

To be honest I don't use terraform workspace myself, so haven't looked into it but i'm definitely happy if you can submit a PR to provide this support. :+1:

tomelliot16 commented 4 years ago

To keep the domain language correct after looking under the hood I'm changing it to

mock_metadata {
  workspace = "my-very-special-workspace"
}

Glad to help, just testing what you have now gets me really excited to use it more.

tomelliot16 commented 3 years ago

Looks like this is supported now closing this