Skip to content

Commit

Permalink
Initial module development
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgin314 committed Mar 6, 2025
0 parents commit 9923678
Show file tree
Hide file tree
Showing 21 changed files with 1,009 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .cz.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
99 changes: 99 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -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}"
}
]
]
}
44 changes: 44 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -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: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
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
22 changes: 22 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Unreleased

# CHANGELOG
* 0.0.1 -- 2024-10-17
- Code genesis
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# tfmod-open-telemetry

Installs the
82 changes: 82 additions & 0 deletions copy_images.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
locals {
otel_name = "opentelemetry-operator"
otel_version = "0.110.0"
otel_key = format("%v#%v", local.otel_name, local.otel_version)

collector_name = "opentelemetry-collector-k8s"
collector_version = "0.111.0-amd64"
collector_key = format("%v#%v", local.collector_name, local.collector_version)

collector_contrib_name = "opentelemetry-collector-contrib"
collector_contrib_version = "0.113.0-amd64"
collector_contrib_key = format("%v#%v", local.collector_contrib_name, local.collector_contrib_version)

rbac_proxy_name = "kube-rbac-proxy"
rbac_proxy_version = "v0.18.1"
rbac_proxy_key = format("%v#%v", local.rbac_proxy_name, local.rbac_proxy_version)

auto_instrumentation_java_name = "autoinstrumentation-java"
auto_instrumentation_java_version = "2.9.0"
auto_instrumentation_java_key = format("%v#%v", local.auto_instrumentation_java_name, local.auto_instrumentation_java_version)

image_config = [
{
enabled = true
dest_path = null
name = local.otel_name
source_image = "otel/${local.otel_name}"
source_registry = "docker.io"
source_tag = local.otel_version
tag = local.otel_version
},
{
enabled = true
dest_path = null
name = local.collector_name
source_image = "otel/${local.collector_name}"
source_registry = "docker.io"
source_tag = local.collector_version
tag = local.collector_version
},
{
enabled = true
dest_path = null
name = local.collector_contrib_name
source_image = "otel/${local.collector_contrib_name}"
source_registry = "docker.io"
source_tag = local.collector_contrib_version
tag = local.collector_contrib_version
},
{
enabled = true
dest_path = null
name = local.rbac_proxy_name
source_image = "brancz/${local.rbac_proxy_name}"
source_registry = "quay.io"
source_tag = local.rbac_proxy_version
tag = local.rbac_proxy_version
},
{
enabled = true
dest_path = null
name = local.auto_instrumentation_java_name
source_image = "open-telemetry/opentelemetry-operator/${local.auto_instrumentation_java_name}"
source_registry = "ghcr.io"
source_tag = local.auto_instrumentation_java_version
tag = local.auto_instrumentation_java_version
}
]
}

module "images" {
source = "git@github.e.it.census.gov:terraform-modules/aws-ecr-copy-images.git/?ref=tf-upgrade"

profile = var.profile
application_name = var.cluster_name
image_config = local.image_config
tags = {}

enable_lifecycle_policy = true
lifecycle_policy_all = true
force_delete = true
}
9 changes: 9 additions & 0 deletions examples/simple/open-telemetry.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module "metrics-server" {
source = "../.."

region = var.region
profile = var.profile
cluster_name = var.cluster_name

tags = var.tags
}
Loading

0 comments on commit 9923678

Please sign in to comment.