@@ -18,113 +18,211 @@ func ResourceDataSource() *schema.Resource {
1818 Read : ReadDataSource ,
1919
2020 Schema : map [string ]* schema.Schema {
21- "type" : {
22- Type : schema .TypeString ,
23- Required : true ,
24- },
25-
26- "name" : {
27- Type : schema .TypeString ,
28- Required : true ,
29- },
30-
31- "url" : {
21+ "access_mode" : {
3222 Type : schema .TypeString ,
3323 Optional : true ,
24+ Default : "proxy" ,
3425 },
35-
36- "is_default" : {
37- Type : schema .TypeBool ,
38- Optional : true ,
39- Default : false ,
40- },
41-
4226 "basic_auth_enabled" : {
4327 Type : schema .TypeBool ,
4428 Optional : true ,
4529 Default : false ,
4630 },
47-
48- "basic_auth_username" : {
49- Type : schema .TypeString ,
50- Optional : true ,
51- Default : "" ,
52- },
53-
5431 "basic_auth_password" : {
5532 Type : schema .TypeString ,
5633 Optional : true ,
5734 Default : "" ,
5835 Sensitive : true ,
5936 },
60-
61- "username" : {
37+ "basic_auth_username" : {
6238 Type : schema .TypeString ,
6339 Optional : true ,
6440 Default : "" ,
6541 },
66-
67- "password" : {
68- Type : schema .TypeString ,
69- Optional : true ,
70- Default : "" ,
71- Sensitive : true ,
42+ "database_name" : {
43+ Type : schema .TypeString ,
44+ Optional : true ,
45+ Default : "" ,
46+ },
47+ "is_default" : {
48+ Type : schema .TypeBool ,
49+ Optional : true ,
50+ Default : false ,
7251 },
73-
7452 "json_data" : {
7553 Type : schema .TypeList ,
7654 Optional : true ,
7755 Elem : & schema.Resource {
7856 Schema : map [string ]* schema.Schema {
57+ "assume_role_arn" : {
58+ Type : schema .TypeString ,
59+ Optional : true ,
60+ },
7961 "auth_type" : {
8062 Type : schema .TypeString ,
81- Required : true ,
63+ Optional : true ,
64+ },
65+ "conn_max_lifetime" : {
66+ Type : schema .TypeInt ,
67+ Optional : true ,
68+ },
69+ "custom_metrics_namespaces" : {
70+ Type : schema .TypeString ,
71+ Optional : true ,
8272 },
8373 "default_region" : {
8474 Type : schema .TypeString ,
85- Required : true ,
75+ Optional : true ,
8676 },
87- "custom_metrics_namespaces " : {
77+ "encrypt " : {
8878 Type : schema .TypeString ,
8979 Optional : true ,
9080 },
91- "assume_role_arn" : {
81+ "es_version" : {
82+ Type : schema .TypeInt ,
83+ Optional : true ,
84+ },
85+ "graphite_version" : {
86+ Type : schema .TypeString ,
87+ Optional : true ,
88+ },
89+ "http_method" : {
90+ Type : schema .TypeString ,
91+ Optional : true ,
92+ },
93+ "interval" : {
94+ Type : schema .TypeString ,
95+ Optional : true ,
96+ },
97+ "log_level_field" : {
98+ Type : schema .TypeString ,
99+ Optional : true ,
100+ },
101+ "log_message_field" : {
102+ Type : schema .TypeString ,
103+ Optional : true ,
104+ },
105+ "max_idle_conns" : {
106+ Type : schema .TypeInt ,
107+ Optional : true ,
108+ },
109+ "max_open_conns" : {
110+ Type : schema .TypeInt ,
111+ Optional : true ,
112+ },
113+ "postgres_version" : {
114+ Type : schema .TypeInt ,
115+ Optional : true ,
116+ },
117+ "query_timeout" : {
118+ Type : schema .TypeString ,
119+ Optional : true ,
120+ },
121+ "ssl_mode" : {
122+ Type : schema .TypeString ,
123+ Optional : true ,
124+ },
125+ "timescaledb" : {
126+ Type : schema .TypeBool ,
127+ Optional : true ,
128+ },
129+ "time_field" : {
130+ Type : schema .TypeString ,
131+ Optional : true ,
132+ },
133+ "time_interval" : {
134+ Type : schema .TypeString ,
135+ Optional : true ,
136+ },
137+ "tls_auth" : {
138+ Type : schema .TypeBool ,
139+ Optional : true ,
140+ },
141+ "tls_auth_with_ca_cert" : {
142+ Type : schema .TypeBool ,
143+ Optional : true ,
144+ },
145+ "tls_skip_verify" : {
146+ Type : schema .TypeBool ,
147+ Optional : true ,
148+ },
149+ "tsdb_resolution" : {
150+ Type : schema .TypeString ,
151+ Optional : true ,
152+ },
153+ "tsdb_version" : {
92154 Type : schema .TypeString ,
93155 Optional : true ,
94156 },
95157 },
96158 },
97159 },
98-
160+ "name" : {
161+ Type : schema .TypeString ,
162+ Required : true ,
163+ },
164+ "password" : {
165+ Type : schema .TypeString ,
166+ Optional : true ,
167+ Default : "" ,
168+ Sensitive : true ,
169+ },
99170 "secure_json_data" : {
100171 Type : schema .TypeList ,
101172 Optional : true ,
102173 Sensitive : true ,
103174 Elem : & schema.Resource {
104175 Schema : map [string ]* schema.Schema {
105176 "access_key" : {
106- Type : schema .TypeString ,
107- Required : true ,
177+ Type : schema .TypeString ,
178+ Optional : true ,
179+ Sensitive : true ,
180+ },
181+ "basic_auth_password" : {
182+ Type : schema .TypeString ,
183+ Optional : true ,
184+ Sensitive : true ,
185+ },
186+ "password" : {
187+ Type : schema .TypeString ,
188+ Optional : true ,
189+ Sensitive : true ,
108190 },
109191 "secret_key" : {
110192 Type : schema .TypeString ,
111- Required : true ,
193+ Optional : true ,
194+ Sensitive : true ,
195+ },
196+ "tls_ca_cert" : {
197+ Type : schema .TypeString ,
198+ Optional : true ,
199+ Sensitive : true ,
200+ },
201+ "tls_client_cert" : {
202+ Type : schema .TypeString ,
203+ Optional : true ,
204+ Sensitive : true ,
205+ },
206+ "tls_client_key" : {
207+ Type : schema .TypeString ,
208+ Optional : true ,
112209 Sensitive : true ,
113210 },
114211 },
115212 },
116213 },
117-
118- "database_name" : {
214+ "type" : {
215+ Type : schema .TypeString ,
216+ Required : true ,
217+ },
218+ "url" : {
119219 Type : schema .TypeString ,
120220 Optional : true ,
121- Default : "" ,
122221 },
123-
124- "access_mode" : {
222+ "username" : {
125223 Type : schema .TypeString ,
126224 Optional : true ,
127- Default : "proxy " ,
225+ Default : "" ,
128226 },
129227 },
130228 }
@@ -238,16 +336,42 @@ func makeDataSource(d *schema.ResourceData) (*gapi.DataSource, error) {
238336
239337func makeJSONData (d * schema.ResourceData ) gapi.JSONData {
240338 return gapi.JSONData {
339+ AssumeRoleArn : d .Get ("json_data.0.assume_role_arn" ).(string ),
241340 AuthType : d .Get ("json_data.0.auth_type" ).(string ),
242- DefaultRegion : d .Get ("json_data.0.default_region " ).(string ),
341+ ConnMaxLifetime : int64 ( d .Get ("json_data.0.conn_max_lifetime " ).(int ) ),
243342 CustomMetricsNamespaces : d .Get ("json_data.0.custom_metrics_namespaces" ).(string ),
244- AssumeRoleArn : d .Get ("json_data.0.assume_role_arn" ).(string ),
343+ DefaultRegion : d .Get ("json_data.0.default_region" ).(string ),
344+ Encrypt : d .Get ("json_data.0.encrypt" ).(string ),
345+ EsVersion : int64 (d .Get ("json_data.0.es_version" ).(int )),
346+ GraphiteVersion : d .Get ("json_data.0.graphite_version" ).(string ),
347+ HttpMethod : d .Get ("json_data.0.http_method" ).(string ),
348+ Interval : d .Get ("json_data.0.interval" ).(string ),
349+ LogLevelField : d .Get ("json_data.0.log_level_field" ).(string ),
350+ LogMessageField : d .Get ("json_data.0.log_message_field" ).(string ),
351+ MaxIdleConns : int64 (d .Get ("json_data.0.max_idle_conns" ).(int )),
352+ MaxOpenConns : int64 (d .Get ("json_data.0.max_open_conns" ).(int )),
353+ PostgresVersion : int64 (d .Get ("json_data.0.postgres_version" ).(int )),
354+ QueryTimeout : d .Get ("json_data.0.query_timeout" ).(string ),
355+ Sslmode : d .Get ("json_data.0.ssl_mode" ).(string ),
356+ Timescaledb : d .Get ("json_data.0.timescaledb" ).(bool ),
357+ TimeField : d .Get ("json_data.0.time_field" ).(string ),
358+ TimeInterval : d .Get ("json_data.0.time_interval" ).(string ),
359+ TlsAuth : d .Get ("json_data.0.tls_auth" ).(bool ),
360+ TlsAuthWithCACert : d .Get ("json_data.0.tls_auth_with_ca_cert" ).(bool ),
361+ TlsSkipVerify : d .Get ("json_data.0.tls_skip_verify" ).(bool ),
362+ TsdbResolution : d .Get ("json_data.0.tsdb_resolution" ).(string ),
363+ TsdbVersion : d .Get ("json_data.0.tsdb_version" ).(string ),
245364 }
246365}
247366
248367func makeSecureJSONData (d * schema.ResourceData ) gapi.SecureJSONData {
249368 return gapi.SecureJSONData {
250- AccessKey : d .Get ("secure_json_data.0.access_key" ).(string ),
251- SecretKey : d .Get ("secure_json_data.0.secret_key" ).(string ),
369+ AccessKey : d .Get ("secure_json_data.0.access_key" ).(string ),
370+ BasicAuthPassword : d .Get ("secure_json_data.0.basic_auth_password" ).(string ),
371+ Password : d .Get ("secure_json_data.0.password" ).(string ),
372+ SecretKey : d .Get ("secure_json_data.0.secret_key" ).(string ),
373+ TlsCACert : d .Get ("secure_json_data.0.tls_ca_cert" ).(string ),
374+ TlsClientCert : d .Get ("secure_json_data.0.tls_client_cert" ).(string ),
375+ TlsClientKey : d .Get ("secure_json_data.0.tls_client_key" ).(string ),
252376 }
253377}
0 commit comments