Skip to content
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

netbox_vlan_group optional name/slug variables #656

Open
TGM opened this issue Nov 18, 2024 · 1 comment
Open

netbox_vlan_group optional name/slug variables #656

TGM opened this issue Nov 18, 2024 · 1 comment

Comments

@TGM
Copy link

TGM commented Nov 18, 2024

Hello,

The name/slug variables should be marked as optional when a scope_type = scope_id are used.

variable "vlan_id" {
  default = 200
}

variable "site" {
  default = "FRA1"
}

variable "availability_zone" {
  default = "AZ01"
}


data "netbox_site" "site" {
  name = var.site
}

data "netbox_location" "location" {
  site_id = data.netbox_site.site.site_id
  slug = var.availability_zone
}

data "netbox_vlan_group" "vlan_group" {
  # name or slug is required (should be optional)
  scope_type = "dcim.location"
  scope_id = data.netbox_location.location.id
}


output "site" {
  value = data.netbox_site.site
}

output "location" {
  value = data.netbox_location.location
}

# output "netbox_vlan_group" {
#   value = data.netbox_vlan_group.vlan_group
# }

Output


│ Error: Missing required argument
│ 
│   with data.netbox_vlan_group.vlan_group,
│   on query_via_location.tf line 23, in data "netbox_vlan_group" "vlan_group":
│   23: data "netbox_vlan_group" "vlan_group" {
│ 
│ "name": one of `name,slug` must be specified
╵

Provider version: 3.9.2
Netbox version: 4.0.8

@TGM
Copy link
Author

TGM commented Nov 18, 2024

Fixed via available PR
#657

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant