Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation condition #24

Open
devops-rob opened this issue Oct 13, 2020 · 0 comments
Open

Validation condition #24

devops-rob opened this issue Oct 13, 2020 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@devops-rob
Copy link
Owner

Upon testing the validation in the secrets_engines variable, I've learned that it does not behave as expected. The variable block with validation looks like this

variable "secrets_engines" {
  type        = list(string)
  default     = null
  description = "A list of secrets engines to enable"

  validation {
    condition     = can(contains(
    [
      "aws",
      "azure",
      "gcp",
      "consul",
      "pki",
      "transit",
      "rabbitmq",
      "ssh"
    ], var.secrets_engines))
    error_message = "Invalid secrets engines."
  }
}

Expected behaviour

when i use the module with the following configuration (which includes a deliberately misspelled engine), i expect to see "Invalid secrets engines." error message when i run a terraform plan.

module "aws_defaults" {
  source = "../../"

  secrets_engines       = ["awz"]
  aws_backend_role_name = "test"
  aws_iam_groups        = ["test"]
}

Actual behaviour

The output of a terraform plan shows the below

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

It's correct that no changes are detected as the count of the resources is based on the secrets engines being in the list; however, i expect the plan to fail as the validation should detect that the misspelled secrets engine has failed the validation condition.

@devops-rob devops-rob added bug Something isn't working help wanted Extra attention is needed labels Oct 13, 2020
@devops-rob devops-rob added this to the v0.1.0-rc milestone Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant