GIVEN

GIVEN directive is use to set the initial standard about the type of the entity that you are searching for. Every Scenario must have a GIVEN as the first step defining the context.

If the scenario starts with Given I have aws_s3_bucket defined, the step below will have all the aws_s3_bucket resources defined in its context.

Few examples can be ;

Given I have AWS S3 Bucket defined
Given I have aws_s3_bucket defined
Given I have any resource defined

You can not use AND with GIVEN.

or depending on use a Scenario Outline instead of a Scenario, it can also be a variable like ;

Given I have <resource_type> defined

Reference

Given I have name type configured

Possible sentences :

Given I have name type configured

key Description Examples
name name of the key in terraform. aws_security_group ingress

In order to define all resources, you can also use ;

a resource any resource a any anything
type The type of the key. It can be one of these ;
resource resources provider providers data datas variable variables

Please note, Given I have any resource can be used to capture all resources.

Given I have any resource defined
When its provider_name is aws
...

Will run following steps on all aws resources.


Given I have name defined

Possible sentences :

Given I have name defined

key Description Examples
name name of the resource. The name must point to a resource. Can not be provider or anything else. aws_security_group aws_s3_bucket

Given I have resource that supports something

Possible sentences :

Given I resource that supports something

key Description Examples  
something something any property within Terraform resource/provider/etc tags access_key ingress "something with spaces" kms_key_id

Possible Name values

You may use the additional values for name in addition to any Terrafrom resource type:

a resource, any resource, resources

an output, any output, outputs

a variable, any variable, variables


terraform-compliance made with . Distributed by an MIT license.