|
|
@@ -1,50 +0,0 @@
|
|
|
-resource "netbox_device" "{{ resource_name }}" {
|
|
|
- name = "{{ device_name }}"
|
|
|
- device_type_id = netbox_device_type.{{ device_type_ref }}.id
|
|
|
- role_id = netbox_device_role.{{ role_ref }}.id
|
|
|
- site_id = data.netbox_site.{{ site_ref }}.id
|
|
|
-{% if cluster_ref %}
|
|
|
- cluster_id = netbox_cluster.{{ cluster_ref }}.id
|
|
|
-{% endif %}
|
|
|
- status = "{{ status }}"
|
|
|
-{% if depends_on_enabled %}
|
|
|
- depends_on = [{{ dependencies }}]
|
|
|
-{% endif %}
|
|
|
-{% if lifecycle_enabled %}
|
|
|
-
|
|
|
- lifecycle {
|
|
|
-{% if prevent_destroy %}
|
|
|
- prevent_destroy = true
|
|
|
-{% endif %}
|
|
|
-{% if create_before_destroy %}
|
|
|
- create_before_destroy = true
|
|
|
-{% endif %}
|
|
|
-{% if ignore_changes %}
|
|
|
- ignore_changes = [{{ ignore_changes }}]
|
|
|
-{% endif %}
|
|
|
- }
|
|
|
-{% endif %}
|
|
|
-}
|
|
|
-
|
|
|
-# Device Interface
|
|
|
-resource "netbox_device_interface" "{{ resource_name }}" {
|
|
|
- device_id = netbox_device.{{ resource_name }}.id
|
|
|
- name = "{{ interface_name }}"
|
|
|
- type = "{{ interface_type }}"
|
|
|
-}
|
|
|
-
|
|
|
-# IP Address
|
|
|
-resource "netbox_ip_address" "{{ resource_name }}" {
|
|
|
- ip_address = "{{ ip_address }}"
|
|
|
- status = "active"
|
|
|
- dns_name = "{{ dns_name }}"
|
|
|
- description = "{{ ip_description }}"
|
|
|
- interface_id = netbox_device_interface.{{ resource_name }}.id
|
|
|
- object_type = "dcim.interface"
|
|
|
-}
|
|
|
-
|
|
|
-# Set Primary IP
|
|
|
-resource "netbox_device_primary_ip" "{{ resource_name }}" {
|
|
|
- device_id = netbox_device.{{ resource_name }}.id
|
|
|
- ip_address_id = netbox_ip_address.{{ resource_name }}.id
|
|
|
-}
|