-
Notifications
You must be signed in to change notification settings - Fork 45
/
data_source_metal_virtual_circuit.go
122 lines (117 loc) · 4.08 KB
/
data_source_metal_virtual_circuit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package equinix
import (
"context"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceMetalVirtualCircuit() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceMetalVirtualCircuitRead,
Schema: map[string]*schema.Schema{
"virtual_circuit_id": {
Type: schema.TypeString,
Required: true,
Description: "ID of the virtual circuit to lookup",
},
"connection_id": {
Type: schema.TypeString,
Computed: true,
Description: "UUID of Connection where the VC is scoped to",
},
"name": {
Type: schema.TypeString,
Computed: true,
Description: "Name of the virtual circuit",
},
"description": {
Type: schema.TypeString,
Computed: true,
Description: "Description of the virtual circuit",
},
"tags": {
Type: schema.TypeList,
Description: "Tags attached to the virtual circuit",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"status": {
Type: schema.TypeString,
Computed: true,
Description: "Status of the virtual circuit",
},
"vnid": {
Type: schema.TypeInt,
Computed: true,
Description: "VNID VLAN parameter, see https://metal.equinix.com/developers/docs/networking/fabric/",
},
"nni_vnid": {
Type: schema.TypeInt,
Computed: true,
Description: "Nni VLAN ID parameter, see https://metal.equinix.com/developers/docs/networking/fabric/",
},
"nni_vlan": {
Type: schema.TypeInt,
Computed: true,
Description: "Nni VLAN parameter, see https://metal.equinix.com/developers/docs/networking/fabric/",
},
"project_id": {
Type: schema.TypeString,
Computed: true,
Description: "ID of the projct to which the virtual circuit belongs",
},
"port_id": {
Type: schema.TypeString,
Computed: true,
Description: "UUID of the Connection Port where the VC is scoped to",
},
"speed": {
Type: schema.TypeString,
Description: "Description of the Virtual Circuit speed. This is for information purposes and is computed when the connection type is shared.",
Computed: true,
},
"vlan_id": {
Type: schema.TypeString,
Computed: true,
Description: "UUID of the associated VLAN",
},
"vrf_id": {
Type: schema.TypeString,
Computed: true,
Description: "UUID of the associated VRF",
},
"peer_asn": {
Type: schema.TypeInt,
Computed: true,
Description: "The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF.",
},
"subnet": {
Type: schema.TypeString,
Computed: true,
Description: `A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31.
* For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip.
* For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip.`,
},
"metal_ip": {
Type: schema.TypeString,
Computed: true,
Description: "The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet.",
},
"customer_ip": {
Type: schema.TypeString,
Computed: true,
Description: "The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet.",
},
"md5": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The password that can be set for the VRF BGP peer",
},
},
}
}
func dataSourceMetalVirtualCircuitRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
vcId := d.Get("virtual_circuit_id").(string)
d.SetId(vcId)
return resourceMetalVirtualCircuitRead(ctx, d, meta)
}