File size: 6,175 Bytes
b6f0f70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# Cloud Run Name
variable "cloud_run_name" {
    type = string
    default = "cloud_run_service"
    description = "Cloud Run Name <type: String>"
}

# Cloud Run Project ID
variable "cloud_run_project" {
    type = string
    description = "Cloud Run Project ID <type: String>"
}

# Cloud Run Description
variable "cloud_run_description" {
    type = string
    default = <<-EOT
        this is service for blablabla
    EOT

    description = "Cloud Run Description <type: String>"
}

# Cloud Run Location
variable "cloud_run_location" {
    type = string
    default = "asia-southeast2"
    description = "Cloud Run Location <type: String>"
}

# Cloud Run Ingress
variable "cloud_run_ingress" {
    type = string
    default = "INGRESS_TRAFFIC_ALL"
    description = "value"
}

# Cloud Run Revision
variable "cloud_run_revision" {
    type = string
    default = "revision-service-xxxxx"
    description = "Cloud Run Revision <type: String>"
}

# Cloud Run Service Account
variable "cloud_run_service_account" {
    type = string
    description = "Cloud Run Service Account <type: String>"
}

# Cloud Run Container Image
variable "cloud_run_image" {
    type = string
    default = "us-docker.pkg.dev/cloudrun/container/hello"
    description = "Cloud Run Container Image <type: String>"
}

# Cloud Run Port
variable "cloud_run_port" {
    type = number
    default = 80
    description = "Cloud Run Port <type: Number>"
}

# Cloud Run vCPU Limit
variable "cloud_run_cpu" {
    type = string
    default = "2m"
    description = "Cloud Run vCPU limit <type: String>"
}

# Cloud Run Memory Limit
variable "cloud_run_memory" {
    type = string
    default = "2Gi"
    description = "Cloud Run Memory Limit <type: String>"
}

# Cloud Run CPU Idle
variable "cloud_run_cpu_idle" {
    type = bool
    default = true
    description = "Cloud Run CPU Idle <type: Bool>"
}

# Cloud Run StartUp CPU Boost
variable "cloud_run_cpu_boost" {
    type = bool
    default = true
    description = "Cloud Run StartUp CPU Boost <type: String>"
}

# Cloud Run StartUp Probe
variable "cloud_run_startup_probe" {
    type = map(any)

    default = {
        http_path = "/"
        http_port = 80

        period_seconds = 240
        timeout_seconds = 5
        failure_threshold = 5
        initial_delay_seconds = 10
    }

    description =<<-EOT
        Cloud Run StartUp Probe <type: Map(Any)>
        Example: 
           cloud_run_startup_probe = {
             http_path = "/"
             http_port = 80

             period_seconds = 240
             timeout_seconds = 5
             failure_threshold = 5
             initial_delay_seconds = 10
           } 
    EOT
}

# Cloud Run Liveness Probe
variable "cloud_run_liveness_probe" {
    type = map(any)

    default = {
        http_path = "/"
        http_port = 80

        period_seconds = 240
        timeout_seconds = 5
        failure_threshold = 5
        initial_delay_seconds = 10
    }

    description =<<-EOT
        Cloud Run Liveness Probe <type: Map(Any)>
        Example: 
           cloud_run_startup_probe {
             http_path = "/"
             http_port = 80

             period_seconds = 240
             timeout_seconds = 5
             failure_threshold = 5
             initial_delay_seconds = 10
           } 
    EOT
}

# Cloud Run Timeout
variable "cloud_run_timeout" {
    type = number
    default = 800
    description = "Cloud Run Timeout <type: Number>"
}

# Cloud Run Max Instance Request Concurrency
variable "cloud_run_max_instance_concurrent" {
    type = number
    default = 80
    description = "Cloud Run Max Instance Request Concurrency <type: Number>"
}

# Cloud Run Execution Environment
variable "cloud_run_execution_environment" {
    type = string
    default = "EXECUTION_ENVIRONMENT_GEN1"
    description = "Cloud Run Execution Environment <type: String>"
}

# Cloud Run Min Instance
variable "cloud_run_min_instance" {
    type = number
    default = 0
    description = "Cloud Run Min Instance <type: Number>"
}

# Cloud Run Max Instance
variable "cloud_run_max_instance" {
    type = number
    default = 15
    description = "Cloud Run Max Instance <type: Number>"
}

# Cloud Run Traffic Percent
variable "cloud_run_traffic_percent" {
    type = number
    default = 100
    description = "Cloud Run Traffic Percent <type: Number>"
}

# Cloud Run Traffic Type
variable "cloud_run_traffic_type" {
    type = string
    default = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
    description = "Cloud Run Traffic Type <type: String>"
}

# Cloud Run Connector
variable "cloud_run_vpc_access_connector" {
    type = string
    default = "project-vpc-connector"
    description = "Cloud Run Connector <type: String>"
}

# Cloud Run VPC Access Egress
variable "cloud_run_vpc_access_egress" {
    type = string
    default = "ALL_TRAFFIC"
    description = "Cloud Run VPC Access Egress <type: String>"
}

# Cloud Run Environment Variables
variable "cloud_run_envars" {
    type = map(string)
    sensitive = true

    default = {
        DATABASE_PORT = "5432"
        POSTGRES_USER = "postgres"
        POSTGRES_DB = "dbname"
        POSTGRES_HOST = "postgres"
        POSTGRES_HOSTNAME = "127.0.0.1"

        ACCESS_TOKEN_EXPIRES_IN = "15"
        REFRESH_TOKEN_EXPIRES_IN = "60"
        JWT_ALGORITHM = "RS256"
        CLIENT_ORIGIN = "*"

        JWT_PUBLIC_KEY = "<jwt public key>"
        JWT_PRIVATE_KEY = "<jwt private key>"
        POSTGRES_PASSWORD = "secret value"
    }

    description =<<-EOT
        Cloud Run Environment Variables <type: map(String)>
        Example:
            cloud_run_envars = {
                DATABASE_PORT = "5432"
                POSTGRES_USER = "postgres"
                POSTGRES_DB = "docpet"
                POSTGRES_HOST = "postgres"
                POSTGRES_HOSTNAME = "127.0.0.1"

                ACCESS_TOKEN_EXPIRES_IN = "15"
                REFRESH_TOKEN_EXPIRES_IN = "60"
                JWT_ALGORITHM = "RS256"
                CLIENT_ORIGIN = "*"

                JWT_PUBLIC_KEY = "<jwt public key>"
                JWT_PRIVATE_KEY = "<jwt private key>"
                POSTGRES_PASSWORD = "secret value"
            }
    EOT
}