Sha256: 41bcdabcfafc1248f65837673de1b6d3a4cd21829e3dfb848cbfffda7b070fcd

Contents?: true

Size: 1.91 KB

Versions: 79

Compression:

Stored size: 1.91 KB

Contents

# copyright: 2018, The Authors

title "Sample Section"

aws_vpc_id = attribute("aws_vpc_id", default: "", description: "Optional AWS VPC identifier.")

# You add controls here
control "aws-single-vpc-exists-check" do # A unique ID for this control.
  only_if { aws_vpc_id != "" } # Only run this control if the `aws_vpc_id` attribute is provided.
  impact 1.0                                                                # The criticality, if this control fails.
  title "Check to see if custom VPC exists."                                # A human-readable title.
  describe aws_vpc(aws_vpc_id) do                                           # The test itself.
    it { should exist }
  end
end

# Plural resources can be inspected to check for specific resource details.
control "aws-vpcs-check" do
  impact 1.0
  title "Check in all the VPCs for default sg not allowing 22 inwards"
  aws_vpcs.vpc_ids.each do |vpc_id|
    describe aws_security_group(vpc_id: vpc_id, group_name: "default") do
      it { should allow_in(port: 22) }
    end
  end
end

control "aws-vpcs-multi-region-status-check" do                             # A unique ID for this control.
  impact 1.0                                                                # The criticality, if this control fails.
  title 'Check AWS VPCs in all regions have status "available"'             # A human-readable title.
  aws_regions.region_names.each do |region|                                 # Loop over all available AWS regions
    aws_vpcs(aws_region: region).vpc_ids.each do |vpc|                      # Find all VPCs in a single AWS region
      describe aws_vpc(aws_region: region, vpc_id: vpc) do                  # The test itself.
        it { should exist }                                                 # Confirms AWS VPC exists
        it { should be_available }                                          # Confirms AWS VPC has status "available"
      end
    end
  end
end

Version data entries

79 entries across 79 versions & 2 rubygems

Version Path
inspec-4.18.51 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.18.39 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.18.38 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.18.24 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.18.0 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.17.17 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.17.15 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.17.14 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.17.11 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.17.7 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.16.0 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.12.0 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.10.4 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.7.24 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.7.18 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.7.3 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.6.9 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.6.4 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
inspec-4.6.3 lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb