Skip to content

Commit 98bb94c

Browse files
authored
feat: add JFrog access token output to module output (coder#101)
1 parent 8e3f48c commit 98bb94c

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

jfrog-oauth/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,19 @@ jf pip install requests
5959
```shell
6060
pip install requests
6161
```
62+
63+
### Using the access token in other terraform resources
64+
65+
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).
66+
67+
```hcl
68+
69+
provider "docker" {
70+
...
71+
registry_auth {
72+
address = "https://YYYY.jfrog.io/artifactory/api/docker/REPO-KEY"
73+
username = module.jfrog.username
74+
password = module.jfrog.access_token
75+
}
76+
}
77+
```

jfrog-oauth/main.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ describe("jfrog-oauth", async () => {
1515
package_managers: "{}",
1616
});
1717
});
18+
19+
//TODO add more tests

jfrog-oauth/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,14 @@ resource "coder_script" "jfrog" {
7575
})
7676
run_on_start = true
7777
}
78+
79+
output "access_token" {
80+
description = "value of the JFrog access token"
81+
value = data.coder_external_auth.jfrog.access_token
82+
sensitive = true
83+
}
84+
85+
output "username" {
86+
description = "value of the JFrog username"
87+
value = local.username
88+
}

jfrog-token/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,19 @@ npm install prettier
6868
go get github.com/golang/example/hello
6969
pip install requests
7070
```
71+
72+
### Using the access token in other terraform resources
73+
74+
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).
75+
76+
```hcl
77+
78+
provider "docker" {
79+
...
80+
registry_auth {
81+
address = "https://YYYY.jfrog.io/artifactory/api/docker/REPO-KEY"
82+
username = module.jfrog.username
83+
password = module.jfrog.access_token
84+
}
85+
}
86+
```

jfrog-token/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,14 @@ resource "coder_script" "jfrog" {
108108
})
109109
run_on_start = true
110110
}
111+
112+
output "access_token" {
113+
description = "value of the JFrog access token"
114+
value = artifactory_scoped_token.me.access_token
115+
sensitive = true
116+
}
117+
118+
output "username" {
119+
description = "value of the JFrog username"
120+
value = local.username
121+
}

0 commit comments

Comments
 (0)