Skip to content

Commit 62b34e5

Browse files
authored
feat: prettier in READMEs (cloudposse/terraform-aws-components#998)
1 parent 62d7d47 commit 62b34e5

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

src/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The following inputs were removed because they no longer have any effect:
1111
- role_paths
1212
- secrets_store_type
1313

14-
Except for `monitors_roles_map` and `role_paths`, these inputs were deprecated
15-
in an earlier PR, and replaced with outputs from `datadog-configuration`.
14+
Except for `monitors_roles_map` and `role_paths`, these inputs were deprecated in an earlier PR, and replaced with
15+
outputs from `datadog-configuration`.
1616

1717
The implementation of `monitors_roles_map` and `role_paths` has been lost.

src/README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ components:
2424
```
2525
2626
## Conventions
27-
- Treat datadog like a separate cloud provider with integrations ([datadog-integration](https://docs.cloudposse.com/components/library/aws/datadog-integration)) into your accounts.
27+
28+
- Treat datadog like a separate cloud provider with integrations
29+
([datadog-integration](https://docs.cloudposse.com/components/library/aws/datadog-integration)) into your accounts.
2830
2931
- Use the `catalog` convention to define a step of alerts. You can use ours or define your own.
3032
[https://github.com/cloudposse/terraform-datadog-platform/tree/master/catalog/monitors](https://github.com/cloudposse/terraform-datadog-platform/tree/master/catalog/monitors)
3133

3234
## Adjust Thresholds per Stack
3335

34-
Since there are so many parameters that may be adjusted for a given monitor, we define all monitors through YAML. By convention, we define the **default monitors** that should apply to all environments, and then adjust the thresholds per environment. This is accomplished using the `datadog-monitor` components variable `datadog_monitors_config_paths` which defines the path to the YAML configuration files. By passing a path for `dev` and `prod`, we can define configurations that are different per environment.
36+
Since there are so many parameters that may be adjusted for a given monitor, we define all monitors through YAML. By
37+
convention, we define the **default monitors** that should apply to all environments, and then adjust the thresholds per
38+
environment. This is accomplished using the `datadog-monitor` components variable `datadog_monitors_config_paths` which
39+
defines the path to the YAML configuration files. By passing a path for `dev` and `prod`, we can define configurations
40+
that are different per environment.
3541

3642
For example, you might have the following settings defined for `prod` and `dev` stacks that override the defaults.
3743

@@ -47,6 +53,7 @@ components:
4753
- catalog/monitors/*.yaml
4854
- catalog/monitors/dev/*.yaml # note this line
4955
```
56+
5057
For `prod` stack:
5158

5259
```
@@ -60,7 +67,8 @@ components:
6067
- catalog/monitors/prod/*.yaml # note this line
6168
```
6269

63-
Behind the scenes (with `atmos`) we fetch all files from these glob patterns, template them, and merge them by key. If we peek into the `*.yaml` and `dev/*.yaml` files above you could see an example like this:
70+
Behind the scenes (with `atmos`) we fetch all files from these glob patterns, template them, and merge them by key. If
71+
we peek into the `*.yaml` and `dev/*.yaml` files above you could see an example like this:
6472

6573
**components/terraform/datadog-monitor/catalog/monitors/elb.yaml**
6674

@@ -105,6 +113,7 @@ elb-lb-httpcode-5xx-notify:
105113
critical: 50
106114
warning: 20
107115
```
116+
108117
**components/terraform/datadog-monitor/catalog/monitors/dev/elb.yaml**
109118
110119
```
@@ -120,10 +129,16 @@ elb-lb-httpcode-5xx-notify:
120129
## Key Notes
121130
122131
### Inheritance
123-
The important thing to note here is that the default yaml is applied to every stage that it's deployed to. For dev specifically however, we want to override the thresholds and priority for this monitor. This merging is done by key of the monitor, in this case `elb-lb-httpcode-5xx-notify`.
132+
133+
The important thing to note here is that the default yaml is applied to every stage that it's deployed to. For dev
134+
specifically however, we want to override the thresholds and priority for this monitor. This merging is done by key of
135+
the monitor, in this case `elb-lb-httpcode-5xx-notify`.
124136
125137
### Templating
126-
The second thing to note is `${ dd_env }`. This is **terraform** templating in action. While double braces (`{{ env }}`) refers to datadog templating, `${ dd_env }` is a template variable we pass into our monitors. in this example we use it to specify a grouping int he message. This value is passed in and can be overridden via stacks.
138+
139+
The second thing to note is `${ dd_env }`. This is **terraform** templating in action. While double braces (`{{ env }}`)
140+
refers to datadog templating, `${ dd_env }` is a template variable we pass into our monitors. in this example we use it
141+
to specify a grouping int he message. This value is passed in and can be overridden via stacks.
127142
128143
We pass a value via:
129144
@@ -140,6 +155,7 @@ components:
140155
datadog_monitors_config_parameters:
141156
dd_env: "dev"
142157
```
158+
143159
This allows us to further use inheritance from stack configuration to keep our monitors dry, but configurable.
144160
145161
Another available option is to use our catalog as base monitors and then override them with your specific fine tuning.
@@ -156,10 +172,14 @@ components:
156172
157173
## Other Gotchas
158174
159-
Our integration action that checks for `'source_type_name' equals 'Monitor Alert'` will also be true for synthetics. Whereas if we check for `'event_type' equals 'query_alert_monitor'`, that's only true for monitors, because synthetics will only be picked up by an integration action when `event_type` is `synthetics_alert`.
175+
Our integration action that checks for `'source_type_name' equals 'Monitor Alert'` will also be true for synthetics.
176+
Whereas if we check for `'event_type' equals 'query_alert_monitor'`, that's only true for monitors, because synthetics
177+
will only be picked up by an integration action when `event_type` is `synthetics_alert`.
160178
161-
This is important if we need to distinguish between monitors and synthetics in OpsGenie, which is the case when we want to ensure clean messaging on OpsGenie incidents in Statuspage.
179+
This is important if we need to distinguish between monitors and synthetics in OpsGenie, which is the case when we want
180+
to ensure clean messaging on OpsGenie incidents in Statuspage.
162181
182+
<!-- prettier-ignore-start -->
163183
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
164184
## Requirements
165185
@@ -230,7 +250,7 @@ No resources.
230250
|------|-------------|
231251
| <a name="output_datadog_monitor_names"></a> [datadog\_monitor\_names](#output\_datadog\_monitor\_names) | Names of the created Datadog monitors |
232252
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
233-
253+
<!-- prettier-ignore-end -->
234254
235255
## Related How-to Guides
236256
@@ -240,10 +260,12 @@ No resources.
240260
- [How to Implement SRE with Datadog](https://docs.cloudposse.com/reference-architecture/how-to-guides/tutorials/how-to-implement-sre-with-datadog)
241261
242262
## Component Dependencies
263+
243264
- [datadog-integration](https://docs.cloudposse.com/components/library/aws/datadog-integration/)
244265
245266
## References
246-
* [cloudposse/terraform-aws-components](https://github.com/cloudposse/terraform-aws-components/tree/main/modules/datadog-monitor) - Cloud Posse's upstream component
247267
268+
- [cloudposse/terraform-aws-components](https://github.com/cloudposse/terraform-aws-components/tree/main/modules/datadog-monitor) -
269+
Cloud Posse's upstream component
248270
249271
[<img src="https://cloudposse.com/logo-300x69.svg" height="32" align="right"/>](https://cpco.io/component)

0 commit comments

Comments
 (0)