ojongerius / terraform-provider-datadog

A Terraform plugin to manage Datadog resources.
Mozilla Public License 2.0
29 stars 6 forks source link

Terraform plan shows many changes #38

Closed ojongerius closed 8 years ago

ojongerius commented 8 years ago

Example running planning mode 2 add 2 resources shows the intention to change 33 resources, which is the sum of the existing checks:

The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

+ datadog_metric_alert.elb_unhealthy
<SNIP>
+ datadog_outlier_alert.load
<SNIP>
Plan: 2 to add, 33 to change, 0 to destroy.
ojongerius commented 8 years ago

Initial guess; the lack of Read resources.

ojongerius commented 8 years ago

Random snippets for reference during work

Example metric alert

In [23]: api.Monitor.get('287409')
Out[23]:
{'created_at': 1443599260000,
 'id': 287409,
 'message': 'Alert on percent of memory being used by ActiveMQ on Bamboo Server {{service_name.name}} @hipchat-Build_Engineering_Alerts',
 'multi': True,
 'name': '[warning] TF: Bamboo ActiveMQ Memory Percent Usage',
 'options': {'escalation_message': u'',
  'no_data_timeframe': 0,
  'notify_audit': False,
  'notify_no_data': True,
  'period': 0,
  'renotify_interval': 0,
  'silenced': {},
  'thresholds': {'critical': 0, 'ok': 0, 'warning': 0},
  'timeout_h': 0},
 'org_id': 27014,
 'overall_state': 'OK',
 'query': 'min(last_15m):avg:bamboo.server.broker.bamboo.MemoryPercentUsage{*} by {service_name} > 80',
 'tags': [],
 'type': 'metric alert'}

Example state

       "attributes": {
        "critical.#": "2",
        "critical.notify": "@hipchat-Build_Engineering_Alerts",
        "critical.threshold": "90",
        "id": "287409__287417",
        "keys.#": "1",
        "keys.0": "service_name",
        "message": "Alert on percent of memory being used by ActiveMQ on Bamboo Server {{service_name.name}}",
        "metric": "bamboo.server.broker.bamboo.MemoryPercentUsage",
        "name": "TF: Bamboo ActiveMQ Memory Percent Usage",
        "notify_no_data": "true",
        "operator": "\u003e",
        "space_aggr": "avg",
        "tags.#": "1",
        "tags.0": "*",
        "time_aggr": "min",
        "time_window": "last_15m",
        "warning.#": "2",
        "warning.notify": "@hipchat-Build_Engineering_Alerts",
        "warning.threshold": "80"

API structs

    type Monitor struct {
    Id      int     `json:"id"`
    Type    string  `json:"type"`
    Query   string  `json:"query"`
    Name    string  `json:"name"`
    Message string  `json:"message"`
    Options Options `json:"options"`

    type Options struct {
    NoDataTimeframe   int               `json:"no_data_timeframe"`
    NotifyAudit       bool              `json:"notify_audit"`
    NotifyNoData      bool              `json:"notify_no_data"`
    Period            int               `json:"period"`
    RenotifyInterval  int               `json:"renotify_interval"`
    Silenced          map[string]string `json:"silenced"`
    TimeoutH          int               `json:"timeout_h"`
    EscalationMessage string            `json:"escalation_message"`
    Thresholds        ThresholdCount    `json:"thresholds"`
ojongerius commented 8 years ago

No longer an issue.