atlassian / terraform-provider-artifactory

Terraform provider to manage Artifactory
Apache License 2.0
89 stars 42 forks source link

Add resource: api_key #74

Closed bendrucker closed 4 years ago

bendrucker commented 4 years ago

Adds an artifactory_api_key resource for managing API keys. This allows a user to generate an initial set of credentials for Terraform and then combine artifactory_user and artifactory_api_key to provision additional users/keys for other systems.

This is particularly important for organizations that require encrypted passwords, meaning the user's password cannot be used in package clients:

https://www.jfrog.com/confluence/display/JFROG/Centrally+Secure+Passwords

bendrucker commented 4 years ago

Have not had a chance to run the acceptance tests but wanted to get this up. I will run them soon and post the results.

atlassian-cla-bot[bot] commented 4 years ago

Hooray! All contributors have signed the CLA.

bendrucker commented 4 years ago

Hi there, finally got around to running the acceptance test, thanks for the nice Docker setup! Fixed a small issue, now good to go:

TESTARGS="-run TestAccApiKey" make testacc
==> Checking that code complies with gofmt requirements...
==> Launching Artifactory in Docker...
12b709698af29e13297cd3ae4cf75eff3755cc5506539db8a4eeeb5369a694d9
Waiting for Artifactory to start
curl: (52) Empty reply from server
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
curl: (22) The requested URL returned error: 503 Service Unavailable
.
==> Starting integration tests
TF_ACC=1 ARTIFACTORY_USERNAME=admin ARTIFACTORY_PASSWORD=password ARTIFACTORY_URL=http://localhost:8080/artifactory \
    go test ./... -v -parallel 20 -run TestAccApiKey -timeout 120m
?       github.com/atlassian/terraform-provider-artifactory [no test files]
=== RUN   TestAccApiKey
--- PASS: TestAccApiKey (0.63s)
PASS
ok      github.com/atlassian/terraform-provider-artifactory/pkg/artifactory 0.888s
bendrucker commented 4 years ago

@ttsangAtlassian Based on your comment in https://github.com/atlassian/terraform-provider-artifactory/pull/77#issuecomment-638527859—is this something you're interested in merging even if Atlassian doesn't use this resource? Totally understand that you're not going to prioritize outside bugs and feature requests, just wondering if that extends to PRs.

ttsangAtlassian commented 4 years ago

Looks good to me. I'll merge it in now

ttsangAtlassian commented 4 years ago

@bendrucker I've just cut a new release which should include these changes