Skip to content

Commit

Permalink
feat: initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
nozaq committed Nov 19, 2022
0 parents commit 042c1f2
Show file tree
Hide file tree
Showing 18 changed files with 447 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Describe the bug

<!-- A clear and concise description of what the bug is. -->

## Versions

<!-- Provide the versions of terraform, the AWS provider and this module you're using -->

- Terraform:
- Provider:
- Module:

## Reproduction

<!-- Steps to reproduce the behavior: -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Actual behavior

<!-- A clear and concise description of what actually happened. -->

## Additional context

<!-- Add any other context about the problem here. -->
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## Is your feature request related to a problem? Please describe.

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

## Describe the solution you'd like

<!-- A clear and concise description of what you want to happen. -->

## Describe alternatives you've considered

<!-- Optional. A clear and concise description of any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
pre-commit-checks:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@v1.0.4
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.4.1
with:
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
terraform-docs-version: v0.16.0
validate-examples:
name: Validate examples
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: examples
steps:
- uses: hashicorp/setup-terraform@v1
- name: Checkout
uses: actions/checkout@v2
- name: Check examples
env:
EXAMPLES: simple
run: |
for EXAMPLE in ${EXAMPLES}
do
echo "Validating $EXAMPLE"...
cd $EXAMPLE && terraform init && terraform validate && cd -
done
12 changes: 12 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: terraform-module
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.terraform.lock.hcl

#####################
# Default gitignore #
#####################

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive 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

# 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
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
hooks:
- id: terraform_fmt
- id: terraform_docs
args:
- --args=--config=.terraform-docs.yml
- id: terraform_tflint
exclude: "test/"
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
16 changes: 16 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
formatter: "markdown table"

sections:
show:
- requirements
- providers
- inputs
- outputs

sort:
enabled: true
by: required

settings:
default: false
lockfile: false
53 changes: 53 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
config {
module = false
force = false
disabled_by_default = false
}

rule "terraform_deprecated_interpolation" {
enabled = true
}

rule "terraform_deprecated_index" {
enabled = true
}

rule "terraform_unused_declarations" {
enabled = true
}

rule "terraform_comment_syntax" {
enabled = true
}

rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_typed_variables" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = true
}

rule "terraform_required_version" {
enabled = true
}

rule "terraform_required_providers" {
enabled = true
}

rule "terraform_standard_module_structure" {
enabled = true
}

rule "terraform_workspace_remote" {
enabled = true
}
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Takashi Nozawa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# terraform-google-parked-domain-baseline

[![Github Actions](https://github.com/nozaq/terraform-google-parked-domain-baseline/actions/workflows/main.yml/badge.svg)](https://github.com/nozaq/terraform-google-parked-domain-baseline/actions/workflows/main.yml)
[![Releases](https://img.shields.io/github/v/release/nozaq/terraform-google-parked-domain-baseline)](https://github.com/nozaq/terraform-google-parked-domain-baseline/releases/latest)

[Terraform Module Registry](https://registry.terraform.io/modules/nozaq/parked-domain-baseline/google)

A terraform module to set up DNS records to harden the parked(unused) domain using GCP Cloud DNS.

Domains should be protected for email spoofing even if they are not intended to be actively used.
This module configures DNS records to protect such domain based on [M3AAWG Protecting Parked Domains Best Common Practices].

## Features

This module creates the following DNS records.

- Null MX record([RFC 7505]) to indicate the domain does not accept any email.
- SPF record to indicate no IP is authorized to send email on behalf of this domain.
- DMARC record to enforce receiving domains to reject any email forging this domain.
- Optionally adds `rua` tag in the DMARC record to receive aggregate feedback reports via email.
- Optionally creates Null MX and DMARC records for wildcard subdomains as well as the root domain(enabled by default).

## Usage

```hcl
provider "google" {
}
module "parked_domain" {
source = "nozaq/parked-domain-baseline/google"
zone_name = "example.com."
ttl = 86400
include_subdomains = true
}
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_google"></a> [google](#requirement\_google) | >= 4.43 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | >= 4.43 |

## Inputs

| Name | Description | Type | Required |
|------|-------------|------|:--------:|
| <a name="input_zone_name"></a> [zone\_name](#input\_zone\_name) | The DNS zone name to add the records to. | `string` | yes |
| <a name="input_aggregate_feedback_email"></a> [aggregate\_feedback\_email](#input\_aggregate\_feedback\_email) | The email address to which aggregate feedback is to be sent. | `string` | no |
| <a name="input_include_subdomains"></a> [include\_subdomains](#input\_include\_subdomains) | Configure all subdomains as well as the root domain. | `bool` | no |
| <a name="input_ttl"></a> [ttl](#input\_ttl) | The TTL of the DNS records. | `number` | no |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

[M3AAWG Protecting Parked Domains Best Common Practices]: https://www.m3aawg.org/sites/default/files/m3aawg_parked_domains_bcp-2022-06.pdf
[RFC 7505]: https://datatracker.ietf.org/doc/rfc7505/
21 changes: 21 additions & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.43"
}
}

required_version = ">= 1.3"
}

provider "google" {
project = var.project_id
}

module "parked_domain" {
source = "../../"

zone_name = "example.com."
ttl = 86400 # One day
}
Empty file added examples/simple/outputs.tf
Empty file.
4 changes: 4 additions & 0 deletions examples/simple/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "project_id" {
description = "The GCP project ID."
type = string
}
Loading

0 comments on commit 042c1f2

Please sign in to comment.