Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 2a127ff

Browse files
vvelikodnyVitaly Velikodny
andauthored
* update terraform release.yml (#77)
* update terraform goreleaser * fix origin proto on res creation * update default values for 'custom_values' option & 'secondary_hostnames' Co-authored-by: Vitaly Velikodny <[email protected]>
1 parent b9fb37c commit 2a127ff

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This GitHub action can publish assets for release when a tag is created.
22
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
33
#
4-
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
4+
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
55
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
66
# secret. If you would rather own your own GPG handling, please fork this action
77
# or use an alternative one for key handling.
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
-
2222
name: Checkout
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v2.4.0
2424
-
2525
name: Unshallow
2626
run: git fetch --prune --unshallow
@@ -32,20 +32,18 @@ jobs:
3232
-
3333
name: Import GPG key
3434
id: import_gpg
35-
# TODO: move this to HashiCorp namespace or find alternative that is just simple gpg commands
36-
# see https://github.com/hashicorp/terraform-provider-scaffolding/issues/22
37-
uses: paultyng/[email protected]
35+
uses: hashicorp/[email protected]
3836
env:
3937
# These secrets will need to be configured for the repository:
4038
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
4139
PASSPHRASE: ${{ secrets.PASSPHRASE }}
4240
-
4341
name: Run GoReleaser
44-
uses: goreleaser/goreleaser-action@v2
42+
uses: goreleaser/goreleaser-action@v2.8.1
4543
with:
4644
version: latest
4745
args: release --rm-dist
4846
env:
4947
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
5048
# GitHub sets this automatically
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ archives:
3333
- format: zip
3434
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
3535
checksum:
36+
extra_files:
37+
- glob: 'terraform-registry-manifest.json'
38+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
3639
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
3740
algorithm: sha256
3841
signs:
@@ -48,7 +51,10 @@ signs:
4851
- "--detach-sign"
4952
- "${artifact}"
5053
release:
51-
# If you want to manually examine the release before its live, uncomment this line:
52-
# draft: true
54+
extra_files:
55+
- glob: 'terraform-registry-manifest.json'
56+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
57+
# If you want to manually examine the release before its live, uncomment this line:
58+
# draft: true
5359
changelog:
5460
skip: true

gcore/resource_gcore_cdn_resource.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ var (
4646
Description: "Content will be cached according to origin cache settings. The value applies for a response with codes 200, 201, 204, 206, 301, 302, 303, 304, 307, 308 if an origin server does not have caching HTTP headers. Responses with other codes will not be cached.",
4747
},
4848
"custom_values": {
49-
Type: schema.TypeMap,
50-
Optional: true,
49+
Type: schema.TypeMap,
50+
Optional: true,
51+
Computed: true,
52+
DefaultFunc: func() (interface{}, error) {
53+
return map[string]interface{}{}, nil
54+
},
5155
Elem: schema.TypeString,
5256
Description: "Caching time for a response with specific codes. These settings have a higher priority than the value field. Response code ('304', '404' for example). Use 'any' to specify caching time for all response codes. Caching time in seconds ('0s', '600s' for example). Use '0s' to disable caching for a specific response code.",
5357
},
@@ -278,8 +282,12 @@ func resourceCDNResource() *schema.Resource {
278282
Description: "This option defines the protocol that will be used by CDN servers to request content from an origin source. If not specified, we will use HTTP to connect to an origin server. Possible values are: HTTPS, HTTP, MATCH.",
279283
},
280284
"secondary_hostnames": {
281-
Type: schema.TypeSet,
282-
Optional: true,
285+
Type: schema.TypeSet,
286+
Optional: true,
287+
Computed: true,
288+
DefaultFunc: func() (interface{}, error) {
289+
return []string{}, nil
290+
},
283291
Elem: &schema.Schema{Type: schema.TypeString},
284292
Description: "List of additional CNAMEs.",
285293
},
@@ -325,6 +333,7 @@ func resourceCDNResourceCreate(ctx context.Context, d *schema.ResourceData, m in
325333
req.Description = d.Get("description").(string)
326334
req.Origin = d.Get("origin").(string)
327335
req.OriginGroup = d.Get("origin_group").(int)
336+
req.OriginProtocol = resources.Protocol(d.Get("origin_protocol").(string))
328337

329338
req.Options = listToOptions(d.Get("options").([]interface{}))
330339

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
github.com/G-Core/g-dns-sdk-go v0.1.2
77
github.com/G-Core/gcorelabs-storage-sdk-go v0.0.9
8-
github.com/G-Core/gcorelabscdn-go v0.1.8
8+
github.com/G-Core/gcorelabscdn-go v0.1.9
99
github.com/G-Core/gcorelabscloud-go v0.4.42
1010
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1111
github.com/hashicorp/terraform-exec v0.15.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ github.com/G-Core/gcorelabscdn-go v0.1.7 h1:NFupXalEcAi0lvTH054vhD7taNn8hHEovT60
5757
github.com/G-Core/gcorelabscdn-go v0.1.7/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
5858
github.com/G-Core/gcorelabscdn-go v0.1.8 h1:cP6a3YMN73mRqISMIPWFJ5YVnvPiLjQn1I97l7xkRVk=
5959
github.com/G-Core/gcorelabscdn-go v0.1.8/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
60+
github.com/G-Core/gcorelabscdn-go v0.1.9 h1:ysx/MPSVlfsPvWMorxVxZW7Ow7uM6WNkA3voHw5Sd54=
61+
github.com/G-Core/gcorelabscdn-go v0.1.9/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
6062
github.com/G-Core/gcorelabscloud-go v0.4.42 h1:LBH4GnH82eQ5L/Lfnzm8KJovbIHPzt2KMitVN1V9kDQ=
6163
github.com/G-Core/gcorelabscloud-go v0.4.42/go.mod h1:Z1MF80mWagEUrxygtYkvW/MJEYNmIUPsIEYBB3cKjOM=
6264
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=

0 commit comments

Comments
 (0)