FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GCP Scheduled Script
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
Show more breadcrumbs
Information Services
DevOps
Infrastructure
Terraform Modules
GCP Scheduled Script
Commits
af567ecf
Commit
af567ecf
authored
3 years ago
by
Monty Dawson
Browse files
Options
Downloads
Patches
Plain Diff
Allow alert name and documentation to be customised
parent
f2365745
No related branches found
No related tags found
No related merge requests found
Pipeline
#71463
passed
3 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG
+2
-1
2 additions, 1 deletion
CHANGELOG
main.tf
+10
-2
10 additions, 2 deletions
main.tf
variables.tf
+17
-0
17 additions, 0 deletions
variables.tf
with
29 additions
and
3 deletions
CHANGELOG
+
2
−
1
View file @
af567ecf
...
...
@@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.1] - 2021-0
3-3
1
## [1.0.1] - 2021-0
4-0
1
### Added
- Allow environment variables to be passed in through variables
- Allow alert name and documentation to be customized
## [1.0.0] - 2021-03-16
### Added
...
...
This diff is collapsed.
Click to expand it.
main.tf
+
10
−
2
View file @
af567ecf
...
...
@@ -16,6 +16,10 @@ locals {
# A kebab-case name in case we're given underscore_case.
kebab_name
=
replace
(
var
.
name
,
"_"
,
"-"
)
alert_display_name
=
var
.
alert_display_name
!=
""
?
var
.
alert_display_name
:
(
"Invocations of
${
var
.
name
}
script succeeds (
${terraform
.
workspace
}
)"
)
}
# The source code of the script.
...
...
@@ -193,7 +197,7 @@ resource "google_logging_metric" "successes" {
resource
"google_monitoring_alert_policy"
"successes"
{
project
=
local
.
monitoring_project
display_name
=
"Invocations of
${
var
.
name
}
script succeeds (
${terraform
.
workspace
}
)"
display_name
=
local
.
alert_display_name
enabled
=
var
.
alert_enabled
...
...
@@ -204,9 +208,13 @@ resource "google_monitoring_alert_policy" "successes" {
combiner
=
"OR"
documentation
{
content
=
var
.
alert_documentation
}
conditions
{
# Include the workspace name in the alert text to aid triaging alerts.
display_name
=
"Invocations of
${
var
.
name
}
script succeeds (
${terraform
.
workspace
}
)"
display_name
=
local
.
alert_display_name
condition_threshold
{
# We're interested in Cloud Scheduler successes for the job in the
...
...
This diff is collapsed.
Click to expand it.
variables.tf
+
17
−
0
View file @
af567ecf
...
...
@@ -119,6 +119,23 @@ variable "alert_enabled" {
EOT
}
variable
"alert_display_name"
{
default
=
""
description
=
<<-
EOT
The
display
name
for
the
alert
that
is
fired
if
this
script
fails
-
this
is
used
in
the
header
of
the
email
if
the
script
fails
and
this
alert
is
triggered
.
A
sensible
default
is
used
if
no
value
is
given
.
EOT
}
variable
"alert_documentation"
{
default
=
""
description
=
<<-
EOT
The
documentation
that
is
included
in
the
email
sent
if
this
script
fails
.
This
should
describe
what
can
be
done
to
stop
the
script
from
failing
.
EOT
}
variable
"secret_configuration"
{
default
=
""
description
=
<<-
EOT
...
...
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