@@ -24,67 +24,70 @@ func dataSourceNetboxPrefix() *schema.Resource {
2424 Deprecated : "The `cidr` parameter is deprecated in favor of the canonical `prefix` attribute." ,
2525 ConflictsWith : []string {"prefix" },
2626 ValidateFunc : validation .IsCIDR ,
27- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
27+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
2828 },
2929 customFieldsKey : customFieldsSchema ,
3030 "description" : {
3131 Type : schema .TypeString ,
3232 Optional : true ,
3333 Computed : true ,
34- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
34+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
3535 Description : "Description to include in the data source filter." ,
3636 },
3737 "family" : {
3838 Type : schema .TypeInt ,
3939 Optional : true ,
4040 Computed : true ,
41- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
41+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
4242 ValidateFunc : validation .IntInSlice ([]int {4 , 6 }),
4343 Description : "The IP family of the prefix. One of 4 or 6" ,
4444 },
4545 "role_id" : {
4646 Type : schema .TypeInt ,
4747 Optional : true ,
4848 Computed : true ,
49- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
49+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
5050 },
5151 "prefix" : {
5252 Type : schema .TypeString ,
5353 Optional : true ,
5454 ValidateFunc : validation .IsCIDR ,
5555 ConflictsWith : []string {"cidr" },
56- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
56+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
5757 },
5858 "vlan_vid" : {
5959 Type : schema .TypeFloat ,
6060 Optional : true ,
61- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
61+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
6262 ValidateFunc : validation .FloatBetween (1 , 4094 ),
6363 },
6464 "vrf_id" : {
6565 Type : schema .TypeInt ,
6666 Optional : true ,
67- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
67+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
6868 },
6969 "vlan_id" : {
7070 Type : schema .TypeInt ,
7171 Optional : true ,
72- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
72+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
7373 },
7474 "tenant_id" : {
7575 Type : schema .TypeInt ,
7676 Optional : true ,
77- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
77+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
7878 },
79- "site_id" : {
79+ "scope_type" : {
80+ Type : schema .TypeString ,
81+ Computed : true ,
82+ },
83+ "scope_id" : {
8084 Type : schema .TypeInt ,
81- Optional : true ,
82- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , "role_id" , "cidr" , "tag" , "status" },
85+ Computed : true ,
8386 },
8487 "tag" : {
8588 Type : schema .TypeString ,
8689 Optional : true ,
87- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
90+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
8891 Description : "Tag to include in the data source filter (must match the tag's slug)." ,
8992 },
9093 "tag__n" : {
@@ -97,7 +100,7 @@ for more information on available lookup expressions.`,
97100 "status" : {
98101 Type : schema .TypeString ,
99102 Optional : true ,
100- AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "site_id" , " role_id" , "cidr" , "tag" , "status" },
103+ AtLeastOneOf : []string {"description" , "family" , "prefix" , "vlan_vid" , "vrf_id" , "vlan_id" , "tenant_id" , "role_id" , "cidr" , "tag" , "status" },
101104 },
102105 "tags" : tagsSchemaRead ,
103106 },
@@ -207,8 +210,15 @@ func dataSourceNetboxPrefixRead(d *schema.ResourceData, m interface{}) error {
207210 if result .Tenant != nil {
208211 d .Set ("tenant_id" , result .Tenant .ID )
209212 }
210- if result .Site != nil {
211- d .Set ("site_id" , result .Site .ID )
213+ if result .ScopeType != nil {
214+ d .Set ("scope_type" , result .ScopeType )
215+ } else {
216+ d .Set ("scope_type" , nil )
217+ }
218+ if result .ScopeID != nil {
219+ d .Set ("scope_id" , result .ScopeID )
220+ } else {
221+ d .Set ("scope_id" , nil )
212222 }
213223 d .SetId (strconv .FormatInt (result .ID , 10 ))
214224 return nil
0 commit comments