UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

239 lines (238 loc) 10.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * This resource allows you to scrape AWS CloudWatch metrics in Grafana Cloud without needing to run your own infrastructure. * * See the Grafana Provider configuration docs * for information on authentication and required access policy scopes. * * * [Official Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/aws/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as grafana from "@pulumiverse/grafana"; * * const test = grafana.cloud.getStack({ * slug: "gcloudstacktest", * }); * const testIamRole = aws.index.IamRole({ * name: "my-role", * }); * const testAwsAccount = new grafana.cloudprovider.AwsAccount("test", { * stackId: test.then(test => test.id), * roleArn: testIamRole.arn, * regions: [ * "us-east-1", * "us-east-2", * "us-west-1", * ], * }); * const testAwsCloudwatchScrapeJob = new grafana.cloudprovider.AwsCloudwatchScrapeJob("test", { * stackId: test.then(test => test.id), * name: "my-cloudwatch-scrape-job", * awsAccountResourceId: testAwsAccount.resourceId, * exportTags: true, * services: [{ * name: "AWS/EC2", * metrics: [ * { * name: "CPUUtilization", * statistics: ["Average"], * }, * { * name: "StatusCheckFailed", * statistics: ["Maximum"], * }, * ], * scrapeIntervalSeconds: 300, * resourceDiscoveryTagFilters: [{ * key: "k8s.io/cluster-autoscaler/enabled", * value: "true", * }], * tagsToAddToMetrics: ["eks:cluster-name"], * }], * customNamespaces: [{ * name: "CoolApp", * metrics: [{ * name: "CoolMetric", * statistics: [ * "Maximum", * "Sum", * ], * }], * scrapeIntervalSeconds: 300, * }], * staticLabels: { * label1: "value1", * label2: "value2", * }, * }); * ``` * * ## Import * * ```sh * terraform import grafana_cloud_provider_aws_cloudwatch_scrape_job.name "{{ stack_id }}:{{ name }}" * ``` */ export declare class AwsCloudwatchScrapeJob extends pulumi.CustomResource { /** * Get an existing AwsCloudwatchScrapeJob resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AwsCloudwatchScrapeJobState, opts?: pulumi.CustomResourceOptions): AwsCloudwatchScrapeJob; /** * Returns true if the given object is an instance of AwsCloudwatchScrapeJob. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is AwsCloudwatchScrapeJob; /** * 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 `resourceId` attribute of the `grafana.cloudProvider.AwsAccount` resource. */ readonly awsAccountResourceId: pulumi.Output<string>; /** * Zero or more configuration blocks to configure custom namespaces for the AWS 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. */ readonly customNamespaces: pulumi.Output<outputs.cloudProvider.AwsCloudwatchScrapeJobCustomNamespace[] | undefined>; /** * When the AWS CloudWatch Scrape Job is disabled, this will show the reason that it is in that state. */ readonly disabledReason: pulumi.Output<string>; /** * Whether the AWS CloudWatch Scrape Job is enabled or not. Defaults to `true`. */ readonly enabled: pulumi.Output<boolean>; /** * When enabled, AWS resource tags are exported as Prometheus labels to metrics formatted as `aws_<service_name>_info`. Defaults to `true`. */ readonly exportTags: pulumi.Output<boolean>; /** * The name of the AWS CloudWatch Scrape Job. Part of the Terraform Resource ID. */ readonly name: pulumi.Output<string>; /** * A subset of the regions that are configured in the associated AWS Account resource to apply to this scrape job. If not set or empty, all of the Account resource's regions are scraped. */ readonly regionsSubsetOverrides: pulumi.Output<string[]>; /** * One or more configuration blocks to configure AWS services for the AWS 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. */ readonly services: pulumi.Output<outputs.cloudProvider.AwsCloudwatchScrapeJobService[] | undefined>; /** * The Stack ID of the Grafana Cloud instance. Part of the Terraform Resource ID. */ readonly stackId: pulumi.Output<string>; /** * A set of static labels to add to all metrics exported by this scrape job. */ readonly staticLabels: pulumi.Output<{ [key: string]: string; }>; /** * Create a AwsCloudwatchScrapeJob resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: AwsCloudwatchScrapeJobArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering AwsCloudwatchScrapeJob resources. */ export interface AwsCloudwatchScrapeJobState { /** * 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 `resourceId` attribute of the `grafana.cloudProvider.AwsAccount` resource. */ awsAccountResourceId?: pulumi.Input<string>; /** * Zero or more configuration blocks to configure custom namespaces for the AWS 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. */ customNamespaces?: pulumi.Input<pulumi.Input<inputs.cloudProvider.AwsCloudwatchScrapeJobCustomNamespace>[]>; /** * When the AWS CloudWatch Scrape Job is disabled, this will show the reason that it is in that state. */ disabledReason?: pulumi.Input<string>; /** * Whether the AWS CloudWatch Scrape Job is enabled or not. Defaults to `true`. */ enabled?: pulumi.Input<boolean>; /** * When enabled, AWS resource tags are exported as Prometheus labels to metrics formatted as `aws_<service_name>_info`. Defaults to `true`. */ exportTags?: pulumi.Input<boolean>; /** * The name of the AWS CloudWatch Scrape Job. Part of the Terraform Resource ID. */ name?: pulumi.Input<string>; /** * A subset of the regions that are configured in the associated AWS Account resource to apply to this scrape job. If not set or empty, all of the Account resource's regions are scraped. */ regionsSubsetOverrides?: pulumi.Input<pulumi.Input<string>[]>; /** * One or more configuration blocks to configure AWS services for the AWS 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. */ services?: pulumi.Input<pulumi.Input<inputs.cloudProvider.AwsCloudwatchScrapeJobService>[]>; /** * The Stack ID of the Grafana Cloud instance. Part of the Terraform Resource ID. */ stackId?: pulumi.Input<string>; /** * A set of static labels to add to all metrics exported by this scrape job. */ staticLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a AwsCloudwatchScrapeJob resource. */ export interface AwsCloudwatchScrapeJobArgs { /** * 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 `resourceId` attribute of the `grafana.cloudProvider.AwsAccount` resource. */ awsAccountResourceId: pulumi.Input<string>; /** * Zero or more configuration blocks to configure custom namespaces for the AWS 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. */ customNamespaces?: pulumi.Input<pulumi.Input<inputs.cloudProvider.AwsCloudwatchScrapeJobCustomNamespace>[]>; /** * Whether the AWS CloudWatch Scrape Job is enabled or not. Defaults to `true`. */ enabled?: pulumi.Input<boolean>; /** * When enabled, AWS resource tags are exported as Prometheus labels to metrics formatted as `aws_<service_name>_info`. Defaults to `true`. */ exportTags?: pulumi.Input<boolean>; /** * The name of the AWS CloudWatch Scrape Job. Part of the Terraform Resource ID. */ name?: pulumi.Input<string>; /** * A subset of the regions that are configured in the associated AWS Account resource to apply to this scrape job. If not set or empty, all of the Account resource's regions are scraped. */ regionsSubsetOverrides?: pulumi.Input<pulumi.Input<string>[]>; /** * One or more configuration blocks to configure AWS services for the AWS 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. */ services?: pulumi.Input<pulumi.Input<inputs.cloudProvider.AwsCloudwatchScrapeJobService>[]>; /** * The Stack ID of the Grafana Cloud instance. Part of the Terraform Resource ID. */ stackId: pulumi.Input<string>; /** * A set of static labels to add to all metrics exported by this scrape job. */ staticLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }