From d75b86c9bde58105ff694c6f4318cc89e73ef75f Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 15 Nov 2023 15:41:38 +0300 Subject: [PATCH 1/5] Add JFrog access token output to module output --- jfrog-oauth/main.tf | 5 +++++ jfrog-token/main.tf | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/jfrog-oauth/main.tf b/jfrog-oauth/main.tf index b6f15832..8ceb3f73 100644 --- a/jfrog-oauth/main.tf +++ b/jfrog-oauth/main.tf @@ -75,3 +75,8 @@ 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 +} diff --git a/jfrog-token/main.tf b/jfrog-token/main.tf index a5861480..42f08250 100644 --- a/jfrog-token/main.tf +++ b/jfrog-token/main.tf @@ -88,3 +88,8 @@ 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 +} From bf876b2ad476e9a092efa62fb1d126999fd6c635 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 15 Nov 2023 16:27:10 +0300 Subject: [PATCH 2/5] add examples --- jfrog-oauth/README.md | 16 ++++++++++++++++ jfrog-oauth/main.tf | 5 +++++ jfrog-token/README.md | 16 ++++++++++++++++ jfrog-token/main.tf | 5 +++++ 4 files changed, 42 insertions(+) diff --git a/jfrog-oauth/README.md b/jfrog-oauth/README.md index f7ea867a..73c7bb3c 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 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.tf b/jfrog-oauth/main.tf index 8ceb3f73..ea980d48 100644 --- a/jfrog-oauth/main.tf +++ b/jfrog-oauth/main.tf @@ -80,3 +80,8 @@ output "access_token" { description = "value of the JFrog access token" value = data.coder_external_auth.jfrog.access_token } + +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..f7dcdc79 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 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 ac798625..8a987174 100644 --- a/jfrog-token/main.tf +++ b/jfrog-token/main.tf @@ -113,3 +113,8 @@ output "access_token" { description = "value of the JFrog access token" value = artifactory_scoped_token.me.access_token } + +output "username" { + description = "value of the JFrog username" + value = local.username +} From d9a0656065fcdd0a5a4f3c38a5859f66dbae12ac Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 15 Nov 2023 16:28:27 +0300 Subject: [PATCH 3/5] add docs link --- jfrog-oauth/README.md | 2 +- jfrog-token/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jfrog-oauth/README.md b/jfrog-oauth/README.md index 73c7bb3c..00eee3d2 100644 --- a/jfrog-oauth/README.md +++ b/jfrog-oauth/README.md @@ -62,7 +62,7 @@ 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 with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs). +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 diff --git a/jfrog-token/README.md b/jfrog-token/README.md index f7dcdc79..512c8634 100644 --- a/jfrog-token/README.md +++ b/jfrog-token/README.md @@ -71,7 +71,7 @@ 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 with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs). +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 From dd88b9da15faab44451ef92e2ac5151dd209aacc Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 15 Nov 2023 16:32:21 +0300 Subject: [PATCH 4/5] Add sensitive flag to JFrog access token output. --- jfrog-oauth/main.test.ts | 2 ++ jfrog-oauth/main.tf | 1 + jfrog-token/main.tf | 1 + 3 files changed, 4 insertions(+) diff --git a/jfrog-oauth/main.test.ts b/jfrog-oauth/main.test.ts index f31aa5d7..26408aba 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 \ No newline at end of file diff --git a/jfrog-oauth/main.tf b/jfrog-oauth/main.tf index ea980d48..8a81594c 100644 --- a/jfrog-oauth/main.tf +++ b/jfrog-oauth/main.tf @@ -79,6 +79,7 @@ resource "coder_script" "jfrog" { output "access_token" { description = "value of the JFrog access token" value = data.coder_external_auth.jfrog.access_token + sensitive = true } output "username" { diff --git a/jfrog-token/main.tf b/jfrog-token/main.tf index 8a987174..d9aa55ff 100644 --- a/jfrog-token/main.tf +++ b/jfrog-token/main.tf @@ -112,6 +112,7 @@ resource "coder_script" "jfrog" { output "access_token" { description = "value of the JFrog access token" value = artifactory_scoped_token.me.access_token + sensitive = true } output "username" { From 2fa46f17cd3e6a8a0219b27ca1fe2ec6ff0dd091 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 15 Nov 2023 16:35:12 +0300 Subject: [PATCH 5/5] `fmt` --- jfrog-oauth/main.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jfrog-oauth/main.test.ts b/jfrog-oauth/main.test.ts index 26408aba..3397eebb 100644 --- a/jfrog-oauth/main.test.ts +++ b/jfrog-oauth/main.test.ts @@ -16,4 +16,4 @@ describe("jfrog-oauth", async () => { }); }); -//TODO add more tests \ No newline at end of file +//TODO add more tests