-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(fastly_alert): implement resource and documentation #810
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7bea591
feat(fastly_alerts): implement resource and documentation
darin-nee 798617c
feat(fastly_alerts): fix docs
darin-nee 5306e92
feat(fastly_alert): align descriptions with API docs, add to interfac…
darin-nee 0121082
feat(fastly_alert): remove from tests/interface since fastly_alert un…
darin-nee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
layout: "fastly" | ||
page_title: "Fastly: alert" | ||
sidebar_current: "docs-fastly-resource-alert" | ||
description: |- | ||
Provides a Fastly Alert. Alerts send notifications to custom integrations (e.g., Slack channels, PagerDuty, Microsoft Teams and New Relic) when an observed metric either exceeds or falls below a threshold. | ||
--- | ||
|
||
# fastly_alert | ||
|
||
Provides a Fastly Alert. Alerts send notifications to custom integrations (e.g., Slack channels, PagerDuty, Microsoft Teams and New Relic) when an observed metric either exceeds or falls below a threshold. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "fastly_service_vcl" "example" { | ||
name = "my_vcl_service" | ||
# ... | ||
} | ||
|
||
resource "fastly_alert" "example" { | ||
name = "my_vcl_service errors" | ||
service_id = fastly_service_vcl.example.id | ||
source = "stats" | ||
metric = "status_5xx" | ||
|
||
evaluation_strategy { | ||
type = "above_threshold" | ||
period = "5m" | ||
threshold = 10 | ||
} | ||
} | ||
``` | ||
|
||
## Import | ||
|
||
Fastly Alerts can be imported using their ID, e.g. | ||
|
||
```sh | ||
$ terraform import fastly_alert.example xxxxxxxxxxxxxxxxxxxx | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `evaluation_strategy` (Block List, Min: 1, Max: 1) Criteria on how to alert. (see [below for nested schema](#nestedblock--evaluation_strategy)) | ||
- `metric` (String) The metric name to alert on for a specific source: [domains](https://developer.fastly.com/reference/api/metrics-stats/domain-inspector/historical), [origins](https://developer.fastly.com/reference/api/metrics-stats/origin-inspector/historical), or [stats](https://developer.fastly.com/reference/api/metrics-stats/historical-stats). | ||
- `name` (String) The name of the alert. | ||
- `service_id` (String) The service which the alert monitors. | ||
- `source` (String) The source where the metric comes from. One of: `domains`, `origins`, `stats`. | ||
|
||
### Optional | ||
|
||
- `description` (String) Additional text that is included in the alert notification. | ||
- `dimensions` (Block List, Max: 1) More filters depending on the source type. (see [below for nested schema](#nestedblock--dimensions)) | ||
- `integration_ids` (Set of String) List of integrations used to notify when alert fires. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--evaluation_strategy"></a> | ||
### Nested Schema for `evaluation_strategy` | ||
|
||
Required: | ||
|
||
- `period` (String) The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: `5m`, `15m`, `30m`. | ||
- `threshold` (Number) Threshold used to alert. | ||
- `type` (String) Type of strategy to use to evaluate. One of: `above_threshold`, `below_threshold`. | ||
|
||
|
||
<a id="nestedblock--dimensions"></a> | ||
### Nested Schema for `dimensions` | ||
|
||
Optional: | ||
|
||
- `domains` (Set of String) Names of a subset of domains that the alert monitors. | ||
- `origins` (Set of String) Addresses of a subset of backends that the alert monitors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "fastly_service_vcl" "example" { | ||
name = "my_vcl_service" | ||
# ... | ||
} | ||
|
||
resource "fastly_alert" "example" { | ||
name = "my_vcl_service errors" | ||
service_id = fastly_service_vcl.example.id | ||
source = "stats" | ||
metric = "status_5xx" | ||
|
||
evaluation_strategy { | ||
type = "above_threshold" | ||
period = "5m" | ||
threshold = 10 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$ terraform import fastly_alert.example xxxxxxxxxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darin-nee There is also
object
= "definition" that is returned in the response, also read-onlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's in the API response and elided in the Terraform schema.