Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

feat: add JFrog access token output to module output #101

Merged
merged 6 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions jfrog-oauth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
```
2 changes: 2 additions & 0 deletions jfrog-oauth/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ describe("jfrog-oauth", async () => {
package_managers: "{}",
});
});

//TODO add more tests
11 changes: 11 additions & 0 deletions jfrog-oauth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
16 changes: 16 additions & 0 deletions jfrog-token/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
```
11 changes: 11 additions & 0 deletions jfrog-token/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}