Skip to content

Resource: awsPrometheusWorkspace

Manages an Amazon Managed Service for Prometheus (AMP) Workspace.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.prometheusWorkspace.PrometheusWorkspace(this, "example", {
  alias: "example",
  tags: {
    Environment: "production",
  },
});

CloudWatch Logging

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloudwatchLogGroupExample =
  new aws.cloudwatchLogGroup.CloudwatchLogGroup(this, "example", {
    name: "example",
  });
const awsPrometheusWorkspaceExample =
  new aws.prometheusWorkspace.PrometheusWorkspace(this, "example_1", {
    loggingConfiguration: {
      logGroupArn: `\${${awsCloudwatchLogGroupExample.arn}}:*`,
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsPrometheusWorkspaceExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • alias - (Optional) The alias of the prometheus workspace. See more in AWS Docs.
  • loggingConfiguration - (Optional) Logging configuration for the workspace. See Logging Configuration below for details.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Logging Configuration

The loggingConfiguration block supports the following arguments:

  • logGroupArn - (Required) The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Amazon Resource Name (ARN) of the workspace.
  • id - Identifier of the workspace
  • prometheusEndpoint - Prometheus endpoint available for this workspace.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

AMP Workspaces can be imported using the identifier, e.g.,

$ terraform import aws_prometheus_workspace.demo ws-C6DCB907-F2D7-4D96-957B-66691F865D8B