Skip to content

Commit 3ee426d

Browse files
authored
Merge pull request #11 from philips-software/feature/upgrade-go-hsdp-api
Upgrade dependencies
2 parents 5998bb2 + 8df25db commit 3ee426d

File tree

7 files changed

+84
-36
lines changed

7 files changed

+84
-36
lines changed

.github/workflows/build_docker.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,25 @@ jobs:
2020
DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
2121
DOCKER_ORGANIZATION: philipssoftware
2222
GITHUB_ORGANIZATION: philips-software
23+
24+
goreleaser:
25+
runs-on: ubuntu-latest
26+
steps:
27+
-
28+
name: Checkout
29+
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
-
33+
name: Set up Go
34+
uses: actions/setup-go@v2
35+
with:
36+
go-version: 1.14.4
37+
-
38+
name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v2
40+
with:
41+
version: latest
42+
args: release --rm-dist
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
*.backup
44
*.out
55
*.tf
6+
*.exe
67
.DS_Store
78
terraform-provider-hsdp
89
build/
10+
dist/
911
.idea/

.goreleaser.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod download
7+
# you may remove this if you don't need go generate
8+
#- go generate ./...
9+
10+
env:
11+
- CGO_ENABLED=0
12+
13+
builds:
14+
- id: binary
15+
goos:
16+
- windows
17+
- darwin
18+
- linux
19+
goarch:
20+
- amd64
21+
- arm64
22+
goarm:
23+
- 8
24+
ldflags:
25+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=binaryRelease
26+
27+
archives:
28+
-
29+
format: binary
30+
31+
checksum:
32+
name_template: 'checksums.txt'
33+
34+
snapshot:
35+
name_template: "{{ .Tag }}-next"
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- '^docs:'
42+
- '^test:'

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
99
github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 // indirect
1010
github.com/hashicorp/terraform-plugin-sdk v1.12.0
11-
github.com/philips-software/go-hsdp-api v0.19.1-0.20200701073942-567142717405
11+
github.com/philips-software/go-hsdp-api v0.20.0
1212
github.com/pkg/errors v0.9.1
1313
github.com/stretchr/testify v1.5.1
1414
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
4545
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
4646
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
4747
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
48+
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
4849
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
4950
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
5051
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
@@ -190,6 +191,8 @@ github.com/philips-software/go-hsdp-api v0.19.0 h1:ygdMrGSUokYQ1QaImxK8DPFipgXWN
190191
github.com/philips-software/go-hsdp-api v0.19.0/go.mod h1:9+2MQAUHTHJtQmTCiHwLalgrMRVin019Zo0/3Qf5Zc4=
191192
github.com/philips-software/go-hsdp-api v0.19.1-0.20200701073942-567142717405 h1:4yKlYeT9iGOgZWS39wm57IllAz0zIQ24tTG6ucj9K+0=
192193
github.com/philips-software/go-hsdp-api v0.19.1-0.20200701073942-567142717405/go.mod h1:9+2MQAUHTHJtQmTCiHwLalgrMRVin019Zo0/3Qf5Zc4=
194+
github.com/philips-software/go-hsdp-api v0.20.0 h1:jLhoS4Yx4ohHwjI6bcVESX0tLgsdZc//8UuETgyIx/c=
195+
github.com/philips-software/go-hsdp-api v0.20.0/go.mod h1:agJtsgjb1W4xq5cVUdk06uUVETKO1nKZAZJ4Y1Dumg4=
193196
github.com/philips-software/go-hsdp-signer v1.3.0 h1:Si1voDE/GHzthmxpasPdntbu8aUW6EYJfI6gHVf7BCc=
194197
github.com/philips-software/go-hsdp-signer v1.3.0/go.mod h1:/QehZ/+Aks2t1TFpjhF/7ZSB8PJIIJHzLc03rOqwLw0=
195198
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=

hsdp/config.go

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ type Config struct {
1919
CartelNoTLS bool
2020
CartelSkipVerify bool
2121
RetryMax int
22-
Region string
23-
Environment string
2422

2523
iamClient *iam.Client
2624
cartelClient *cartel.Client
@@ -66,20 +64,6 @@ func (c *Config) setupIAMClient() {
6664
standardClient = retryClient.StandardClient()
6765
}
6866
c.iamClient = nil
69-
// Auto config
70-
if c.Environment != "" && c.Region != "" {
71-
ac, err := config.New(config.WithRegion(c.Region), config.WithEnv(c.Environment))
72-
if err == nil {
73-
iamService := ac.Service("iam")
74-
if url, err := iamService.String("iam_url"); err == nil && c.IAMURL == "" {
75-
c.IAMURL = url
76-
}
77-
if url, err := iamService.String("idm_url"); err == nil && c.IDMURL == "" {
78-
c.IDMURL = url
79-
}
80-
}
81-
}
82-
8367
client, err := iam.NewClient(standardClient, &c.Config)
8468
if err != nil {
8569
c.iamClientErr = err
@@ -112,7 +96,7 @@ func (c *Config) setupS3CredsClient() {
11296
if c.Environment != "" && c.Region != "" {
11397
ac, err := config.New(config.WithRegion(c.Region), config.WithEnv(c.Environment))
11498
if err == nil {
115-
if url, err := ac.Service("s3creds").String("url"); err == nil && c.S3CredsURL == "" {
99+
if url, err := ac.Service("s3creds").GetString("url"); err == nil && c.S3CredsURL == "" {
116100
c.S3CredsURL = url
117101
}
118102
}
@@ -133,24 +117,17 @@ func (c *Config) setupS3CredsClient() {
133117

134118
// setupCartelClient sets up an Cartel client
135119
func (c *Config) setupCartelClient() {
136-
client, err := cartel.NewClient(nil, cartel.Config{
137-
Host: c.CartelHost,
138-
Token: c.CartelToken,
139-
Secret: c.CartelSecret,
140-
NoTLS: c.CartelNoTLS,
141-
SkipVerify: c.CartelSkipVerify,
142-
Debug: c.Debug,
143-
DebugLog: c.DebugLog,
120+
client, err := cartel.NewClient(nil, &cartel.Config{
121+
Region: c.Region,
122+
Environment: c.Environment,
123+
Host: c.CartelHost,
124+
Token: c.CartelToken,
125+
Secret: c.CartelSecret,
126+
NoTLS: c.CartelNoTLS,
127+
SkipVerify: c.CartelSkipVerify,
128+
Debug: c.Debug,
129+
DebugLog: c.DebugLog,
144130
})
145-
// Auto config
146-
if c.Environment != "" && c.Region != "" {
147-
ac, err := config.New(config.WithRegion(c.Region), config.WithEnv(c.Environment))
148-
if err == nil {
149-
if host, err := ac.Service("cartel").String("host"); err == nil && c.CartelHost == "" {
150-
c.CartelHost = host
151-
}
152-
}
153-
}
154131
if err != nil {
155132
c.cartelClient = nil
156133
c.cartelClientErr = err

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import (
88

99
var commit = "deadbeef"
1010
var release = "v0.0.0"
11-
var buildVersion = release + "-" + commit
11+
var date = "0000-00-00"
12+
var buildSource = "unknown"
13+
var buildVersion = release + "-" + commit + "." + date + "." + buildSource
1214

1315
func main() {
1416
plugin.Serve(&plugin.ServeOpts{

0 commit comments

Comments
 (0)