Skip to content

Allow setting default tags on resources managed by the provider #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ provider "netbox" {
### Optional

- `allow_insecure_https` (Boolean) Flag to set whether to allow https with invalid certificates. Can be set via the `NETBOX_ALLOW_INSECURE_HTTPS` environment variable. Defaults to `false`.
- `default_tags` (List of String) Tags to add to every resource managed by this provider.
- `headers` (Map of String) Set these header on all requests to Netbox. Can be set via the `NETBOX_HEADERS` environment variable.
- `request_timeout` (Number) Netbox API HTTP request timeout in seconds. Can be set via the `NETBOX_REQUEST_TIMEOUT` environment variable.
- `skip_version_check` (Boolean) If true, do not try to determine the running Netbox version at provider startup. Disables warnings about possibly unsupported Netbox version. Also useful for local testing on terraform plans. Can be set via the `NETBOX_SKIP_VERSION_CHECK` environment variable. Defaults to `false`.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/aggregate.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ resource "netbox_aggregate" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/asn.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ resource "netbox_asn" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/available_ip_address.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@ resource "netbox_available_ip_address" "myvm-ip" {

- `id` (String) The ID of this resource.
- `ip_address` (String)
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/available_prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ resource "netbox_available_prefix" "test" {

- `id` (String) The ID of this resource.
- `prefix` (String)
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/cable.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ resource "netbox_cable" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)

<a id="nestedblock--a_termination"></a>
### Nested Schema for `a_termination`
Expand Down
1 change: 1 addition & 0 deletions docs/resources/circuit_termination.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ resource "netbox_circuit_termination" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ resource "netbox_cluster" "vmw_cluster_01" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/config_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ resource "netbox_config_context" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/config_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ resource "netbox_config_template" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ resource "netbox_contact" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ resource "netbox_device" "test" {
- `id` (String) The ID of this resource.
- `primary_ipv4` (Number)
- `primary_ipv6` (Number)
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_console_port.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ resource "netbox_device_console_port" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_console_server_port.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ resource "netbox_device_console_server_port" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_front_port.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ resource "netbox_device_front_port" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ resource "netbox_device_interface" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_module_bay.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ resource "netbox_device_module_bay" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_power_outlet.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ resource "netbox_device_power_outlet" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_power_port.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ resource "netbox_device_power_port" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_rear_port.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ resource "netbox_device_rear_port" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_role.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ resource "netbox_device_role" "core_sw" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/device_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ resource "netbox_device_type" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/event_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ resource "netbox_event_rule" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ resource "netbox_interface" "myvm_eth1" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/inventory_item.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ resource "netbox_inventory_item" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/inventory_item_role.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ resource "netbox_inventory_item" "parent" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/ip_address.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ resource "netbox_ip_address" "this" {

- `id` (String) The ID of this resource.
- `nat_outside_addresses` (List of Object) (see [below for nested schema](#nestedatt--nat_outside_addresses))
- `tags_all` (Set of String)

<a id="nestedatt--nat_outside_addresses"></a>
### Nested Schema for `nat_outside_addresses`
Expand Down
1 change: 1 addition & 0 deletions docs/resources/ip_range.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ resource "netbox_ip_range" "cust_a_prod" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/location.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ resource "netbox_location" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ resource "netbox_module" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/module_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ resource "netbox_module_type" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/power_feed.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ resource "netbox_power_feed" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/power_panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ resource "netbox_power_panel" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ resource "netbox_prefix" "my_prefix" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/rack.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ resource "netbox_rack" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/rack_reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ resource "netbox_rack_reservation" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/rack_role.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ resource "netbox_rack_role" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/rack_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ resource "netbox_rack_type" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/route_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ resource "netbox_route_target" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ resource "netbox_service" "ssh" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/site.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ resource "netbox_site" "example1" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ resource "netbox_tag" "dmz" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ resource "netbox_tenant" "customer_a" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/virtual_chassis.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ resource "netbox_virtual_chassis" "example" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/virtual_disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ resource "netbox_virtual_disk" "example" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/virtual_machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ resource "netbox_virtual_machine" "full_vm" {
- `id` (String) The ID of this resource.
- `primary_ipv4` (Number)
- `primary_ipv6` (Number)
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/vlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ resource "netbox_vlan" "example2" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/vlan_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ resource "netbox_vlan_group" "example2" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/vpn_tunnel.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ resource "netbox_vpn_tunnel" "test" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/vpn_tunnel_termination.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ resource "netbox_vpn_tunnel_termination" "vm" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


1 change: 1 addition & 0 deletions docs/resources/vrf.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ resource "netbox_vrf" "cust_a_prod" {
### Read-Only

- `id` (String) The ID of this resource.
- `tags_all` (Set of String)


3 changes: 1 addition & 2 deletions netbox/data_source_netbox_asn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"strconv"

"github.com/fbreckle/go-netbox/netbox/client"
"github.com/fbreckle/go-netbox/netbox/client/ipam"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -46,7 +45,7 @@ for more information on available lookup expressions.`,
}

func dataSourceNetboxAsnRead(d *schema.ResourceData, m interface{}) error {
api := m.(*client.NetBoxAPI)
api := m.(*providerState)

params := ipam.NewIpamAsnsListParams()

Expand Down
3 changes: 1 addition & 2 deletions netbox/data_source_netbox_asns.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"

"github.com/fbreckle/go-netbox/netbox/client"
"github.com/fbreckle/go-netbox/netbox/client/ipam"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -64,7 +63,7 @@ func dataSourceNetboxAsns() *schema.Resource {
}

func dataSourceNetboxAsnsRead(d *schema.ResourceData, m interface{}) error {
api := m.(*client.NetBoxAPI)
api := m.(*providerState)

params := ipam.NewIpamAsnsListParams()

Expand Down
Loading
Loading