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

When condition on resource which has its own type property fails #731

Open
imens-frankd opened this issue Feb 19, 2024 · 1 comment
Open
Assignees
Labels

Comments

@imens-frankd
Copy link

When condition on resource which has its own type property fails

Since azuread_application_permission_scope doesn't have a name property I want to exlude it from the scenario that I use to ensure all resource names are lower case. I have done the same for azuread_application which works.
It doesn't work for azuread_application_permission_scope and the test fails.
I suspect that it has something to do with the fact that azuread_application_permission_scope itself has a property called type.

To Reproduce

Feature File:

@case-sensitive
Scenario: Ensure all azure ad resource names are all lowercase
    Given I have resource that supports name defined
    When its provider_name is registry.terraform.io/hashicorp/azuread
    When its type is not azuread_application
    When its type is not azuread_application_permission_scope
    Then it must have name
    And its value must match the "^[a-z-0-9]+$" regex

Plan File:

Sample Terraform Code:

resource "azuread_application_permission_scope" "example" {
  application_id             = azuread_application.app.id
  admin_consent_description  = "Example permission"
  admin_consent_display_name = "example-permission"
  scope_id                   = random_uuid.uuid_permission_scope.id
  type                       = "Admin"
  value                      = "example-permission"
}

Used terraform-compliance Parameters:

podman run --rm -v ./:/target -i eerkunt/terraform-compliance -f features -p main.tfplan.json

Running via Docker:

Yes

Running container with podman v4.9.2

Error Output:

Test scenario fails

Expected Behavior:

Test scenario is skipped for resource of type azuread_application_permission_scope

Tested Versions:

  • terraform-compliance version: v1.3.47
  • terraform version: v1.7.3
  • python version: your python runtime version, if running as a python package

Additional Context:

Using provider registry.terraform.io/hashicorp/azuread v2.47.0

@imens-frankd
Copy link
Author

Below is part of the plan file that describes the resource

{"address":"azuread_application_permission_scope.example","mode":"managed","type":"azuread_application_permission_scope","name":"example","provider_name":"registry.terraform.io/hashicorp/azuread","schema_version":0,"values":{"admin_consent_description":"Example permission","admin_consent_display_name":"example-permission","application_id":"/applications/8a6246ce-89f4-495d-b222-e8c3ae152e13","timeouts":null,"type":"Admin","user_consent_description":null,"user_consent_display_name":null,"value":"example-permission"},"sensitive_values":{}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants