@@ -35,160 +35,164 @@ func ResourceServer() *schema.Resource {
3535 StateContext : schema .ImportStatePassthroughContext ,
3636 },
3737 SchemaVersion : 0 ,
38- Schema : map [string ]* schema.Schema {
39- "name" : {
40- Type : schema .TypeString ,
41- Description : "Name of the server" ,
42- Computed : true ,
43- Optional : true ,
44- },
45- "type" : {
46- Type : schema .TypeString ,
47- Description : "Type of the server" ,
48- Required : true ,
49- ForceNew : true ,
50- },
51- "enable_vpc" : {
52- Type : schema .TypeBool ,
53- Optional : true ,
54- Default : false ,
55- Description : "Whether or not to enable VPC access" ,
56- },
57- "commitment" : {
58- Type : schema .TypeString ,
59- Optional : true ,
60- Default : "duration_24h" ,
61- Description : "The commitment period of the server" ,
62- ValidateDiagFunc : verify .ValidateEnum [applesilicon.CommitmentType ](),
63- },
64- "public_bandwidth" : {
65- Type : schema .TypeInt ,
66- Optional : true ,
67- Computed : true ,
68- Description : "The public bandwidth of the server in bits per second" ,
69- },
70- "private_network" : {
71- Type : schema .TypeSet ,
72- Optional : true ,
73- Description : "The private networks to attach to the server" ,
74- Elem : & schema.Resource {
75- Schema : map [string ]* schema.Schema {
76- "id" : {
38+ SchemaFunc : serverSchema ,
39+ }
40+ }
41+
42+ func serverSchema () map [string ]* schema.Schema {
43+ return map [string ]* schema.Schema {
44+ "name" : {
45+ Type : schema .TypeString ,
46+ Description : "Name of the server" ,
47+ Computed : true ,
48+ Optional : true ,
49+ },
50+ "type" : {
51+ Type : schema .TypeString ,
52+ Description : "Type of the server" ,
53+ Required : true ,
54+ ForceNew : true ,
55+ },
56+ "enable_vpc" : {
57+ Type : schema .TypeBool ,
58+ Optional : true ,
59+ Default : false ,
60+ Description : "Whether or not to enable VPC access" ,
61+ },
62+ "commitment" : {
63+ Type : schema .TypeString ,
64+ Optional : true ,
65+ Default : "duration_24h" ,
66+ Description : "The commitment period of the server" ,
67+ ValidateDiagFunc : verify .ValidateEnum [applesilicon.CommitmentType ](),
68+ },
69+ "public_bandwidth" : {
70+ Type : schema .TypeInt ,
71+ Optional : true ,
72+ Computed : true ,
73+ Description : "The public bandwidth of the server in bits per second" ,
74+ },
75+ "private_network" : {
76+ Type : schema .TypeSet ,
77+ Optional : true ,
78+ Description : "The private networks to attach to the server" ,
79+ Elem : & schema.Resource {
80+ Schema : map [string ]* schema.Schema {
81+ "id" : {
82+ Type : schema .TypeString ,
83+ Description : "The private network ID" ,
84+ Required : true ,
85+ ValidateDiagFunc : verify .IsUUIDorUUIDWithLocality (),
86+ StateFunc : func (i any ) string {
87+ return locality .ExpandID (i .(string ))
88+ },
89+ },
90+ "ipam_ip_ids" : {
91+ Type : schema .TypeList ,
92+ Optional : true ,
93+ Computed : true ,
94+ Elem : & schema.Schema {
7795 Type : schema .TypeString ,
78- Description : "The private network ID" ,
79- Required : true ,
8096 ValidateDiagFunc : verify .IsUUIDorUUIDWithLocality (),
81- StateFunc : func (i any ) string {
82- return locality .ExpandID (i .(string ))
83- },
84- },
85- "ipam_ip_ids" : {
86- Type : schema .TypeList ,
87- Optional : true ,
88- Computed : true ,
89- Elem : & schema.Schema {
90- Type : schema .TypeString ,
91- ValidateDiagFunc : verify .IsUUIDorUUIDWithLocality (),
92- },
93- Description : "List of IPAM IP IDs to attach to the server" ,
94- },
95- // computed
96- "vlan" : {
97- Type : schema .TypeInt ,
98- Computed : true ,
99- Description : "The VLAN ID associated to the private network" ,
100- },
101- "status" : {
102- Type : schema .TypeString ,
103- Computed : true ,
104- Description : "The private network status" ,
105- },
106- "created_at" : {
107- Type : schema .TypeString ,
108- Computed : true ,
109- Description : "The date and time of the creation of the private network" ,
110- },
111- "updated_at" : {
112- Type : schema .TypeString ,
113- Computed : true ,
114- Description : "The date and time of the last update of the private network" ,
11597 },
98+ Description : "List of IPAM IP IDs to attach to the server" ,
99+ },
100+ // computed
101+ "vlan" : {
102+ Type : schema .TypeInt ,
103+ Computed : true ,
104+ Description : "The VLAN ID associated to the private network" ,
105+ },
106+ "status" : {
107+ Type : schema .TypeString ,
108+ Computed : true ,
109+ Description : "The private network status" ,
110+ },
111+ "created_at" : {
112+ Type : schema .TypeString ,
113+ Computed : true ,
114+ Description : "The date and time of the creation of the private network" ,
115+ },
116+ "updated_at" : {
117+ Type : schema .TypeString ,
118+ Computed : true ,
119+ Description : "The date and time of the last update of the private network" ,
116120 },
117121 },
118122 },
119- // Computed
120- "ip" : {
121- Type : schema . TypeString ,
122- Description : "IPv4 address of the server" ,
123- Computed : true ,
124- } ,
125- "private_ips" : {
126- Type : schema . TypeList ,
127- Computed : true ,
128- Optional : true ,
129- Description : "List of private IPv4 and IPv6 addresses associated with the server" ,
130- Elem : & schema. Resource {
131- Schema : map [ string ] * schema.Schema {
132- "id" : {
133- Type : schema . TypeString ,
134- Computed : true ,
135- Description : "The ID of the IP address resource" ,
136- } ,
137- "address" : {
138- Type : schema . TypeString ,
139- Computed : true ,
140- Description : "The private IP address" ,
141- } ,
123+ },
124+ // Computed
125+ "ip" : {
126+ Type : schema . TypeString ,
127+ Description : "IPv4 address of the server" ,
128+ Computed : true ,
129+ },
130+ "private_ips" : {
131+ Type : schema . TypeList ,
132+ Computed : true ,
133+ Optional : true ,
134+ Description : "List of private IPv4 and IPv6 addresses associated with the server" ,
135+ Elem : & schema.Resource {
136+ Schema : map [ string ] * schema. Schema {
137+ "id" : {
138+ Type : schema . TypeString ,
139+ Computed : true ,
140+ Description : "The ID of the IP address resource" ,
141+ },
142+ "address" : {
143+ Type : schema . TypeString ,
144+ Computed : true ,
145+ Description : "The private IP address" ,
142146 },
143147 },
144148 },
145- "vnc_url" : {
146- Type : schema .TypeString ,
147- Description : "VNC url use to connect remotely to the desktop GUI" ,
148- Computed : true ,
149- },
150- "state" : {
151- Type : schema .TypeString ,
152- Computed : true ,
153- Description : "The state of the server" ,
154- },
155- "created_at" : {
156- Type : schema .TypeString ,
157- Computed : true ,
158- Description : "The date and time of the creation of the server" ,
159- },
160- "updated_at" : {
161- Type : schema .TypeString ,
162- Computed : true ,
163- Description : "The date and time of the last update of the server" ,
164- },
165- "deletable_at" : {
166- Type : schema .TypeString ,
167- Computed : true ,
168- Description : "The minimal date and time on which you can delete this server due to Apple licence" ,
169- },
170- "vpc_status" : {
171- Type : schema .TypeString ,
172- Computed : true ,
173- Description : "The VPC status of the server" ,
174- },
175- "password" : {
176- Type : schema .TypeString ,
177- Computed : true ,
178- Sensitive : true ,
179- Description : "The password of the server" ,
180- },
181- "username" : {
182- Type : schema .TypeString ,
183- Computed : true ,
184- Description : "The username of the server" ,
185- },
186-
187- // Common
188- "zone" : zonal .Schema (),
189- "organization_id" : account .OrganizationIDSchema (),
190- "project_id" : account .ProjectIDSchema (),
191149 },
150+ "vnc_url" : {
151+ Type : schema .TypeString ,
152+ Description : "VNC url use to connect remotely to the desktop GUI" ,
153+ Computed : true ,
154+ },
155+ "state" : {
156+ Type : schema .TypeString ,
157+ Computed : true ,
158+ Description : "The state of the server" ,
159+ },
160+ "created_at" : {
161+ Type : schema .TypeString ,
162+ Computed : true ,
163+ Description : "The date and time of the creation of the server" ,
164+ },
165+ "updated_at" : {
166+ Type : schema .TypeString ,
167+ Computed : true ,
168+ Description : "The date and time of the last update of the server" ,
169+ },
170+ "deletable_at" : {
171+ Type : schema .TypeString ,
172+ Computed : true ,
173+ Description : "The minimal date and time on which you can delete this server due to Apple licence" ,
174+ },
175+ "vpc_status" : {
176+ Type : schema .TypeString ,
177+ Computed : true ,
178+ Description : "The VPC status of the server" ,
179+ },
180+ "password" : {
181+ Type : schema .TypeString ,
182+ Computed : true ,
183+ Sensitive : true ,
184+ Description : "The password of the server" ,
185+ },
186+ "username" : {
187+ Type : schema .TypeString ,
188+ Computed : true ,
189+ Description : "The username of the server" ,
190+ },
191+
192+ // Common
193+ "zone" : zonal .Schema (),
194+ "organization_id" : account .OrganizationIDSchema (),
195+ "project_id" : account .ProjectIDSchema (),
192196 }
193197}
194198
0 commit comments