FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GCP Cloud Run app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Information Services
DevOps
Infrastructure
Terraform Modules
GCP Cloud Run app
Commits
5e17b335
Commit
5e17b335
authored
1 year ago
by
Dr Abraham Martin
Browse files
Options
Downloads
Patches
Plain Diff
Add support for a http_get.value["http_headers"]
parent
b3423ae7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#362138
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.tf
+39
-0
39 additions, 0 deletions
main.tf
variables.tf
+48
-0
48 additions, 0 deletions
variables.tf
with
87 additions
and
0 deletions
main.tf
+
39
−
0
View file @
5e17b335
...
...
@@ -112,6 +112,45 @@ resource "google_cloud_run_service" "webapp" {
containers
{
image
=
var
.
image_name
dynamic
"startup_probe"
{
for_each
=
var
.
startup_probe
!=
{}
?
[
var
.
startup_probe
]
:
[]
content
{
initial_delay_seconds
=
startup_probe
.
value
[
"initial_delay_seconds"
]
timeout_seconds
=
startup_probe
.
value
[
"timeout_seconds"
]
period_seconds
=
startup_probe
.
value
[
"period_seconds"
]
failure_threshold
=
startup_probe
.
value
[
"failure_threshold"
]
dynamic
"tcp_socket"
{
# Check if tcp_socket has been defined in the startup_probe variable
for_each
=
contains
(
keys
(
startup_probe
.
value
),
"tcp_socket"
)
?
[
startup_probe
.
value
[
"tcp_socket"
]]
:
[]
content
{
port
=
tcp_socket
.
value
[
"port"
]
}
}
dynamic
"http_get"
{
for_each
=
contains
(
keys
(
startup_probe
.
value
),
"http_get"
)
?
[
startup_probe
.
value
[
"http_get"
]]
:
[]
content
{
path
=
http_get
.
value
[
"path"
]
# port = http_get.value["port"]
# port only supported on latest version of Google Cloud Terraform module
dynamic
"http_headers"
{
for_each
=
contains
(
keys
(
http_get
.
value
),
"http_headers"
)
?
http_get
.
value
[
"http_headers"
]
:
[]
content
{
name
=
http_headers
.
value
[
"name"
]
value
=
http_headers
.
value
[
"value"
]
}
}
}
}
dynamic
"grpc"
{
for_each
=
contains
(
keys
(
startup_probe
.
value
),
"grpc"
)
?
[
startup_probe
.
value
[
"grpc"
]]
:
[]
content
{
port
=
grpc
.
value
[
"port"
]
service
=
grpc
.
value
[
"service"
]
}
}
}
}
resources
{
limits
=
{
cpu
=
var
.
cpu_limit
...
...
This diff is collapsed.
Click to expand it.
variables.tf
+
48
−
0
View file @
5e17b335
...
...
@@ -435,3 +435,51 @@ variable "image_name" {
error_message
=
"The image_name value must be a valid URL to a container image."
}
}
variable
"startup_probe"
{
type
=
object
({
initial_delay_seconds
=
optional
(
number
)
# Number of seconds after the container has started before
# the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value is 240.
timeout_seconds
=
optional
(
number
)
# Number of seconds after which the probe times out. Defaults
# to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than periodSeconds.
period_seconds
=
optional
(
number
)
# How often (in seconds) to perform the probe. Default to 10 seconds.
# Minimum value is 1. Maximum value is 240.
failure_threshold
=
optional
(
number
)
# Minimum consecutive failures for the probe to be considered
# failed after having succeeded. Defaults to 3. Minimum value is 1.
tcp_socket
=
optional
(
object
({
port
=
optional
(
number
)
# (Optional) Port number to access on the container. Number must be in the
# range 1 to 65535. If not specified, defaults to the same value as container.ports[0].containerPort.
}))
# (Optional) TcpSocket specifies an action involving a TCP port. Structure is documented below.
http_get
=
optional
(
object
({
path
=
optional
(
string
)
# (Optional) Path to access on the HTTP server. Defaults to /.
# port only supported on latest version of Google Cloud Terraform module
# port = optional(number) # (Optional) Port number to access on the container. Number must be in
# the range 1 to 65535. If not specified, defaults to the same value as container.ports[0].containerPort.
http_headers
=
optional
(
list
(
object
({
name
=
string
# (Optional) The header field name
value
=
optional
(
string
)
# (Optional) The header field value
})))
# (Optional) Custom headers to set in the request. HTTP allows repeated headers.
}))
# (Optional) HttpGet specifies the http request to perform. Structure is documented below.
grpc
=
optional
(
object
({
port
=
optional
(
number
)
# (Optional) Port number to access on the container. Number must be in the
# range 1 to 65535. If not specified, defaults to the same value as container.ports[0].containerPort.
service
=
optional
(
string
)
# (Optional) The name of the service to place in the gRPC HealthCheckRequest
# (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
# If this is not specified, the default behavior is defined by gRPC.
}))
# (Optional) GRPC specifies an action involving a GRPC port. Structure is documented below.
})
default
=
{}
description
=
<<-
EOL
Optional
.
Startup
probe
of
application
within
the
container
.
All
other
probes
are
disabled
if
a
startup
probe
is
provided
,
until
it
succeeds
.
Container
will
not
be
added
to
service
endpoints
if
the
probe
fails
.
Structure
is
documented
at
https
:
//registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service#nested_startup_probe
EOL
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment