generated from plus3it/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from lorengordon/init
Provides initial capability for managing an ec2 prefix list and its entries
- Loading branch information
Showing
12 changed files
with
140 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,13 @@ | ||
## repo-template | ||
## terraform-aws-tardigrade-ec2-managed-prefix-list | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
### [1.2.1] (https://github.com/plus3it/repo-template/releases/tag/1.2.1) | ||
### [1.0.0](https://github.com/plus3it/terraform-aws-tardigrade-ec2-managed-prefix-list/releases/tag/1.0.0) | ||
|
||
**Summary**: | ||
|
||
* Updated README.md to include config settings for github | ||
* Updated LICENSE copyright year | ||
|
||
### [1.2.0] (https://github.com/plus3it/repo-template/releases/tag/1.2.0) | ||
|
||
**Summary**: | ||
|
||
* Updated SHA value for Github Actions Workflows | ||
* Updated CHANGELOG.template.md file | ||
* Added Master branch in release workflow logic to make migration to Github Actions more efficient | ||
|
||
### 1.1.0 | ||
|
||
**Commit Delta**: N/A | ||
|
||
**Released**: 2023.01.27 | ||
|
||
**Summary**: | ||
|
||
* Updated workflow files to be consumable and reusable, and now points to actions-workflows repo | ||
|
||
### 1.0.0 | ||
|
||
**Commit Delta**: N/A | ||
|
||
**Released**: 2023.01.10 | ||
**Released**: 2024.11.11 | ||
|
||
**Summary**: | ||
|
||
* Initial release of capability | ||
* Initial release of capability to manage an EC2 prefix list and its rules |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,34 @@ | ||
# repo-template | ||
Generic repo template for Plus3IT repositories | ||
|
||
To use this template: | ||
|
||
1. Select the green "Use this template" button, or [click here](https://github.com/plus3it/repo-template/generate). | ||
2. Select the repo Owner, give the repo a name, enter a description, select Public or Private, and click "Create repository from template". | ||
3. Clone the repository and create a new branch. | ||
4. Configure the following settings on your new repo. | ||
* `GENERAL` | ||
* `Features` | ||
* Turn off Wikis, Sponsorships, Discussions, and Projects | ||
* `Pull Requests` | ||
* Turn off Squash Merging | ||
* Turn off Rebase Merging | ||
* Turn on Allow Auto-Merge | ||
* Turn on Automatically delete head branches | ||
* `Pushes` | ||
* Limit how many branches can be updated in a single push: 2 | ||
* `COLLABORATORS and TEAMS` | ||
* `Manage Access` | ||
* Add relevant team roles, for example | ||
* `tardigrade-admins` (Admin) | ||
* `terraform` (Write) | ||
* `releasebot` (Write) | ||
* `Branches` | ||
* `Create Branch Protection rule` for `main` | ||
* Turn on Require pull request before merging | ||
* Turn on Require approvals | ||
* Turn on Dismiss stale pull requests... | ||
* `Required Status Checks` | ||
* As relevant to projects, for example | ||
* WIP | ||
* lint/actionlint | ||
* lint/tardigradelint | ||
* test / mockstacktest | ||
* Turn on Do not allow bypassing the above settings | ||
5. Edit the following files to customize them for the new repository: | ||
* `LICENSE` | ||
* Near the end of the file, edit the date and change the repository name | ||
* `CHANGELOG.template.md` | ||
* Rename to `CHANGELOG.md`, replacing the repo-template changelog | ||
* Edit templated items for the new repo | ||
* `.bumpversion.cfg` | ||
* Edit the version number for the new repo, ask team if not sure what to | ||
start with | ||
* `README.md` | ||
* Replace contents for the new repo | ||
* `.github/` | ||
* Inspect dependabot and workflow files in case changes are needed for | ||
the new repo | ||
6. Commit the changes and open a pull request | ||
# terraform-aws-tardigrade-ec2-managed-prefix-list | ||
|
||
Terraform module for managing an EC2 Prefix List and its entries. | ||
|
||
<!-- BEGIN TFDOCS --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_ec2_managed_prefix_list"></a> [ec2\_managed\_prefix\_list](#input\_ec2\_managed\_prefix\_list) | Object of attributes for the EC2 managed prefix list | <pre>object({<br> name = string<br> address_family = optional(string, "IPv4")<br> max_entries = optional(number)<br> tags = optional(map(string), {})<br><br> entries = optional(list(object({<br> name = string<br> cidr = string<br> description = optional(string)<br> })), [])<br> })</pre> | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_ec2_managed_prefix_list"></a> [ec2\_managed\_prefix\_list](#output\_ec2\_managed\_prefix\_list) | Object of attributes for the managed prefix list | | ||
| <a name="output_ec2_managed_prefix_list_entries"></a> [ec2\_managed\_prefix\_list\_entries](#output\_ec2\_managed\_prefix\_list\_entries) | Object of attributes for the managed prefix list entries | | ||
|
||
<!-- END TFDOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "aws_ec2_managed_prefix_list" "this" { | ||
name = var.ec2_managed_prefix_list.name | ||
|
||
address_family = var.ec2_managed_prefix_list.address_family | ||
max_entries = coalesce(var.ec2_managed_prefix_list.max_entries, max(length(var.ec2_managed_prefix_list.entries), 1)) | ||
tags = var.ec2_managed_prefix_list.tags | ||
} | ||
|
||
resource "aws_ec2_managed_prefix_list_entry" "this" { | ||
for_each = { for prefix_list in var.ec2_managed_prefix_list.entries : prefix_list.name => prefix_list } | ||
|
||
cidr = each.value.cidr | ||
description = coalesce(each.value.description, each.value.name) | ||
prefix_list_id = aws_ec2_managed_prefix_list.this.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "ec2_managed_prefix_list" { | ||
description = "Object of attributes for the managed prefix list" | ||
value = aws_ec2_managed_prefix_list.this | ||
} | ||
|
||
output "ec2_managed_prefix_list_entries" { | ||
description = "Object of attributes for the managed prefix list entries" | ||
value = aws_ec2_managed_prefix_list_entry.this | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module "ec2_managed_prefix_list" { | ||
source = "../.." | ||
|
||
ec2_managed_prefix_list = { | ||
name = "tardigrade-test-prefix-list-${local.id}" | ||
address_family = "IPv4" | ||
max_entries = 5 | ||
tags = { | ||
Name = "tardigrade-test-prefix-list-${local.id}" | ||
} | ||
|
||
entries = [ | ||
{ | ||
name = "tardigrade-test-prefix-list-entry-${local.id}-1" | ||
cidr = "10.0.0.0/16" | ||
description = "tardigrade-test-prefix-list-entry-${local.id}-1" | ||
}, | ||
] | ||
} | ||
} | ||
|
||
data "terraform_remote_state" "prereq" { | ||
backend = "local" | ||
config = { | ||
path = "prereq/terraform.tfstate" | ||
} | ||
} | ||
|
||
locals { | ||
id = data.terraform_remote_state.prereq.outputs.test_id.result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "random_string" "this" { | ||
length = 6 | ||
upper = false | ||
special = false | ||
numeric = false | ||
} | ||
|
||
output "test_id" { | ||
value = random_string.this | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module "ec2_managed_prefix_list" { | ||
source = "../.." | ||
|
||
ec2_managed_prefix_list = { | ||
name = "tardigrade-test-prefix-list-${random_string.this.result}" | ||
} | ||
} | ||
|
||
resource "random_string" "this" { | ||
length = 6 | ||
upper = false | ||
special = false | ||
numeric = false | ||
} | ||
|
||
locals { | ||
id = random_string.this.result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
variable "ec2_managed_prefix_list" { | ||
description = "Object of attributes for the EC2 managed prefix list" | ||
type = object({ | ||
name = string | ||
address_family = optional(string, "IPv4") | ||
max_entries = optional(number) | ||
tags = optional(map(string), {}) | ||
|
||
entries = optional(list(object({ | ||
name = string | ||
cidr = string | ||
description = optional(string) | ||
})), []) | ||
}) | ||
} |