aws_network_manager_device Resource
Use the aws_network_manager_device
InSpec audit resource to test properties of a single specific AWS Network Manager device.
The AWS::NetworkManager::Device
resource gets information about one or more of your devices in a global network.
For additional information, including details on parameters and properties, see the AWS documentation on AWS Network Manager Device.
Install
This resource is available in the Chef InSpec AWS resource pack.
For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.
Syntax
Ensure that a device exists.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
it { should exist }
end
Parameters
device_id
(required)The ID of the device.
global_network_id
(required)The ID of the global network.
Properties
device_id
- The ID of the device.
device_arn
- The Amazon Resource Name (ARN) of the device.
global_network_id
- The ID of the global network.
aws_location.zone
- The Zone the device is located in. This can be the ID of an Availability Zone, Local Zone, Wavelength Zone, or an Outpost.
aws_location.subnet_arn
- The Amazon Resource Name (ARN) of the subnet the device is located in.
description
- The description of the device.
type
- The device type.
vendor
- The device vendor.
model
- The device model.
serial_number
- The device serial number.
location.address
- The physical address of the location.
location.latitude
- The latitude of the location.
location.longitude
- The longitude of the location.
site_id
- The site ID.
created_at
- The date and time that the site was created.
state
- The device state.
tags
- The tags for the device.
Examples
Ensure a device ID is available.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
its('device_id') { should eq 'DEVICE_ID' }
end
Ensure a global network ID is available.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
its('global_network_id') { should eq 'GLOBAL_NETWORK_ID' }
end
Ensure a zone is available.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
its('aws_location.zone') { should eq 'ZONE_NAME' }
end
Ensure that the state is AVAILABLE
.
describe aws_network_manager_global_network(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
its('state') { should eq 'AVAILABLE' }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.This resource has the following special matchers.
exist
Use should
to test that the entity exists.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
it { should_not exist }
end
be_available
Use should
to check if the entity is available.
describe aws_network_manager_device(device_id: 'DEVICE_ID', global_network_id: 'GLOBAL_NETWORK_ID') do
it { should be_available }
end
AWS Permissions
Your Principal will need the NetworkManager:Client:GetDevicesResponse
action with Effect
set to Allow
.