diff --git a/jfrog-oauth/README.md b/jfrog-oauth/README.md index f7ea867a..00eee3d2 100644 --- a/jfrog-oauth/README.md +++ b/jfrog-oauth/README.md @@ -59,3 +59,19 @@ jf pip install requests ```shell pip install requests ``` + +### Using the access token in other terraform resources + +JFrog Access token is also available as a terraform output. You can use it in other terraform resources. For example, you can use it to configure an [Artifactory docker registry](https://jfrog.com/help/r/jfrog-artifactory-documentation/docker-registry) with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs). + +```hcl + +provider "docker" { + ... + registry_auth { + address = "https://YYYY.jfrog.io/artifactory/api/docker/REPO-KEY" + username = module.jfrog.username + password = module.jfrog.access_token + } +} +``` diff --git a/jfrog-oauth/main.test.ts b/jfrog-oauth/main.test.ts index f31aa5d7..3397eebb 100644 --- a/jfrog-oauth/main.test.ts +++ b/jfrog-oauth/main.test.ts @@ -15,3 +15,5 @@ describe("jfrog-oauth", async () => { package_managers: "{}", }); }); + +//TODO add more tests diff --git a/jfrog-oauth/main.tf b/jfrog-oauth/main.tf index b6f15832..8a81594c 100644 --- a/jfrog-oauth/main.tf +++ b/jfrog-oauth/main.tf @@ -75,3 +75,14 @@ resource "coder_script" "jfrog" { }) run_on_start = true } + +output "access_token" { + description = "value of the JFrog access token" + value = data.coder_external_auth.jfrog.access_token + sensitive = true +} + +output "username" { + description = "value of the JFrog username" + value = local.username +} diff --git a/jfrog-token/README.md b/jfrog-token/README.md index 42525fc2..512c8634 100644 --- a/jfrog-token/README.md +++ b/jfrog-token/README.md @@ -68,3 +68,19 @@ npm install prettier go get github.com/golang/example/hello pip install requests ``` + +### Using the access token in other terraform resources + +JFrog Access token is also available as a terraform output. You can use it in other terraform resources. For example, you can use it to configure an [Artifactory docker registry](https://jfrog.com/help/r/jfrog-artifactory-documentation/docker-registry) with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs). + +```hcl + +provider "docker" { + ... + registry_auth { + address = "https://YYYY.jfrog.io/artifactory/api/docker/REPO-KEY" + username = module.jfrog.username + password = module.jfrog.access_token + } +} +``` diff --git a/jfrog-token/main.tf b/jfrog-token/main.tf index efee07fe..d9aa55ff 100644 --- a/jfrog-token/main.tf +++ b/jfrog-token/main.tf @@ -108,3 +108,14 @@ resource "coder_script" "jfrog" { }) run_on_start = true } + +output "access_token" { + description = "value of the JFrog access token" + value = artifactory_scoped_token.me.access_token + sensitive = true +} + +output "username" { + description = "value of the JFrog username" + value = local.username +}