Skip to content

Commit

Permalink
feat!: Add tags to workspace and bump min supported version of AWS …
Browse files Browse the repository at this point in the history
…provider to support
  • Loading branch information
bryantbiggs committed Apr 9, 2022
1 parent d3164ee commit b5f8c1b
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.56.0
rev: v1.64.1
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand All @@ -23,7 +23,7 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.2.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ Examples codified under the [`examples`](./examples) are intended to give users
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.1 |

## Modules

Expand All @@ -84,6 +84,7 @@ No modules.
| <a name="input_alert_manager_definition"></a> [alert\_manager\_definition](#input\_alert\_manager\_definition) | The alert manager definition that you want to be applied. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html) | `string` | `null` | no |
| <a name="input_create"></a> [create](#input\_create) | Determines whether a resources will be created | `bool` | `true` | no |
| <a name="input_rule_group_namespaces"></a> [rule\_group\_namespaces](#input\_rule\_group\_namespaces) | A map of one or more rule group namespace definitions | `map(any)` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
| <a name="input_workspace_alias"></a> [workspace\_alias](#input\_workspace\_alias) | The alias of the prometheus workspace. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html) | `string` | `null` | no |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.1 |

## Providers

Expand Down
5 changes: 4 additions & 1 deletion examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# aws_prometheus_workspace
################################################################################
# Workspace
################################################################################

output "workspace_arn" {
description = "Amazon Resource Name (ARN) of the workspace"
value = module.prometheus.workspace_arn
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.64"
version = ">= 4.1"
}
}
}
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
################################################################################
# Workspace
################################################################################

resource "aws_prometheus_workspace" "this" {
count = var.create ? 1 : 0

alias = var.workspace_alias
tags = var.tags
}

################################################################################
# Alert Manager Definition
################################################################################

resource "aws_prometheus_alert_manager_definition" "this" {
count = var.create ? 1 : 0

workspace_id = aws_prometheus_workspace.this[0].id
definition = var.alert_manager_definition
}

################################################################################
# Rule Group Namespace
################################################################################

resource "aws_prometheus_rule_group_namespace" "this" {
for_each = var.create ? var.rule_group_namespaces : {}

Expand Down
5 changes: 4 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# aws_prometheus_workspace
################################################################################
# Workspace
################################################################################

output "workspace_arn" {
description = "Amazon Resource Name (ARN) of the workspace"
value = try(aws_prometheus_workspace.this[0].arn, "")
Expand Down
21 changes: 18 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,36 @@ variable "create" {
default = true
}

# aws_prometheus_workspace
variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)
default = {}
}

################################################################################
# Workspace
################################################################################

variable "workspace_alias" {
description = "The alias of the prometheus workspace. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html)"
type = string
default = null
}

# aws_prometheus_alert_manager_definition
################################################################################
# Alert Manager Definition
################################################################################

variable "alert_manager_definition" {
description = "The alert manager definition that you want to be applied. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html)"
type = string
default = null
}

# aws_prometheus_rule_group_namespace
################################################################################
# Rule Group Namespace
################################################################################

variable "rule_group_namespaces" {
description = "A map of one or more rule group namespace definitions"
type = map(any)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.64"
version = ">= 4.1"
}
}
}

0 comments on commit b5f8c1b

Please sign in to comment.