This repository was archived by the owner on Mar 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +117
-810
lines changed
examples/resources/gcore_cdn_resource Expand file tree Collapse file tree 8 files changed +117
-810
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ default: build
16
16
build : fmtcheck
17
17
mkdir -p $(PLUGIN_PATH )
18
18
go build -o $(PLUGIN_PATH ) /$(BINARY_NAME ) _v$(VERSION )
19
+ go build -o bin/$(BINARY_NAME )
19
20
20
21
test : fmtcheck
21
22
go test -i $(TEST ) || exit 1
Original file line number Diff line number Diff line change @@ -24,6 +24,43 @@ $ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-gcorelabs
24
24
$ make build
25
25
```
26
26
27
+ ### Override Terraform provider
28
+
29
+ To override terraform provider for development goals you do next steps:
30
+
31
+ create Terraform configuration file
32
+ ``` shell
33
+ $ touch ~ /.terraformrc
34
+ ```
35
+
36
+ point provider to development path
37
+ ``` shell
38
+ provider_installation {
39
+
40
+ dev_overrides {
41
+ " local.gcorelabs.com/repo/gcore" = " /<dev-path>/terraform-provider-gcorelabs/bin"
42
+ }
43
+
44
+ # For all other providers, install them directly from their origin provider
45
+ # registries as normal. If you omit this, Terraform will _only_ use
46
+ # the dev_overrides block, and so no other providers will be available.
47
+ direct {}
48
+ }
49
+ ```
50
+
51
+ add ` local.gcorelabs.com/repo/gcore ` to .tf configuration file
52
+ ``` shell
53
+ terraform {
54
+ required_version = " >= 0.13.0"
55
+
56
+ required_providers {
57
+ gcore = {
58
+ source = " local.gcorelabs.com/repo/gcore"
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
27
64
Using the provider
28
65
------------------
29
66
To use the provider, prepare configuration files based on examples
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ resource "gcore_cdn_resource" "cdn_example_com" {
49
49
jpg_quality = 55
50
50
png_quality = 66
51
51
}
52
+
53
+ tls_versions {
54
+ enabled = true
55
+ value = [
56
+ "TLSv1.2",
57
+ ]
58
+ }
52
59
}
53
60
}
54
61
```
@@ -95,6 +102,7 @@ Optional:
95
102
- ` sni ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--sni ) )
96
103
- ` static_headers ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--static_headers ) )
97
104
- ` static_request_headers ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--static_request_headers ) )
105
+ - ` tls_versions ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--tls_versions ) )
98
106
- ` webp ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--webp ) )
99
107
- ` websockets ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--websockets ) )
100
108
@@ -249,6 +257,18 @@ Optional:
249
257
- ` enabled ` (Boolean)
250
258
251
259
260
+ <a id =" nestedblock--options--tls_versions " ></a >
261
+ ### Nested Schema for ` options.tls_versions `
262
+
263
+ Required:
264
+
265
+ - ` value ` (Set of String)
266
+
267
+ Optional:
268
+
269
+ - ` enabled ` (Boolean)
270
+
271
+
252
272
<a id =" nestedblock--options--webp " ></a >
253
273
### Nested Schema for ` options.webp `
254
274
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ Optional:
130
130
- ` sni ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--sni ) )
131
131
- ` static_headers ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--static_headers ) )
132
132
- ` static_request_headers ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--static_request_headers ) )
133
+ - ` tls_versions ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--tls_versions ) )
133
134
- ` webp ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--webp ) )
134
135
- ` websockets ` (Block List, Max: 1) (see [ below for nested schema] ( #nestedblock--options--websockets ) )
135
136
@@ -284,6 +285,18 @@ Optional:
284
285
- ` enabled ` (Boolean)
285
286
286
287
288
+ <a id =" nestedblock--options--tls_versions " ></a >
289
+ ### Nested Schema for ` options.tls_versions `
290
+
291
+ Required:
292
+
293
+ - ` value ` (Set of String)
294
+
295
+ Optional:
296
+
297
+ - ` enabled ` (Boolean)
298
+
299
+
287
300
<a id =" nestedblock--options--webp " ></a >
288
301
### Nested Schema for ` options.webp `
289
302
Original file line number Diff line number Diff line change @@ -34,5 +34,12 @@ resource "gcore_cdn_resource" "cdn_example_com" {
34
34
jpg_quality = 55
35
35
png_quality = 66
36
36
}
37
+
38
+ tls_versions {
39
+ enabled = true
40
+ value = [
41
+ " TLSv1.2" ,
42
+ ]
43
+ }
37
44
}
38
45
}
Original file line number Diff line number Diff line change @@ -352,6 +352,26 @@ var (
352
352
},
353
353
},
354
354
},
355
+ "tls_versions" : {
356
+ Type : schema .TypeList ,
357
+ MaxItems : 1 ,
358
+ Optional : true ,
359
+ Description : "" ,
360
+ Elem : & schema.Resource {
361
+ Schema : map [string ]* schema.Schema {
362
+ "enabled" : {
363
+ Type : schema .TypeBool ,
364
+ Optional : true ,
365
+ Default : true ,
366
+ },
367
+ "value" : {
368
+ Type : schema .TypeSet ,
369
+ Elem : & schema.Schema {Type : schema .TypeString },
370
+ Required : true ,
371
+ },
372
+ },
373
+ },
374
+ },
355
375
},
356
376
},
357
377
}
@@ -733,6 +753,18 @@ func listToOptions(l []interface{}) *gcdn.Options {
733
753
Value : opt ["value" ].(bool ),
734
754
}
735
755
}
756
+ if opt , ok := getOptByName (fields , "tls_versions" ); ok {
757
+ enabled := true
758
+ if _ , ok := opt ["enabled" ]; ok {
759
+ enabled = opt ["enabled" ].(bool )
760
+ }
761
+ opts .TLSVersions = & gcdn.TLSVersions {
762
+ Enabled : enabled ,
763
+ }
764
+ for _ , v := range opt ["value" ].(* schema.Set ).List () {
765
+ opts .TLSVersions .Value = append (opts .TLSVersions .Value , v .(string ))
766
+ }
767
+ }
736
768
return & opts
737
769
}
738
770
@@ -820,6 +852,10 @@ func optionsToList(options *gcdn.Options) []interface{} {
820
852
m := structToMap (options .WebSockets )
821
853
result ["websockets" ] = []interface {}{m }
822
854
}
855
+ if options .TLSVersions != nil {
856
+ m := structToMap (options .TLSVersions )
857
+ result ["tls_versions" ] = []interface {}{m }
858
+ }
823
859
return []interface {}{result }
824
860
}
825
861
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ require (
6
6
github.com/AlekSi/pointer v1.2.0
7
7
github.com/G-Core/gcore-dns-sdk-go v0.2.1
8
8
github.com/G-Core/gcore-storage-sdk-go v0.1.2
9
- github.com/G-Core/gcorelabscdn-go v0.1.19
9
+ github.com/G-Core/gcorelabscdn-go v0.1.20
10
10
github.com/G-Core/gcorelabscloud-go v0.4.51
11
11
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
12
12
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
You can’t perform that action at this time.
0 commit comments