-
Notifications
You must be signed in to change notification settings - Fork 3
/
sample.tf
157 lines (141 loc) · 2.73 KB
/
sample.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
terraform {
required_providers {
platform = {
source = "jfrog/platform"
version = "1.9.0"
}
}
}
variable "jfrog_url" {
type = string
default = "https://my.jfrog.io"
}
provider "platform" {
url = "${var.jfrog_url}"
// supply JFROG_ACCESS_TOKEN as env var
}
resource "platform_workers_service" "my-workers-service" {
key = "my-workers-service"
enabled = true
description = "My workers service"
source_code = <<EOT
export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => {
console.log(await context.clients.platform Http.get('/artifactory/api/system/ping'));
console.log(await axios.get('https://my.external.resource'));
return {
status: 'DOWNLOAD_PROCEED',
message: 'proceed',
}
}
EOT
action = "BEFORE_DOWNLOAD"
filter_criteria = {
artifact_filter_criteria = {
repo_keys = ["my-generic-local"]
}
}
secrets = [
{
key = "my-secret-key-1"
value = "my-secret-value-1"
},
{
key = "my-secret-key-2"
value = "my-secret-value-2"
}
]
}
resource "platform_permission" "my-permission" {
name = "my-permission-name"
artifact = {
actions = {
users = [
{
name = "my-user"
permissions = ["READ", "WRITE"]
}
]
}
targets = [
{
name = "my-docker-local"
include_patterns = ["**"]
},
{
name = "ALL-LOCAL"
include_patterns = ["**", "*.js"]
},
{
name = "ALL-REMOTE"
include_patterns = ["**", "*.js"]
},
{
name = "ALL-DISTRIBUTION"
include_patterns = ["**", "*.js"]
}
]
}
build = {
targets = [
{
name = "artifactory-build-info"
include_patterns = ["**"]
exclude_patterns = ["*.js"]
}
]
}
release_bundle = {
actions = {
users = [
{
name = "my-user"
permissions = ["READ", "WRITE"]
}
]
groups = [
{
name = "my-group"
permissions = ["READ", "ANNOTATE"]
}
]
}
targets = [
{
name = "release-bundle"
include_patterns = ["**"]
}
]
}
destination = {
actions = {
groups = [
{
name = "my-group"
permissions = ["READ", "ANNOTATE"]
}
]
}
targets = [
{
name = "*"
include_patterns = ["**"]
}
]
}
pipeline_source = {
actions = {
groups = [
{
name = "my-group"
permissions = ["READ", "ANNOTATE"]
}
]
}
targets = [
{
name = "*"
include_patterns = ["**"]
}
]
}
}