@@ -9,6 +9,160 @@ import (
99
1010//Types
1111
12+ func clusterV2RKEConfigFieldsV0 () map [string ]* schema.Schema {
13+ s := map [string ]* schema.Schema {
14+ "additional_manifest" : {
15+ Type : schema .TypeString ,
16+ Optional : true ,
17+ Description : "Cluster V2 additional manifest" ,
18+ },
19+ "local_auth_endpoint" : {
20+ Type : schema .TypeList ,
21+ MaxItems : 1 ,
22+ Optional : true ,
23+ Deprecated : "Use rancher2_cluster_v2.local_auth_endpoint instead" ,
24+ Description : "Cluster V2 local auth endpoint" ,
25+ Elem : & schema.Resource {
26+ Schema : clusterV2LocalAuthEndpointFields (),
27+ },
28+ },
29+ "upgrade_strategy" : {
30+ Type : schema .TypeList ,
31+ MaxItems : 1 ,
32+ Optional : true ,
33+ Description : "Cluster V2 upgrade strategy" ,
34+ Elem : & schema.Resource {
35+ Schema : clusterV2RKEConfigUpgradeStrategyFields (),
36+ },
37+ },
38+ "chart_values" : {
39+ Type : schema .TypeString ,
40+ Optional : true ,
41+ Description : "Cluster V2 chart values. It should be in YAML format" ,
42+ ValidateFunc : func (val interface {}, key string ) (warns []string , errs []error ) {
43+ v , ok := val .(string )
44+ if ! ok || len (v ) == 0 {
45+ return
46+ }
47+ _ , err := ghodssyamlToMapInterface (v )
48+ if err != nil {
49+ errs = append (errs , fmt .Errorf ("%q must be in yaml format, error: %v" , key , err ))
50+ return
51+ }
52+ return
53+ },
54+ DiffSuppressFunc : func (k , old , new string , d * schema.ResourceData ) bool {
55+ if old == "" || new == "" {
56+ return false
57+ }
58+ oldMap , _ := ghodssyamlToMapInterface (old )
59+ newMap , _ := ghodssyamlToMapInterface (new )
60+ return reflect .DeepEqual (oldMap , newMap )
61+ },
62+ },
63+ "machine_global_config" : {
64+ Type : schema .TypeString ,
65+ Optional : true ,
66+ Description : "Cluster V2 machine global config" ,
67+ ValidateFunc : func (val interface {}, key string ) (warns []string , errs []error ) {
68+ v , ok := val .(string )
69+ if ! ok || len (v ) == 0 {
70+ return
71+ }
72+ _ , err := ghodssyamlToMapInterface (v )
73+ if err != nil {
74+ errs = append (errs , fmt .Errorf ("%q must be in yaml format, error: %v" , key , err ))
75+ return
76+ }
77+ return
78+ },
79+ DiffSuppressFunc : func (k , old , new string , d * schema.ResourceData ) bool {
80+ if old == "" || new == "" {
81+ return false
82+ }
83+ oldMap , _ := ghodssyamlToMapInterface (old )
84+ newMap , _ := ghodssyamlToMapInterface (new )
85+ return reflect .DeepEqual (oldMap , newMap )
86+ },
87+ },
88+ "machine_pools" : {
89+ Type : schema .TypeList ,
90+ Optional : true ,
91+ Computed : true ,
92+ Description : "Cluster V2 machine pools" ,
93+ Elem : & schema.Resource {
94+ Schema : clusterV2RKEConfigMachinePoolFields (),
95+ },
96+ },
97+ "machine_pool_defaults" : {
98+ Type : schema .TypeList ,
99+ Optional : true ,
100+ Computed : true ,
101+ Description : "Default values for machine pool configurations if unset" ,
102+ Elem : & schema.Resource {
103+ Schema : clusterV2RKEConfigMachinePoolDefaultFields (),
104+ },
105+ },
106+ "machine_selector_config" : {
107+ Type : schema .TypeList ,
108+ Optional : true ,
109+ Computed : true ,
110+ Description : "Cluster V2 machine selector config" ,
111+ Elem : & schema.Resource {
112+ Schema : clusterV2RKEConfigSystemConfigFieldsV0 (),
113+ },
114+ },
115+ "registries" : {
116+ Type : schema .TypeList ,
117+ MaxItems : 1 ,
118+ Optional : true ,
119+ Description : "Cluster V2 registries" ,
120+ Elem : & schema.Resource {
121+ Schema : clusterV2RKEConfigRegistryFields (),
122+ },
123+ },
124+ "etcd" : {
125+ Type : schema .TypeList ,
126+ MaxItems : 1 ,
127+ Optional : true ,
128+ Computed : true ,
129+ Description : "Cluster V2 etcd" ,
130+ Elem : & schema.Resource {
131+ Schema : clusterV2RKEConfigETCDFields (),
132+ },
133+ },
134+ "rotate_certificates" : {
135+ Type : schema .TypeList ,
136+ MaxItems : 1 ,
137+ Optional : true ,
138+ Description : "Cluster V2 certificate rotation" ,
139+ Elem : & schema.Resource {
140+ Schema : clusterV2RKEConfigRotateCertificatesFields (),
141+ },
142+ },
143+ "etcd_snapshot_create" : {
144+ Type : schema .TypeList ,
145+ MaxItems : 1 ,
146+ Optional : true ,
147+ Description : "Cluster V2 etcd snapshot create" ,
148+ Elem : & schema.Resource {
149+ Schema : clusterV2RKEConfigETCDSnapshotCreateFields (),
150+ },
151+ },
152+ "etcd_snapshot_restore" : {
153+ Type : schema .TypeList ,
154+ MaxItems : 1 ,
155+ Optional : true ,
156+ Description : "Cluster V2 etcd snapshot restore" ,
157+ Elem : & schema.Resource {
158+ Schema : clusterV2RKEConfigETCDSnapshotRestoreFields (),
159+ },
160+ },
161+ }
162+
163+ return s
164+ }
165+
12166func clusterV2RKEConfigFields () map [string ]* schema.Schema {
13167 s := map [string ]* schema.Schema {
14168 "additional_manifest" : {
0 commit comments