-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.tf
64 lines (56 loc) · 1.62 KB
/
example.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
terraform {
required_providers {
artifactory = {
source = "jfrog/artifactory"
version = "12.7.1"
}
platform = {
source = "jfrog/platform"
version = "2.2.0"
}
}
}
variable "jfrog_url" {
type = string
default = "http://localhost:8081"
}
provider "artifactory" {
url = "${var.jfrog_url}"
// supply JFROG_ACCESS_TOKEN as env var
}
provider "platform" {
url = "${var.jfrog_url}"
// supply JFROG_ACCESS_TOKEN as env var
}
resource "platform_global_role" "my-global-role" {
name = "my-global-role"
description = "Test description"
type = "CUSTOM_GLOBAL"
environments = ["DEV"]
actions = ["READ_REPOSITORY", "READ_BUILD"]
}
resource "artifactory_local_generic_repository" "my-generic-local" {
key = "my-generic-local"
}
resource "platform_workers_service" "my-workers-service" {
key = "my-workers-service"
enabled = true
description = "My workers service"
source_code = "export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => { console.log(await context.clients.platformHttp.get('/artifactory/api/system/ping')); console.log(await axios.get('https://my.external.resource')); return { status: 'DOWNLOAD_PROCEED', message: 'proceed', } }"
action = "BEFORE_DOWNLOAD"
filter_criteria = {
artifact_filter_criteria = {
repo_keys = [artifactory_local_generic_repository.my-generic-local.key]
}
}
secrets = [
{
key = "my-secret-key-1"
value = "my-secret-value-1"
},
{
key = "my-secret-key-2"
value = "my-secret-value-2"
}
]
}