You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as you can see the kms_key_id property value is null in the plan
my test is that : The kms_key_id value must match the regex ".*kms.*" so I wrote the below BDD
Scenario: AWS SageMaker Notebook Instance not encrypted with KMS-CMK
Given I have aws_sagemaker_notebook_instance defined
Then it must contain kms_key_id
And its value must match the ".*kms.*" regex
when I run the above BDD, all the 3 steps are PASSED even though the kms_key_id value is null in the plan....so not sure why the test is PASSED?
next, I changed the BDD to this
Scenario: AWS SageMaker Notebook Instance not encrypted with KMS-CMK
Given I have aws_sagemaker_notebook_instance defined
Then it must contain kms_key_id
And its value must not be null
Then its value must match the ".*kms.*" regex
and It failed at 3rd step as expected.
Scenario: AWS SageMaker Notebook Instance not encrypted with KMS-CMK
Given I have aws_sagemaker_notebook_instance defined
Then it must contain kms_key_id
And its value must not be null
Failure: kms_key_id property in aws_sagemaker_notebook_instance.foo resource matches with Null/None regex. It is set to None.
Then its value must match the ".*kms.*" regex
However, I observed one thing that if the property value is not null, then my first BDD works as expected. The behavior changes when the property value is null.
so, I am wondering what is the correct approach to test when the actual property in Terraform is null and we want to check the value against a regex/value?
the first BDD approach or the later?
The text was updated successfully, but these errors were encountered:
Hi @eerkunt ,
I have an use case that I am testing i.e. SageMaker Notebook Instance not encrypted with KMS-CMK
my terraform plan json
as you can see the kms_key_id property value is null in the plan
my test is that : The kms_key_id value must match the regex
".*kms.*"
so I wrote the below BDDwhen I run the above BDD, all the 3 steps are PASSED even though the kms_key_id value is null in the plan....so not sure why the test is PASSED?
next, I changed the BDD to this
and It failed at 3rd step as expected.
However, I observed one thing that if the property value is not null, then my first BDD works as expected. The behavior changes when the property value is null.
so, I am wondering what is the correct approach to test when the actual property in Terraform is null and we want to check the value against a regex/value?
the first BDD approach or the later?
The text was updated successfully, but these errors were encountered: