github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/circonus/resource_circonus_check_cloudwatch_test.go (about)

     1  package circonus
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccCirconusCheckCloudWatch_basic(t *testing.T) {
    12  	checkName := fmt.Sprintf("Terraform test: RDS Metrics via CloudWatch - %s", acctest.RandString(5))
    13  
    14  	resource.Test(t, resource.TestCase{
    15  		PreCheck:     func() { testAccPreCheck(t) },
    16  		Providers:    testAccProviders,
    17  		CheckDestroy: testAccCheckDestroyCirconusCheckBundle,
    18  		Steps: []resource.TestStep{
    19  			{
    20  				Config: fmt.Sprintf(testAccCirconusCheckCloudWatchConfigFmt, checkName),
    21  				Check: resource.ComposeTestCheckFunc(
    22  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "active", "true"),
    23  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "collector.#", "1"),
    24  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "collector.2388330941.id", "/broker/1"),
    25  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.#", "1"),
    26  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.dimmensions.%", "1"),
    27  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.dimmensions.DBInstanceIdentifier", "atlas-production"),
    28  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.#", "17"),
    29  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.990896688", "CPUUtilization"),
    30  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.3895259375", "DatabaseConnections"),
    31  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.1328149445", "DiskQueueDepth"),
    32  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.4218650584", "FreeStorageSpace"),
    33  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.1835248983", "FreeableMemory"),
    34  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.2757008135", "MaximumUsedTransactionIDs"),
    35  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.915415866", "NetworkReceiveThroughput"),
    36  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.1852047735", "NetworkTransmitThroughput"),
    37  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.3518416306", "ReadIOPS"),
    38  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.114013313", "ReadLatency"),
    39  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.1284099341", "ReadThroughput"),
    40  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.4205329773", "SwapUsage"),
    41  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.3550163941", "TransactionLogsDiskUsage"),
    42  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.2231806695", "TransactionLogsGeneration"),
    43  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.335777904", "WriteIOPS"),
    44  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.3894876280", "WriteLatency"),
    45  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.metric.1569904650", "WriteThroughput"),
    46  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.namespace", "AWS/RDS"),
    47  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.version", "2010-08-01"),
    48  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "cloudwatch.88938937.url", "https://monitoring.us-east-1.amazonaws.com"),
    49  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "name", checkName),
    50  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "notes", "Collect all the things exposed"),
    51  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "period", "60s"),
    52  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.#", "17"),
    53  
    54  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.active", "true"),
    55  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.name", "ReadLatency"),
    56  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.tags.#", "4"),
    57  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.tags.1313458811", "app:rds"),
    58  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.tags.1401442048", "lifecycle:unittest"),
    59  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.tags.2964981562", "app:postgresql"),
    60  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.tags.4259413593", "source:cloudwatch"),
    61  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.type", "numeric"),
    62  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3038868367.unit", "seconds"),
    63  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.active", "true"),
    64  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.name", "TransactionLogsGeneration"),
    65  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.tags.#", "4"),
    66  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.tags.1313458811", "app:rds"),
    67  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.tags.1401442048", "lifecycle:unittest"),
    68  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.tags.2964981562", "app:postgresql"),
    69  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.tags.4259413593", "source:cloudwatch"),
    70  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.type", "numeric"),
    71  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3699049608.unit", ""),
    72  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.active", "true"),
    73  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.name", "WriteIOPS"),
    74  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.tags.#", "4"),
    75  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.tags.1313458811", "app:rds"),
    76  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.tags.1401442048", "lifecycle:unittest"),
    77  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.tags.2964981562", "app:postgresql"),
    78  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.tags.4259413593", "source:cloudwatch"),
    79  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.type", "numeric"),
    80  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3932256294.unit", "iops"),
    81  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.active", "true"),
    82  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.name", "FreeStorageSpace"),
    83  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.tags.#", "4"),
    84  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.tags.1313458811", "app:rds"),
    85  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.tags.1401442048", "lifecycle:unittest"),
    86  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.tags.2964981562", "app:postgresql"),
    87  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.tags.4259413593", "source:cloudwatch"),
    88  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.type", "numeric"),
    89  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3655789574.unit", ""),
    90  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.active", "true"),
    91  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.name", "WriteLatency"),
    92  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.tags.#", "4"),
    93  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.tags.1313458811", "app:rds"),
    94  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.tags.1401442048", "lifecycle:unittest"),
    95  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.tags.2964981562", "app:postgresql"),
    96  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.tags.4259413593", "source:cloudwatch"),
    97  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.type", "numeric"),
    98  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3129782198.unit", "seconds"),
    99  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.active", "true"),
   100  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.name", "DatabaseConnections"),
   101  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.tags.#", "4"),
   102  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.tags.1313458811", "app:rds"),
   103  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.tags.1401442048", "lifecycle:unittest"),
   104  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.tags.2964981562", "app:postgresql"),
   105  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.tags.4259413593", "source:cloudwatch"),
   106  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.type", "numeric"),
   107  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4177148265.unit", "connections"),
   108  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.active", "true"),
   109  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.name", "FreeableMemory"),
   110  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.tags.#", "4"),
   111  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.tags.1313458811", "app:rds"),
   112  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.tags.1401442048", "lifecycle:unittest"),
   113  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.tags.2964981562", "app:postgresql"),
   114  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.tags.4259413593", "source:cloudwatch"),
   115  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.type", "numeric"),
   116  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2882920904.unit", "bytes"),
   117  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.active", "true"),
   118  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.name", "MaximumUsedTransactionIDs"),
   119  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.tags.#", "4"),
   120  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.tags.1313458811", "app:rds"),
   121  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.tags.1401442048", "lifecycle:unittest"),
   122  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.tags.2964981562", "app:postgresql"),
   123  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.tags.4259413593", "source:cloudwatch"),
   124  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.type", "numeric"),
   125  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3449506.unit", ""),
   126  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.active", "true"),
   127  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.name", "ReadThroughput"),
   128  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.tags.#", "4"),
   129  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.tags.1313458811", "app:rds"),
   130  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.tags.1401442048", "lifecycle:unittest"),
   131  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.tags.2964981562", "app:postgresql"),
   132  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.tags.4259413593", "source:cloudwatch"),
   133  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.type", "numeric"),
   134  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3907804414.unit", "bytes"),
   135  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.active", "true"),
   136  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.name", "ReadIOPS"),
   137  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.tags.#", "4"),
   138  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.tags.1313458811", "app:rds"),
   139  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.tags.1401442048", "lifecycle:unittest"),
   140  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.tags.2964981562", "app:postgresql"),
   141  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.tags.4259413593", "source:cloudwatch"),
   142  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.type", "numeric"),
   143  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2040713199.unit", "iops"),
   144  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.active", "true"),
   145  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.name", "NetworkReceiveThroughput"),
   146  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.tags.#", "4"),
   147  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.tags.1313458811", "app:rds"),
   148  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.tags.1401442048", "lifecycle:unittest"),
   149  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.tags.2964981562", "app:postgresql"),
   150  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.tags.4259413593", "source:cloudwatch"),
   151  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.type", "numeric"),
   152  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4227693369.unit", "bytes"),
   153  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.active", "true"),
   154  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.name", "TransactionLogsDiskUsage"),
   155  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.tags.#", "4"),
   156  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.tags.1313458811", "app:rds"),
   157  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.tags.1401442048", "lifecycle:unittest"),
   158  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.tags.2964981562", "app:postgresql"),
   159  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.tags.4259413593", "source:cloudwatch"),
   160  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.type", "numeric"),
   161  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2478479732.unit", "bytes"),
   162  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.active", "true"),
   163  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.name", "CPUUtilization"),
   164  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.tags.#", "4"),
   165  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.tags.1313458811", "app:rds"),
   166  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.tags.1401442048", "lifecycle:unittest"),
   167  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.tags.2964981562", "app:postgresql"),
   168  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.tags.4259413593", "source:cloudwatch"),
   169  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.type", "numeric"),
   170  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3437310515.unit", "%"),
   171  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.active", "true"),
   172  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.name", "SwapUsage"),
   173  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.tags.#", "4"),
   174  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.tags.1313458811", "app:rds"),
   175  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.tags.1401442048", "lifecycle:unittest"),
   176  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.tags.2964981562", "app:postgresql"),
   177  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.tags.4259413593", "source:cloudwatch"),
   178  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.type", "numeric"),
   179  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3884263074.unit", "bytes"),
   180  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.active", "true"),
   181  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.name", "NetworkTransmitThroughput"),
   182  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.tags.#", "4"),
   183  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.tags.1313458811", "app:rds"),
   184  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.tags.1401442048", "lifecycle:unittest"),
   185  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.tags.2964981562", "app:postgresql"),
   186  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.tags.4259413593", "source:cloudwatch"),
   187  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.type", "numeric"),
   188  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.2675539305.unit", "bytes"),
   189  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.active", "true"),
   190  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.name", "DiskQueueDepth"),
   191  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.tags.#", "4"),
   192  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.tags.1313458811", "app:rds"),
   193  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.tags.1401442048", "lifecycle:unittest"),
   194  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.tags.2964981562", "app:postgresql"),
   195  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.tags.4259413593", "source:cloudwatch"),
   196  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.type", "numeric"),
   197  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.4273610941.unit", ""),
   198  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.active", "true"),
   199  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.name", "WriteThroughput"),
   200  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.tags.#", "4"),
   201  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.tags.1313458811", "app:rds"),
   202  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.tags.1401442048", "lifecycle:unittest"),
   203  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.tags.2964981562", "app:postgresql"),
   204  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.tags.4259413593", "source:cloudwatch"),
   205  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.type", "numeric"),
   206  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "metric.3085334826.unit", "bytes"),
   207  
   208  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "tags.#", "4"),
   209  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "tags.2964981562", "app:postgresql"),
   210  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "tags.1313458811", "app:rds"),
   211  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "tags.1401442048", "lifecycle:unittest"),
   212  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "tags.4259413593", "source:cloudwatch"),
   213  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "target", "atlas-production.us-east-1.rds._aws"),
   214  					resource.TestCheckResourceAttr("circonus_check.rds_metrics", "type", "cloudwatch"),
   215  				),
   216  			},
   217  		},
   218  	})
   219  }
   220  
   221  const testAccCirconusCheckCloudWatchConfigFmt = `
   222  variable "cloudwatch_rds_tags" {
   223    type = "list"
   224    default = [
   225      "app:postgresql",
   226      "app:rds",
   227      "lifecycle:unittest",
   228      "source:cloudwatch",
   229    ]
   230  }
   231  
   232  resource "circonus_check" "rds_metrics" {
   233    active = true
   234    name = "%s"
   235    notes = "Collect all the things exposed"
   236    period = "60s"
   237  
   238    collector {
   239      id = "/broker/1"
   240    }
   241  
   242    cloudwatch {
   243      dimmensions = {
   244        DBInstanceIdentifier = "atlas-production",
   245      }
   246  
   247      metric = [
   248        "CPUUtilization",
   249        "DatabaseConnections",
   250        "DiskQueueDepth",
   251        "FreeStorageSpace",
   252        "FreeableMemory",
   253        "MaximumUsedTransactionIDs",
   254        "NetworkReceiveThroughput",
   255        "NetworkTransmitThroughput",
   256        "ReadIOPS",
   257        "ReadLatency",
   258        "ReadThroughput",
   259        "SwapUsage",
   260        "TransactionLogsDiskUsage",
   261        "TransactionLogsGeneration",
   262        "WriteIOPS",
   263        "WriteLatency",
   264        "WriteThroughput",
   265      ]
   266  
   267      namespace = "AWS/RDS"
   268      url = "https://monitoring.us-east-1.amazonaws.com"
   269    }
   270  
   271    metric {
   272      name = "CPUUtilization"
   273      tags = [ "${var.cloudwatch_rds_tags}" ]
   274      type = "numeric"
   275      unit = "%%"
   276    }
   277  
   278    metric {
   279      name = "DatabaseConnections"
   280      tags = [ "${var.cloudwatch_rds_tags}" ]
   281      type = "numeric"
   282      unit = "connections"
   283    }
   284  
   285    metric {
   286      name = "DiskQueueDepth"
   287      tags = [ "${var.cloudwatch_rds_tags}" ]
   288      type = "numeric"
   289    }
   290  
   291    metric {
   292      name = "FreeStorageSpace"
   293      tags = [ "${var.cloudwatch_rds_tags}" ]
   294      type = "numeric"
   295    }
   296  
   297    metric {
   298      name = "FreeableMemory"
   299      tags = [ "${var.cloudwatch_rds_tags}" ]
   300      type = "numeric"
   301      unit = "bytes"
   302    }
   303  
   304    metric {
   305      name = "MaximumUsedTransactionIDs"
   306      tags = [ "${var.cloudwatch_rds_tags}" ]
   307      type = "numeric"
   308    }
   309  
   310    metric {
   311      name = "NetworkReceiveThroughput"
   312      tags = [ "${var.cloudwatch_rds_tags}" ]
   313      type = "numeric"
   314      unit = "bytes"
   315    }
   316  
   317    metric {
   318      name = "NetworkTransmitThroughput"
   319      tags = [ "${var.cloudwatch_rds_tags}" ]
   320      type = "numeric"
   321      unit = "bytes"
   322    }
   323  
   324    metric {
   325      name = "ReadIOPS"
   326      tags = [ "${var.cloudwatch_rds_tags}" ]
   327      type = "numeric"
   328      unit = "iops"
   329    }
   330  
   331    metric {
   332      name = "ReadLatency"
   333      tags = [ "${var.cloudwatch_rds_tags}" ]
   334      type = "numeric"
   335      unit = "seconds"
   336    }
   337  
   338    metric {
   339      name = "ReadThroughput"
   340      tags = [ "${var.cloudwatch_rds_tags}" ]
   341      type = "numeric"
   342      unit = "bytes"
   343    }
   344  
   345    metric {
   346      name = "SwapUsage"
   347      tags = [ "${var.cloudwatch_rds_tags}" ]
   348      type = "numeric"
   349      unit = "bytes"
   350    }
   351  
   352    metric {
   353      name = "TransactionLogsDiskUsage"
   354      tags = [ "${var.cloudwatch_rds_tags}" ]
   355      type = "numeric"
   356      unit = "bytes"
   357    }
   358  
   359    metric {
   360      name = "TransactionLogsGeneration"
   361      tags = [ "${var.cloudwatch_rds_tags}" ]
   362      type = "numeric"
   363    }
   364  
   365    metric {
   366      name = "WriteIOPS"
   367      tags = [ "${var.cloudwatch_rds_tags}" ]
   368      type = "numeric"
   369      unit = "iops"
   370    }
   371  
   372    metric {
   373      name = "WriteLatency"
   374      tags = [ "${var.cloudwatch_rds_tags}" ]
   375      type = "numeric"
   376      unit = "seconds"
   377    }
   378  
   379    metric {
   380      name = "WriteThroughput"
   381      tags = [ "${var.cloudwatch_rds_tags}" ]
   382      type = "numeric"
   383      unit = "bytes"
   384    }
   385  
   386    tags = [ "${var.cloudwatch_rds_tags}" ]
   387  }
   388  `