|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "grafana_cloud_provider_aws_cloudwatch_scrape_job Data Source - terraform-provider-grafana" |
| 4 | +subcategory: "Cloud Provider" |
| 5 | +description: |- |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +# grafana_cloud_provider_aws_cloudwatch_scrape_job (Data Source) |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +data "grafana_cloud_stack" "test" { |
| 17 | + slug = "gcloudstacktest" |
| 18 | +} |
| 19 | +
|
| 20 | +data "aws_iam_role" "test" { |
| 21 | + name = "my-role" |
| 22 | +} |
| 23 | +
|
| 24 | +resource "grafana_cloud_provider_aws_account" "test" { |
| 25 | + stack_id = data.grafana_cloud_stack.test.id |
| 26 | + role_arn = data.aws_iam_role.test.arn |
| 27 | + regions = [ |
| 28 | + "us-east-1", |
| 29 | + "us-east-2", |
| 30 | + "us-west-1" |
| 31 | + ] |
| 32 | +} |
| 33 | +
|
| 34 | +
|
| 35 | +resource "grafana_cloud_provider_aws_cloudwatch_scrape_job" "test" { |
| 36 | + stack_id = data.grafana_cloud_stack.test.id |
| 37 | + name = "my-cloudwatch-scrape-job" |
| 38 | + aws_account_resource_id = grafana_cloud_provider_aws_account.test.resource_id |
| 39 | + export_tags = true |
| 40 | +
|
| 41 | + service { |
| 42 | + name = "AWS/EC2" |
| 43 | + metric { |
| 44 | + name = "CPUUtilization" |
| 45 | + statistics = ["Average"] |
| 46 | + } |
| 47 | + metric { |
| 48 | + name = "StatusCheckFailed" |
| 49 | + statistics = ["Maximum"] |
| 50 | + } |
| 51 | + scrape_interval_seconds = 300 |
| 52 | + resource_discovery_tag_filter { |
| 53 | + key = "k8s.io/cluster-autoscaler/enabled" |
| 54 | + value = "true" |
| 55 | + } |
| 56 | + tags_to_add_to_metrics = ["eks:cluster-name"] |
| 57 | + } |
| 58 | +
|
| 59 | + custom_namespace { |
| 60 | + name = "CoolApp" |
| 61 | + metric { |
| 62 | + name = "CoolMetric" |
| 63 | + statistics = ["Maximum", "Sum"] |
| 64 | + } |
| 65 | + scrape_interval_seconds = 300 |
| 66 | + } |
| 67 | +} |
| 68 | +
|
| 69 | +
|
| 70 | +data "grafana_cloud_provider_aws_cloudwatch_scrape_job" "test" { |
| 71 | + stack_id = data.grafana_cloud_stack.test.id |
| 72 | + name = grafana_cloud_provider_aws_cloudwatch_scrape_job.test.name |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +<!-- schema generated by tfplugindocs --> |
| 77 | +## Schema |
| 78 | + |
| 79 | +### Required |
| 80 | + |
| 81 | +- `name` (String) The name of the CloudWatch Scrape Job. Part of the Terraform Resource ID. |
| 82 | +- `stack_id` (String) The Stack ID of the Grafana Cloud instance. Part of the Terraform Resource ID. |
| 83 | + |
| 84 | +### Read-Only |
| 85 | + |
| 86 | +- `aws_account_resource_id` (String) The ID assigned by the Grafana Cloud Provider API to an AWS Account resource that should be associated with this CloudWatch Scrape Job. This can be provided by the `id` attribute of the `grafana_cloud_provider_aws_account` resource. |
| 87 | +- `custom_namespace` (Block List) Zero or more configuration blocks to configure custom namespaces for the CloudWatch Scrape Job to scrape. Each block must have a distinct `name` attribute. When accessing this as an attribute reference, it is a list of objects. (see [below for nested schema](#nestedblock--custom_namespace)) |
| 88 | +- `disabled_reason` (String) When the CloudWatch Scrape Job is disabled, this will show the reason that it is in that state. |
| 89 | +- `enabled` (Boolean) Whether the CloudWatch Scrape Job is enabled or not. |
| 90 | +- `export_tags` (Boolean) When enabled, AWS resource tags are exported as Prometheus labels to metrics formatted as `aws_<service_name>_info`. |
| 91 | +- `id` (String) The Terraform Resource ID. This has the format "{{ stack_id }}:{{ name }}". |
| 92 | +- `regions` (Set of String) The set of AWS region names that this CloudWatch Scrape Job is configured to scrape. |
| 93 | +- `regions_subset_override_used` (Boolean) When true, the `regions` attribute will be the set of regions configured in the override. When false, the `regions` attribute will be the set of regions belonging to the AWS Account resource that is associated with this CloudWatch Scrape Job. |
| 94 | +- `role_arn` (String) The AWS ARN of the IAM role associated with the AWS Account resource that is being used by this CloudWatch Scrape Job. |
| 95 | +- `service` (Block List) One or more configuration blocks to dictate what this CloudWatch Scrape Job should scrape. Each block must have a distinct `name` attribute. When accessing this as an attribute reference, it is a list of objects. (see [below for nested schema](#nestedblock--service)) |
| 96 | + |
| 97 | +<a id="nestedblock--custom_namespace"></a> |
| 98 | +### Nested Schema for `custom_namespace` |
| 99 | + |
| 100 | +Read-Only: |
| 101 | + |
| 102 | +- `metric` (Block List) One or more configuration blocks to configure metrics and their statistics to scrape. Each block must represent a distinct metric name. When accessing this as an attribute reference, it is a list of objects. (see [below for nested schema](#nestedblock--custom_namespace--metric)) |
| 103 | +- `name` (String) The name of the custom namespace to scrape. |
| 104 | +- `scrape_interval_seconds` (Number) The interval in seconds to scrape the custom namespace. |
| 105 | + |
| 106 | +<a id="nestedblock--custom_namespace--metric"></a> |
| 107 | +### Nested Schema for `custom_namespace.metric` |
| 108 | + |
| 109 | +Read-Only: |
| 110 | + |
| 111 | +- `name` (String) The name of the metric to scrape. |
| 112 | +- `statistics` (Set of String) A set of statistics to scrape. |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +<a id="nestedblock--service"></a> |
| 117 | +### Nested Schema for `service` |
| 118 | + |
| 119 | +Read-Only: |
| 120 | + |
| 121 | +- `metric` (Block List) One or more configuration blocks to configure metrics and their statistics to scrape. Each block must represent a distinct metric name. When accessing this as an attribute reference, it is a list of objects. (see [below for nested schema](#nestedblock--service--metric)) |
| 122 | +- `name` (String) The name of the service to scrape. See https://grafana.com/docs/grafana-cloud/monitor-infrastructure/aws/cloudwatch-metrics/services/ for supported services, metrics, and their statistics. |
| 123 | +- `resource_discovery_tag_filter` (Block List) One or more configuration blocks to configure tag filters applied to discovery of resource entities in the associated AWS account. When accessing this as an attribute reference, it is a list of objects. (see [below for nested schema](#nestedblock--service--resource_discovery_tag_filter)) |
| 124 | +- `scrape_interval_seconds` (Number) The interval in seconds to scrape the service. See https://grafana.com/docs/grafana-cloud/monitor-infrastructure/aws/cloudwatch-metrics/services/ for supported scrape intervals. |
| 125 | +- `tags_to_add_to_metrics` (Set of String) A set of tags to add to all metrics exported by this scrape job, for use in PromQL queries. |
| 126 | + |
| 127 | +<a id="nestedblock--service--metric"></a> |
| 128 | +### Nested Schema for `service.metric` |
| 129 | + |
| 130 | +Read-Only: |
| 131 | + |
| 132 | +- `name` (String) The name of the metric to scrape. |
| 133 | +- `statistics` (Set of String) A set of statistics to scrape. |
| 134 | + |
| 135 | + |
| 136 | +<a id="nestedblock--service--resource_discovery_tag_filter"></a> |
| 137 | +### Nested Schema for `service.resource_discovery_tag_filter` |
| 138 | + |
| 139 | +Read-Only: |
| 140 | + |
| 141 | +- `key` (String) The key of the tag filter. |
| 142 | +- `value` (String) The value of the tag filter. |
0 commit comments