diff --git a/.cz.yaml b/.cz.yaml
new file mode 100644
index 0000000..b1981ec
--- /dev/null
+++ b/.cz.yaml
@@ -0,0 +1,8 @@
+---
+commitizen:
+ major_version_zero: true
+ name: cz_gitmoji
+ tag_format: $version
+ update_changelog_on_bump: true
+ version_provider: scm
+ version_scheme: semver2
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..867570d
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "terraform" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "daily"
diff --git a/.gitignore b/.gitignore
index 7c1cae9..403ffa9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,4 +35,3 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc
-
diff --git a/.gitignore copy b/.gitignore copy
new file mode 100644
index 0000000..403ffa9
--- /dev/null
+++ b/.gitignore copy
@@ -0,0 +1,37 @@
+# Local .terraform directories
+**/.terraform/*
+
+# terraform lock file.
+**/.terraform.lock.hcl
+
+# .tfstate files
+*.tfstate
+*.tfstate.*
+
+# Crash log files
+crash.log
+crash.*.log
+
+# Exclude all .tfvars files, which are likely to contain sensitive data,
+# such as password, private keys, and other secrets. These should not be
+# part of version control as they are data points which are potentially
+# sensitive and subject to change depending on the environment.
+*.tfvars
+*.tfvars.json
+
+# Ignore override files as they are usually used to override resources
+# locally and so are not checked in
+override.tf
+override.tf.json
+*_override.tf
+*_override.tf.json
+
+# Include override files you do wish to add to version control using negated pattern
+# !example_override.tf
+
+# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
+# example: *tfplan*
+
+# Ignore CLI configuration files
+.terraformrc
+terraform.rc
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..6bfca7a
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,99 @@
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ # Git style
+ - id: check-added-large-files
+ - id: check-merge-conflict
+ - id: check-vcs-permalinks
+ - id: forbid-new-submodules
+ - id: no-commit-to-branch
+
+ # Common errors
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ args: [--markdown-linebreak-ext=md]
+ exclude: CHANGELOG.md
+ - id: check-yaml
+ - id: check-merge-conflict
+ - id: check-executables-have-shebangs
+
+ # Cross platform
+ - id: check-case-conflict
+ - id: mixed-line-ending
+ args: [--fix=lf]
+
+ # Security
+ - id: detect-aws-credentials
+ args: ['--allow-missing-credentials']
+ - id: detect-private-key
+
+# JSON5 Linter
+- repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v4.0.0-alpha.8
+ hooks:
+ - id: prettier
+ # https://prettier.io/docs/en/options.html#parser
+ files: '.json5$'
+
+# Terraform Hooks
+- repo: https://github.com/antonbabenko/pre-commit-terraform
+ rev: v1.92.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
+ hooks:
+ - id: terraform_fmt
+ args:
+ - --hook-config=--parallelism-ci-cpu-cores=2
+ - id: terraform_docs
+ args:
+ - --hook-config=--parallelism-ci-cpu-cores=2
+ - id: terraform_tflint
+ name: Terraform validate with tflint
+ description: Validates all Terraform configuration files with TFLint.
+ require_serial: true
+ entry: hooks/terraform_tflint.sh
+ language: script
+ files: (\.tf|\.tfvars)$
+ exclude: \.(terraform/.*|terragrunt-cache)$
+ args:
+ - --hook-config=--parallelism-ci-cpu-cores=2
+ - id: terragrunt_fmt
+ name: Terragrunt fmt
+ description: Rewrites all Terragrunt configuration files to a canonical format.
+ entry: hooks/terragrunt_fmt.sh
+ language: script
+ files: (\.hcl)$
+ exclude: \.(terraform/.*|terragrunt-cache)$
+ args:
+ - --hook-config=--parallelism-ci-cpu-cores=2
+ # - id: terragrunt_validate
+ # name: Terragrunt validate
+ # description: Validates all Terragrunt configuration files.
+ # entry: hooks/terragrunt_validate.sh
+ # language: script
+ # files: (\.hcl)$
+ # exclude: \.(terraform/.*|terragrunt-cache)$
+ # args:
+ # - --hook-config=--parallelism-ci-cpu-cores=2
+ # - id: terragrunt_validate_inputs
+ # name: Terragrunt validate inputs
+ # description: Validates Terragrunt unused and undefined inputs.
+ # entry: hooks/terragrunt_validate_inputs.sh
+ # language: script
+ # files: (\.hcl)$
+ # exclude: \.(terraform/.*|terragrunt-cache)$
+ # args:
+ # - --hook-config=--parallelism-ci-cpu-cores=2
+ # - id: terragrunt_providers_lock
+ # name: Terragrunt providers lock
+ # description: Updates provider signatures in dependency lock files using terragrunt.
+ # entry: hooks/terragrunt_providers_lock.sh
+ # language: script
+ # files: (terragrunt|\.terraform\.lock)\.hcl$
+ # exclude: \.(terraform/.*|terragrunt-cache)$
+ # args:
+ # - --hook-config=--parallelism-ci-cpu-cores=2
+
+- repo: https://github.com/ljnsn/cz-conventional-gitmoji
+ rev: v0.3.2
+ hooks:
+ - id: conventional-gitmoji
diff --git a/.releaserc.json b/.releaserc.json
new file mode 100644
index 0000000..6e39031
--- /dev/null
+++ b/.releaserc.json
@@ -0,0 +1,36 @@
+{
+ "branches": [
+ "main",
+ "master"
+ ],
+ "ci": false,
+ "plugins": [
+ "@semantic-release/commit-analyzer",
+ "@semantic-release/release-notes-generator",
+ [
+ "@semantic-release/github",
+ {
+ "successComment":
+ "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
+ "labels": false,
+ "releasedLabels": false
+ }
+ ],
+ [
+ "@semantic-release/changelog",
+ {
+ "changelogFile": "CHANGELOG.md",
+ "changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
+ }
+ ],
+ [
+ "@semantic-release/git",
+ {
+ "assets": [
+ "CHANGELOG.md"
+ ],
+ "message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
+ }
+ ]
+ ]
+}
diff --git a/.terraform-docs.yml b/.terraform-docs.yml
new file mode 100644
index 0000000..fabfb8d
--- /dev/null
+++ b/.terraform-docs.yml
@@ -0,0 +1,44 @@
+formatter: markdown table
+
+header-from: main.tf
+footer-from: ""
+
+sections:
+## hide: []
+ show:
+ - data-sources
+ - header
+ - footer
+ - inputs
+ - modules
+ - outputs
+ - providers
+ - requirements
+ - resources
+
+output:
+ file: README.md
+ mode: inject
+ template: |-
+
+ {{ .Content }}
+
+
+output-values:
+ enabled: false
+ from: ""
+
+sort:
+ enabled: true
+ by: name
+
+settings:
+ anchor: true
+ color: true
+ default: true
+ description: true
+ escape: true
+ indent: 2
+ required: true
+ sensitive: true
+ type: true
diff --git a/.tflint.hcl b/.tflint.hcl
new file mode 100644
index 0000000..f63db7d
--- /dev/null
+++ b/.tflint.hcl
@@ -0,0 +1,22 @@
+config {
+ module = true
+ force = false
+ disabled_by_default = false
+
+}
+
+rule "aws_instance_invalid_type" {
+ enabled = true
+}
+
+plugin "aws" {
+ enabled = true
+ version = "0.32.0"
+ source = "github.com/terraform-linters/tflint-ruleset-aws"
+}
+
+plugin "terraform" {
+ enabled = true
+ version = "0.9.0"
+ source = "github.com/terraform-linters/tflint-ruleset-terraform"
+}
diff --git a/README.md b/README.md
index bab6556..71871be 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# tfmod-prometheus
-Prometheus is an open source monitoring and alerting tool designed for dynamic cloud systems and especially well suited for monitoring microservice architectures. Prometheus collects and stores metrics as time series data. Metrics are a key means in understanding an applications behavior and a critical facet of operations support. Collectively, "it collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true." - [prometheus.io](https://prometheus.io/)
+Prometheus is an open source monitoring and alerting tool designed for dynamic cloud systems and especially well suited for monitoring microservice architectures. Prometheus collects and stores metrics as time series data. Metrics are a key means in understanding an applications behavior and a critical facet of operations support. Collectively, "it collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true." - [prometheus.io](https://prometheus.io/)
This modules uses Helm to deploy Prometheus to a cluster using the official chart. By default this will install dependent charts/components:
- [alertmanager](https://github.com/prometheus-community/helm-charts/tree/main/charts/alertmanager)
@@ -29,17 +29,15 @@ Versions are module variables, but latest versions are intended to be be reflect
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13 |
-| [aws](#requirement\_aws) | >= 5.14.0 |
| [helm](#requirement\_helm) | >= 2.11.0 |
| [kubernetes](#requirement\_kubernetes) | >= 2.23.0 |
-| [null](#requirement\_null) | >= 3.2.1 |
## Providers
| Name | Version |
|------|---------|
-| [helm](#provider\_helm) | >= 2.11.0 |
-| [kubernetes](#provider\_kubernetes) | >= 2.23.0 |
+| [helm](#provider\_helm) | 2.14.0 |
+| [kubernetes](#provider\_kubernetes) | 2.31.0 |
## Modules
@@ -53,7 +51,7 @@ Versions are module variables, but latest versions are intended to be be reflect
|------|------|
| [helm_release.prometheus](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
-| [kubernetes_namespace.existing-ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source |
+| [kubernetes_namespace.existing_ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source |
## Inputs
@@ -67,7 +65,7 @@ Versions are module variables, but latest versions are intended to be be reflect
| [node\_exporter\_tag](#input\_node\_exporter\_tag) | The image tag of the node-exporter image. | `string` | `"v1.8.2"` | no |
| [profile](#input\_profile) | AWS\_PROFILE to use to apply the terraform script. | `string` | `""` | no |
| [prometheus\_chart\_version](#input\_prometheus\_chart\_version) | The version of prometheus to install into the cluster. | `string` | `"25.24.1"` | no |
-| [prometheus\_config\_reloader\_tag](#input\_prometheus\_config\_reloader\_tag) | The image tag of the prometheus-config-reloader image. | `string` | `"v0.75.1"` | no |
+| [prometheus\_config\_reloader\_tag](#input\_prometheus\_config\_reloader\_tag) | The image tag of the prometheus-config-reloader image. | `string` | `"v0.74.0"` | no |
| [prometheus\_server\_tag](#input\_prometheus\_server\_tag) | The image tag of prometheus server to install into the cluster. | `string` | `"v2.53.1"` | no |
| [pushgateway\_tag](#input\_pushgateway\_tag) | The image tag of the pushgateway image. | `string` | `"v1.9.0"` | no |
| [rwo\_storage\_class](#input\_rwo\_storage\_class) | Specify the storage class for read/write/once persistent volumes. | `string` | `"gp3-encrypted"` | no |
@@ -76,11 +74,11 @@ Versions are module variables, but latest versions are intended to be be reflect
| Name | Description |
|------|-------------|
-| [alertmanager\_headless\_internal\_endpoint](#output\_alertmanager\_headless\_internal\_endpoint) | n/a |
-| [alertmanager\_internal\_endpoint](#output\_alertmanager\_internal\_endpoint) | n/a |
+| [alertmanager\_headless\_internal\_endpoint](#output\_alertmanager\_headless\_internal\_endpoint) | headless internal endpoint for alertmanager |
+| [alertmanager\_internal\_endpoint](#output\_alertmanager\_internal\_endpoint) | internal endpoint for alertmanager |
| [module\_name](#output\_module\_name) | The name of this module. |
| [module\_version](#output\_module\_version) | The version of this module. |
-| [prometheus\_namespace](#output\_prometheus\_namespace) | n/a |
-| [prometheus\_server\_internal\_endpoint](#output\_prometheus\_server\_internal\_endpoint) | n/a |
-| [pushgateway\_internal\_endpoint](#output\_pushgateway\_internal\_endpoint) | n/a |
+| [prometheus\_namespace](#output\_prometheus\_namespace) | namespace for prometheus |
+| [prometheus\_server\_internal\_endpoint](#output\_prometheus\_server\_internal\_endpoint) | internal endpoint for prometheus |
+| [pushgateway\_internal\_endpoint](#output\_pushgateway\_internal\_endpoint) | internal endpoint for pushgateway |
diff --git a/copy_images.tf b/copy_images.tf
index 8bb3eab..a64dbbb 100644
--- a/copy_images.tf
+++ b/copy_images.tf
@@ -83,16 +83,6 @@ module "images" {
image_config = local.image_config
tags = {}
- ### optional
- ## account_alias = ""
- ## account_id = ""
- ## destination_password = ""
- ## destination_username = ""
- ## override_prefixes = {}
- ## region = ""
- ## source_password = ""
- ## source_username = ""
-
enable_lifecycle_policy = true
lifecycle_policy_all = true
force_delete = true
diff --git a/examples/simple/main.tf b/examples/simple/main.tf
index b2ed1d7..fb5e808 100644
--- a/examples/simple/main.tf
+++ b/examples/simple/main.tf
@@ -1,3 +1,20 @@
+terraform {
+ required_version = ">= 0.13"
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = ">= 5.14.0"
+ }
+ helm = {
+ source = "hashicorp/helm"
+ version = ">= 2.11.0"
+ }
+ kubernetes = {
+ source = "hashicorp/kubernetes"
+ version = ">= 2.23.0"
+ }
+ }
+}
provider "aws" {
profile = local.profile
region = local.region
@@ -34,18 +51,6 @@ locals {
namespace = "prometheus"
create_namespace = "true"
- # tags = {
- # project_number = "fs0000000078"
- # project_name = "csvd_platformbaseline"
- # project_role = "csvd_platformbaseline_app"
- # organization = "census:ocio:csvd"
- # created_by = "luther.coleman.mcginty@census.gov"
- # created_for = "luther.coleman.mcginty@census.gov"
- # created_reason = "Testing eks module operation"
- # Terraform = "true"
- # Terragrunt = "true"
- # test_adjustment = "testing adding tags"
- # }
}
module "prometheus" {
@@ -55,4 +60,4 @@ module "prometheus" {
cluster_name = local.cluster_name
namespace = local.namespace
create_namespace = local.create_namespace
-}
\ No newline at end of file
+}
diff --git a/main.tf b/main.tf
index 949f768..9a93623 100644
--- a/main.tf
+++ b/main.tf
@@ -28,7 +28,7 @@ resource "kubernetes_namespace" "ns" {
}
}
-data "kubernetes_namespace" "existing-ns" {
+data "kubernetes_namespace" "existing_ns" {
count = var.create_namespace == true ? 0 : 1
metadata {
@@ -37,7 +37,7 @@ data "kubernetes_namespace" "existing-ns" {
}
locals {
- ns = try(kubernetes_namespace.ns[0].metadata[0].name, data.kubernetes_namespace.existing-ns[0].metadata[0].name)
+ ns = try(kubernetes_namespace.ns[0].metadata[0].name, data.kubernetes_namespace.existing_ns[0].metadata[0].name)
}
resource "helm_release" "prometheus" {
@@ -52,7 +52,7 @@ resource "helm_release" "prometheus" {
# Global
set {
- name = "server.extraArgs.web.enable-remote-write-receiver"
+ name = "server.extraArgs.web.enable-remote-write-receiver"
value = "null"
# kubectl -n prometheus describe deployment prometheus-server
# Will show in the args list as:
diff --git a/outputs.tf b/outputs.tf
index ed51506..e047fe6 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -1,4 +1,5 @@
output "alertmanager_internal_endpoint" {
+ description = "internal endpoint for alertmanager"
value = {
hostname = local.alertmanager_internal_hostname
port_number = local.alertmanager_internal_port_number
@@ -7,6 +8,7 @@ output "alertmanager_internal_endpoint" {
}
output "alertmanager_headless_internal_endpoint" {
+ description = "headless internal endpoint for alertmanager"
value = {
hostname = local.headless_alertmanager_internal_hostname
port_number = local.headless_alertmanager_internal_port_number
@@ -15,6 +17,7 @@ output "alertmanager_headless_internal_endpoint" {
}
output "pushgateway_internal_endpoint" {
+ description = "internal endpoint for pushgateway"
value = {
hostname = local.pushgateway_internal_hostname
port_number = local.pushgateway_internal_port_number
@@ -23,6 +26,7 @@ output "pushgateway_internal_endpoint" {
}
output "prometheus_server_internal_endpoint" {
+ description = "internal endpoint for prometheus"
value = {
hostname = local.server_internal_hostname
port_number = local.server_internal_port_number
@@ -31,7 +35,8 @@ output "prometheus_server_internal_endpoint" {
}
output "prometheus_namespace" {
- value = local.ns
+ description = "namespace for prometheus"
+ value = local.ns
}
################################################################################
@@ -40,10 +45,10 @@ output "prometheus_namespace" {
output "module_name" {
description = "The name of this module."
- value = local._module_name
+ value = local.module_name
}
output "module_version" {
description = "The version of this module."
- value = local._module_version
+ value = local.module_version
}
diff --git a/requirements.tf b/requirements.tf
index 32e5c6f..5f150af 100644
--- a/requirements.tf
+++ b/requirements.tf
@@ -2,10 +2,6 @@ terraform {
required_version = ">= 0.13"
required_providers {
- aws = {
- source = "hashicorp/aws"
- version = ">= 5.14.0"
- }
helm = {
source = "hashicorp/helm"
version = ">= 2.11.0"
@@ -14,9 +10,5 @@ terraform {
source = "hashicorp/kubernetes"
version = ">= 2.23.0"
}
- null = {
- source = "hashicorp/null"
- version = ">= 3.2.1"
- }
}
}
diff --git a/version.tf b/version.tf
index 98adbea..55397e7 100644
--- a/version.tf
+++ b/version.tf
@@ -1,4 +1,4 @@
locals {
- _module_name = "tfmod-prometheus"
- _module_version = "0.0.2"
+ module_name = "tfmod-prometheus"
+ module_version = "0.0.2"
}