Skip to main content

aws_dhcp_options resource

[edit on GitHub]

Use the aws_dhcp_options InSpec audit resource to test properties of a single AWS DHCP Options.

Syntax

Ensure that an aws_dhcp_options exists

describe aws_dhcp_options('dopt-0123456789abcdefg') do
  it { should exist }
end

describe aws_dhcp_options(dhcp_options_id: 'dopt-0123456789abcdefg') do
  it { should exist }
end

Parameters

dhcp_options_id (required)

This resource accepts a single parameter, the DHCP Options ID which uniquely identifies the DHCP Options. This can be passed either as a string or as a dhcp_options_id: 'value' key-value entry in a hash.

See also the AWS documentation on EC2.

Properties

PropertyDescription
dhcp_configurationsThe list of dhcp configurations
domain_name_serversThe list of domain name servers in the dhcp configuration
ntp_serversThe list of ntp servers in the dhcp configuration
tagsThe tags of the DHCP Options.

Test tags on the DHCP Options

describe aws_dhcp_options('dopt-0123456789abcdefg') do
  its('tags') { should include(:Environment => 'env-name',
                               :Name => 'dhcp-options-name')}
end

AWS Permissions

Your Principal will need the ec2:DescribeDhcpOptions action with Effect set to Allow.

You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon EC2.