Skip to content

Commit 47ecf32

Browse files
authored
VAULT-31184: Support identity token auth in data_artifactory_item (#22)
The primary motivation for this PR is to add support for identity token auth to the `artifactory_item` datasource. This will allow us to migrate from API auth to identity token auth. We maintain backwards compatibility with API auth and do not change any schema, except for `username` no longer being required. If no username is provided we assume token that is required is for identity token auth, not API auth. > [!NOTE] > Since this is a repo in the forge and public we cannot utilize the doormat action to test token auth in CI. As such, I've tested both the artifactory package and the datasource ACC tests locally using both identity token and API auth. We also do a bit of housekeeping and update our Go modules and pin to the latest Github actions. > [!NOTE] > We are currently behind on `terraform-plugin-go` as the server interface now requires implementing provider functions, which we have not done yet. * actions: pin to latest actions * go: update deps * bump version * rebuild docs * fix linter Signed-off-by: Ryan Cragun <[email protected]>
1 parent 5d34826 commit 47ecf32

File tree

13 files changed

+208
-106
lines changed

13 files changed

+208
-106
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- darwin
2424
- linux
2525
steps:
26-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2727
with:
2828
ref: ${{ inputs.sha }} # checkout out our sha to get the version
2929
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
@@ -33,7 +33,7 @@ jobs:
3333
uses: ./.github/actions/build-provider
3434
with:
3535
target: ${{matrix.os}}/${{ matrix.arch }}
36-
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
36+
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
3737
with:
3838
name: ${{ steps.build.outputs.name }}
3939
path: dist/${{ steps.build.outputs.name }}
@@ -60,7 +60,7 @@ jobs:
6060
- test-build-artifacts
6161
runs-on: ubuntu-latest
6262
steps:
63-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
63+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
6464
with:
6565
ref: ${{ inputs.sha }} # checkout out our sha to get the version
6666
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2

.github/workflows/run-sample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
outputs:
4343
sample: ${{ steps.metadata.outputs.sample }}
4444
steps:
45-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
45+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
4646
- uses: hashicorp/action-setup-enos@v1
4747
with:
4848
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}

.github/workflows/run-scenario.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
env:
2525
ENOS_DEBUG_DATA_ROOT_DIR: /tmp/enos/logs
2626
steps:
27-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2828
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
2929
with:
3030
# The github actions service user creds for this account managed in hashicorp/enos-ci

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ jobs:
2424
- darwin
2525
- linux
2626
steps:
27-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2828
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
2929
with:
3030
go-version-file: go.mod
3131
- id: build
3232
uses: ./.github/actions/build-provider
3333
with:
3434
target: ${{matrix.os}}/${{ matrix.arch }}
35-
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
35+
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
3636
with:
3737
name: ${{ steps.build.outputs.name }}
3838
path: dist/${{ steps.build.outputs.name }}
@@ -48,7 +48,7 @@ jobs:
4848
name: go test
4949
runs-on: ubuntu-latest
5050
steps:
51-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
51+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
5252
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
5353
with:
5454
go-version-file: go.mod
@@ -62,7 +62,7 @@ jobs:
6262
TF_VAR_ssh_key_name: enos-ci-ssh-key
6363
TF_VAR_private_key_path: ./ssh.pem
6464
steps:
65-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
6666
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
6767
with:
6868
go-version-file: go.mod
@@ -118,7 +118,7 @@ jobs:
118118
runs-on: ubuntu-latest
119119
needs: build
120120
steps:
121-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
121+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
122122
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
123123
with:
124124
go-version-file: go.mod
@@ -149,7 +149,7 @@ jobs:
149149
name: static analysis
150150
runs-on: ubuntu-latest
151151
steps:
152-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
152+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
153153
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
154154
with:
155155
go-version-file: go.mod

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ linters-settings:
4949
- G110
5050
# Don't worry about zip file traversals
5151
- G305
52+
# Don't worry about casting int -> uint
53+
- G115
5254
config:
5355
G306:
5456
# allow creating files with 0755 permissions
@@ -77,6 +79,7 @@ linters:
7779
- errorlint
7880
- execinquery
7981
- exhaustruct
82+
- fatcontext
8083
- forbidigo
8184
- forcetypeassert
8285
- funlen

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.5
1+
0.5.6

docs/data-sources/artifactory_item.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ for every criteria. This means that you can use wildcards `*` for any field. See
2929
### Required
3030

3131
- `host` (String) The Artifactory API host. It should be the fully qualified base URL
32-
- `token` (String, Sensitive) The Artifactory API token. You can sign into Artifactory and generate one.
33-
- `username` (String) The Artifactory API user name. Depending on your login scheme this is likely an email address
32+
- `token` (String, Sensitive) The Artifactory API Key token or identity token. API keys are deprecated so it is best to use an identity token
3433

3534
### Optional
3635

3736
- `name` (String) The name of the artifact that you're looking for
3837
- `path` (String) The sub-path inside the Artifactory repository to search in
3938
- `properties` (Map of String) A map of properties to match on
4039
- `repo` (String) The Artifactory repository you want to search in
40+
- `username` (String) The Artifactory API Key user name. Depending on your login scheme this is likely an email address. If no username is provided we'll assume you wish to use an identity token for Auth
4141

4242
### Read-Only
4343

go.mod

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,67 @@
11
module github.com/hashicorp-forge/terraform-provider-enos
22

3-
go 1.22.5
3+
go 1.23
4+
5+
toolchain go1.23.2
46

57
require (
68
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
79
github.com/aws/aws-sdk-go v1.55.5
8-
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.9
9-
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.2
10+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.33
11+
github.com/aws/aws-sdk-go-v2/service/s3 v1.66.0
1012
github.com/blang/semver v3.5.1+incompatible
1113
github.com/google/go-github/v60 v60.0.0
1214
github.com/hashicorp/go-multierror v1.1.1
13-
github.com/hashicorp/hcl/v2 v2.21.0
14-
github.com/hashicorp/nomad/api v0.0.0-20240801185634-0c01b2d4e499
15+
github.com/hashicorp/hcl/v2 v2.22.0
16+
github.com/hashicorp/nomad/api v0.0.0-20241018135242-11573fba89fd
1517
github.com/hashicorp/terraform-plugin-go v0.22.2
1618
github.com/hashicorp/terraform-plugin-log v0.9.0
1719
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
18-
github.com/miekg/dns v1.1.61
20+
github.com/miekg/dns v1.1.62
1921
github.com/mitchellh/cli v1.1.5
2022
github.com/pkg/errors v0.9.1
2123
github.com/spf13/cobra v1.8.1
2224
github.com/spf13/pflag v1.0.5
2325
github.com/stretchr/testify v1.9.0
2426
github.com/zclconf/go-cty v1.15.0
2527
go.uber.org/zap v1.27.0
26-
golang.org/x/crypto v0.25.0
27-
golang.org/x/mod v0.19.0
28-
google.golang.org/grpc v1.65.0
29-
k8s.io/api v0.30.3
30-
k8s.io/apimachinery v0.30.3
31-
k8s.io/client-go v0.30.3
32-
sigs.k8s.io/kind v0.23.0
28+
golang.org/x/crypto v0.28.0
29+
golang.org/x/mod v0.21.0
30+
google.golang.org/grpc v1.67.1
31+
k8s.io/api v0.31.1
32+
k8s.io/apimachinery v0.31.1
33+
k8s.io/client-go v0.31.1
34+
sigs.k8s.io/kind v0.24.0
3335
)
3436

3537
require (
38+
dario.cat/mergo v1.0.1 // indirect
3639
github.com/BurntSushi/toml v1.4.0 // indirect
3740
github.com/Masterminds/goutils v1.1.1 // indirect
38-
github.com/Masterminds/semver/v3 v3.2.1 // indirect
39-
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
41+
github.com/Masterminds/semver/v3 v3.3.0 // indirect
42+
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
4043
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
4144
github.com/agext/levenshtein v1.2.3 // indirect
4245
github.com/alessio/shellescape v1.4.2 // indirect
4346
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
4447
github.com/armon/go-radix v1.0.0 // indirect
45-
github.com/aws/aws-sdk-go-v2 v1.30.3 // indirect
46-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
47-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
48-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect
49-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15 // indirect
50-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
51-
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.17 // indirect
52-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 // indirect
53-
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.15 // indirect
54-
github.com/aws/smithy-go v1.20.3 // indirect
48+
github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect
49+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
50+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect
51+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect
52+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect
53+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
54+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect
55+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect
56+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect
57+
github.com/aws/smithy-go v1.22.0 // indirect
5558
github.com/bgentry/speakeasy v0.2.0 // indirect
5659
github.com/cloudflare/circl v1.3.3 // indirect
57-
github.com/davecgh/go-spew v1.1.1 // indirect
60+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
5861
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
5962
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
6063
github.com/fatih/color v1.17.0 // indirect
64+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
6165
github.com/go-logr/logr v1.4.2 // indirect
6266
github.com/go-openapi/jsonpointer v0.21.0 // indirect
6367
github.com/go-openapi/jsonreference v0.21.0 // indirect
@@ -87,7 +91,7 @@ require (
8791
github.com/hashicorp/terraform-json v0.17.1 // indirect
8892
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
8993
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
90-
github.com/hashicorp/yamux v0.1.1 // indirect
94+
github.com/hashicorp/yamux v0.1.2 // indirect
9195
github.com/huandu/xstrings v1.5.0 // indirect
9296
github.com/imdario/mergo v0.3.16 // indirect
9397
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -110,32 +114,33 @@ require (
110114
github.com/oklog/run v1.1.0 // indirect
111115
github.com/pborman/uuid v1.2.1 // indirect
112116
github.com/pelletier/go-toml v1.9.5 // indirect
113-
github.com/pmezard/go-difflib v1.0.0 // indirect
117+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
114118
github.com/posener/complete v1.2.3 // indirect
115119
github.com/shopspring/decimal v1.4.0 // indirect
116-
github.com/spf13/cast v1.6.0 // indirect
120+
github.com/spf13/cast v1.7.0 // indirect
117121
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
118122
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
119123
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
124+
github.com/x448/float16 v0.8.4 // indirect
120125
go.uber.org/multierr v1.11.0 // indirect
121-
golang.org/x/net v0.27.0 // indirect
122-
golang.org/x/oauth2 v0.21.0 // indirect
123-
golang.org/x/sync v0.7.0 // indirect
124-
golang.org/x/sys v0.22.0 // indirect
125-
golang.org/x/term v0.22.0 // indirect
126-
golang.org/x/text v0.16.0 // indirect
127-
golang.org/x/time v0.5.0 // indirect
128-
golang.org/x/tools v0.23.0 // indirect
126+
golang.org/x/net v0.30.0 // indirect
127+
golang.org/x/oauth2 v0.23.0 // indirect
128+
golang.org/x/sync v0.8.0 // indirect
129+
golang.org/x/sys v0.26.0 // indirect
130+
golang.org/x/term v0.25.0 // indirect
131+
golang.org/x/text v0.19.0 // indirect
132+
golang.org/x/time v0.7.0 // indirect
133+
golang.org/x/tools v0.26.0 // indirect
129134
google.golang.org/appengine v1.6.8 // indirect
130-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
131-
google.golang.org/protobuf v1.34.2 // indirect
135+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
136+
google.golang.org/protobuf v1.35.1 // indirect
132137
gopkg.in/inf.v0 v0.9.1 // indirect
133138
gopkg.in/yaml.v2 v2.4.0 // indirect
134139
gopkg.in/yaml.v3 v3.0.1 // indirect
135140
k8s.io/klog/v2 v2.130.1 // indirect
136-
k8s.io/kube-openapi v0.0.0-20240730131305-7a9a4e85957e // indirect
137-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
138-
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
141+
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect
142+
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
143+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
139144
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
140145
sigs.k8s.io/yaml v1.4.0 // indirect
141146
)

0 commit comments

Comments
 (0)