tf-compliance is unable to find Amazon MSK cluster resource from the plan.out.json file
To Reproduce
Feature File:
Feature: Test for properties on Kafka
Test for broker logs, broker nodes and encryption
Scenario: kafka must have broker logs enabled
Given I have aws msk cluster resource configured
Then it must have logging_info
Then it must have broker_logs enabled
Scenario: kafka version test
Given I have aws_msk_cluster defined
When it has kafka_version
Then its kafka_version must be 2.8.0
Used terraform-compliance Parameters:
-p and -f only
Running via Docker:
No
Error Output:
Scenario: kafka must have broker logs enabled
💡 SKIPPING: Can not find aws msk cluster defined in target terraform plan.
Given I have aws msk cluster resource configured
Then it must have logging_info
Then it must have broker_logs enabled
Scenario: kafka version test
💡 SKIPPING: Can not find aws_msk_cluster defined in target terraform plan.
Given I have aws_msk_cluster defined
When it has kafka_version
Then its kafka_version must be 2.8.0
Expected Behavior:
Terraform-compliance must be able to find the aws_msk_resource resource and perform negative test
Tested Versions:
terraform-compliance version: v1.3.43
terraform version: v1.4.6
python version: 3.11.3
Additional Context:
The terraform plan snippet is present under configuration/root_module
Description
tf-compliance is unable to find Amazon MSK cluster resource from the plan.out.json file
To Reproduce
Feature File:
Plan File: { "address": "aws_msk_cluster.general-kafka-cluster", "mode": "managed", "type": "aws_msk_cluster", "name": "some-kafka-cluster", "provider_config_key": "aws", "expressions": { "broker_node_group_info": [ { "client_subnets": { "references": [ "data.something.value" ] }, "instance_type": { "references": [ "var.kafka_type" ] }, "security_groups": { "references": [ "aws_security_group.some_sg.id", "aws_security_group.some1_sg" ] }, "storage_info": [ { "ebs_storage_info": [ { "volume_size": { "references": [ "var.kafka_size" ] } } ] } ] } ], "cluster_name": { "references": [ "var.pre_name" ] }, "encryption_info": [ { "encryption_in_transit": [ { "client_broker": { "constant_value": "TLS" }, "in_cluster": { "constant_value": true } } ] } ], "enhanced_monitoring": { "references": [ "var.monitoring_level" ] }, "kafka_version": { "references": [ "var.kafka_version" ] }, "logging_info": [ { "broker_logs": [ { "s3": [ { "bucket": { "references": [ "var.prefix" ] }, "enabled": { "constant_value": true }, "prefix": { "references": [ "var.environment" ] } } ] } ] } ], "number_of_broker_nodes": { "references": [ "var.kafka_number_brokers" ] }, "tags": { "references": [ "var.pre_name", ] }, "timeouts": { "update": { "constant_value": "3h" } } }, "schema_version": 0, "count_expression": { "references": [ "var.enable_services[\"kafka\"]" ] } }
Sample Terraform Code:
Used
terraform-compliance
Parameters: -p and -f onlyRunning via Docker: No
Error Output: Scenario: kafka must have broker logs enabled 💡 SKIPPING: Can not find aws msk cluster defined in target terraform plan. Given I have aws msk cluster resource configured Then it must have logging_info Then it must have broker_logs enabled
Expected Behavior: Terraform-compliance must be able to find the aws_msk_resource resource and perform negative test
Tested Versions:
v1.3.43
v1.4.6
3.11.3
Additional Context: The terraform plan snippet is present under configuration/root_module