Skip to content

Commit

Permalink
admin: add copywrite headers and workflow (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasell committed May 9, 2024
1 parent 77b4105 commit c2870f1
Show file tree
Hide file tree
Showing 109 changed files with 348 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
schema_version = 1

project {
license = "MPL-2.0"
copyright_year = 2024
header_ignore = []
}
20 changes: 20 additions & 0 deletions .github/workflows/copywrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check Copywrite Headers

on:
push: {}

jobs:
copywrite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2
name: Setup Copywrite
with:
version: v0.16.4
archive-checksum: c299f830e6eef7e126a3c6ef99ac6f43a3c132d830c769e0d36fa347fa1af254
- name: Check Copywrite Headers
run: copywrite headers --plan

permissions:
contents: read
3 changes: 3 additions & 0 deletions infra/eu-west-2/core-nomad/aws_ebs_csi.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
aws_ebs_csi_plugin_id = "aws-ebs"
}
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core-nomad/influxdb.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
influxdb_org_name = "nomad-eng"
}
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core-nomad/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

data "terraform_remote_state" "core" {
backend = "local"

Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core-nomad/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

output "influxdb_org_name" {
value = local.influxdb_org_name
}
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core-nomad/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
backend "local" {
path = "terraform.tfstate"
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/inventory.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

plugin: "cloud.terraform.terraform_provider"
project_path: "./.."
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- ansible.builtin.import_playbook: "playbook_bastion.yaml"
- ansible.builtin.import_playbook: "playbook_server.yaml"
- ansible.builtin.import_playbook: "playbook_client.yaml"
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook_bastion.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: bastion
roles:
- role: common
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook_client.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: client
roles:
- role: common
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook_lb.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: lb
roles:
- role: common
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook_nuke_state.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: server:client
gather_facts: false
tasks:
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/ansible/playbook_server.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: server
roles:
- role: common
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/bastion.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "bastion" {
source = "../../../shared/terraform/modules/bastion"

Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/lb.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "core_cluster_lb" {
source = "../../../shared/terraform/modules/nomad-lb"

Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
allowed_cidrs = [for ip in var.allowed_ip_addresses : "${ip}/32"]

Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

output "message" {
value = <<-EOM
Your ${var.project_name} cluster has been provisioned!
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
backend "local" {
path = "terraform.tfstate"
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

region = "eu-west-2"
project_name = "bench-core-jrasell-test"

Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/core/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "region" {}
variable "project_name" {}
variable "allowed_ip_addresses" {}
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/ansible/inventory.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

plugin: "cloud.terraform.terraform_provider"
project_path: "./.."
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/ansible/playbook.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- hosts: bastion
roles:
- role: build
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
test_clusters = {
"${var.project_name}-cluster-1" = {
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

output "message" {
value = <<EOF
Your test clusters have been provisioned!
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/providers.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
ansible = {
Expand Down
3 changes: 3 additions & 0 deletions infra/eu-west-2/test-cluster-template/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "project_name" {
type = string
default = "jrasell-test"
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

roles:
- src: "geerlingguy.docker"
version: "7.1.0"
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/build/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

build_apt_packages: [
"build-essential",
"git",
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/build/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "assert_build_nomad_local_code_path"
ansible.builtin.assert:
that:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/cni/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

cni_plugins_path: "/opt/cni/bin"
cni_plugins_version: "1.3.0"

Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/cni/tasks/install.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "create_cni_plugin_dir"
become: true
ansible.builtin.file:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/cni/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "check_cni_plugins"
ansible.builtin.stat:
path: "{{ cni_plugins_path }}"
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/common/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- amazon.aws.ec2_metadata_facts:
3 changes: 3 additions & 0 deletions shared/ansible/roles/influxdb_telegraf/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

influxdb_telegraf_install_dir: "/usr/local/bin"
influxdb_telegraf_version: "1.29.2"
influxdb_telegraf_config_dir: "/etc/telegraf.d/"
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/influxdb_telegraf/handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "restart_influxdb_telegraf"
become: true
ansible.builtin.service:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/influxdb_telegraf/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "create_config_dir"
become: true
ansible.builtin.file:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

nomad_pkg_version: "" # defaults to latest

nomad_user: root
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/files/anonymous.policy.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

namespace "default" {
policy = "read"
capabilities = ["list-jobs", "read-job"]
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "restart_nomad"
become: true
ansible.builtin.service:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/tasks/acl_bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "bootstrap_acl"
run_once: true
ansible.builtin.command: "nomad acl bootstrap -json"
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/tasks/host_volume.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "create_host_volume"
become: true
ansible.builtin.file:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "download_hashicorp_gpg_key"
become: true
ansible.builtin.get_url:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad/tasks/tls.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "create_tls_directory"
become: true
ansible.builtin.file:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad_lb/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

nomad_lb_nginx_apt_version: "1.18.0-6ubuntu14.4"
nomad_lb_ca_cert: ""
nomad_lb_tls_cert: ""
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad_lb/handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "restart_nginx"
become: true
ansible.builtin.service:
Expand Down
3 changes: 3 additions & 0 deletions shared/ansible/roles/nomad_lb/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

- name: "install_nginx"
become: true
ansible.builtin.apt:
Expand Down
3 changes: 3 additions & 0 deletions shared/nomad/jobs/influxdb.nomad.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "influxdb_bucket_name" {
type = string
default = "default"
Expand Down
3 changes: 3 additions & 0 deletions shared/nomad/jobs/plugin-aws-ebs-controller.nomad.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "plugin_id" {
type = string
default = "aws-ebs"
Expand Down
3 changes: 3 additions & 0 deletions shared/nomad/jobs/plugin-aws-ebs-nodes.nomad.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "plugin_id" {
type = string
default = "aws-ebs"
Expand Down
3 changes: 3 additions & 0 deletions shared/nomad/jobs/tfc-agent.nomad.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

job "tfc-agents" {
group "nomad-bench" {
task "tfc-agent" {
Expand Down
3 changes: 3 additions & 0 deletions shared/terraform/modules/bastion/instance.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resource "aws_instance" "bastion" {
ami = var.ami_id
instance_type = var.instance_type
Expand Down
3 changes: 3 additions & 0 deletions shared/terraform/modules/bastion/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

output "public_ip" {
value = aws_instance.bastion.public_ip
}
3 changes: 3 additions & 0 deletions shared/terraform/modules/bastion/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "project_name" {
description = "The name that will be associated with all AWS resources."
type = string
Expand Down
3 changes: 3 additions & 0 deletions shared/terraform/modules/nomad-cluster/ansible.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
nomad_aws_server_join = "provider=aws tag_key=Nomad_role tag_value=${aws_instance.servers[0].tags.Nomad_role}"
}
Expand Down
Loading

0 comments on commit c2870f1

Please sign in to comment.