Skip to content

Commit cdf9ab5

Browse files
Brad Haynescloudpossebot
Brad Haynes
andauthored
Feat: Context tags for subnets and routetables (#42)
Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
1 parent f1b9570 commit cdf9ab5

9 files changed

+79
-30
lines changed

.github/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ template: |
4747
4848
replacers:
4949
# Remove irrelevant information from Renovate bot
50-
- search: '/(?<=---\s+)+^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
50+
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
5151
replace: ''
5252
# Remove Renovate bot banner image
5353
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'

.github/workflows/auto-context.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
3636
- name: Create Pull Request
3737
if: steps.update.outputs.create_pull_request == 'true'
38-
uses: cloudposse/actions/github/create-pull-request@0.22.0
38+
uses: cloudposse/actions/github/create-pull-request@0.30.0
3939
with:
4040
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
4141
committer: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>'

.github/workflows/auto-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
fi
6363
6464
- name: Auto Test
65-
uses: cloudposse/actions/github/repository-dispatch@0.22.0
65+
uses: cloudposse/actions/github/repository-dispatch@0.30.0
6666
# match users by ID because logins (user names) are inconsistent,
6767
# for example in the REST API Renovate Bot is `renovate[bot]` but
6868
# in GraphQL it is just `renovate`, plus there is a non-bot

.github/workflows/auto-readme.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "auto-readme"
2+
on:
3+
schedule:
4+
# Example of job definition:
5+
# .---------------- minute (0 - 59)
6+
# | .------------- hour (0 - 23)
7+
# | | .---------- day of month (1 - 31)
8+
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
9+
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
10+
# | | | | |
11+
# * * * * * user-name command to be executed
12+
13+
# Update README.md nightly at 4am UTC
14+
- cron: '0 4 * * *'
15+
16+
jobs:
17+
update:
18+
if: github.event_name == 'schedule'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Update readme
24+
shell: bash
25+
id: update
26+
env:
27+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28+
run: |
29+
make init
30+
make readme/build
31+
# Ignore changes if they are only whitespace
32+
git diff --ignore-all-space --ignore-blank-lines --quiet README.md && { git restore README.md; echo Ignoring whitespace-only changes in README; }
33+
34+
- name: Create Pull Request
35+
# This action will not create or change a pull request if there are no changes to make.
36+
# If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
37+
uses: cloudposse/actions/github/create-pull-request@0.30.0
38+
with:
39+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
40+
commit-message: Update README.md and docs
41+
title: Update README.md and docs
42+
body: |-
43+
## what
44+
This is an auto-generated PR that updates the README.md and docs
45+
46+
## why
47+
To have most recent changes of README.md and doc from origin templates
48+
49+
branch: auto-update/readme
50+
base: main
51+
delete-branch: true
52+
labels: |
53+
auto-update
54+
no-release
55+
readme

.github/workflows/chatops.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: "Handle common commands"
12-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
12+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
1313
with:
1414
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
1515
reaction-token: ${{ secrets.GITHUB_TOKEN }}
@@ -24,7 +24,7 @@ jobs:
2424
- name: "Checkout commit"
2525
uses: actions/checkout@v2
2626
- name: "Run tests"
27-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
27+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
2828
with:
2929
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
3030
reaction-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate-codeowners.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ jobs:
1010
steps:
1111
- name: "Checkout source code at current commit"
1212
uses: actions/checkout@v2
13-
- uses: mszostok/codeowners-validator@v0.5.0
13+
- uses: mszostok/codeowners-validator@v0.7.1
1414
if: github.event.pull_request.head.repo.full_name == github.repository
1515
name: "Full check of CODEOWNERS"
1616
with:
1717
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
1818
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
1919
# checks: "files,syntax,owners,duppatterns"
2020
checks: "syntax,owners,duppatterns"
21+
owner_checker_allow_unowned_patterns: "false"
2122
# GitHub access token is required only if the `owners` check is enabled
2223
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
23-
- uses: mszostok/codeowners-validator@v0.5.0
24+
- uses: mszostok/codeowners-validator@v0.7.1
2425
if: github.event.pull_request.head.repo.full_name != github.repository
2526
name: "Syntax check of CODEOWNERS"
2627
with:
2728
checks: "syntax,duppatterns"
29+
owner_checker_allow_unowned_patterns: "false"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
549549

550550
## Copyright
551551

552-
Copyright © 2017-2021 [Cloud Posse, LLC](https://cpco.io/copyright)
552+
Copyright © 2017-2022 [Cloud Posse, LLC](https://cpco.io/copyright)
553553

554554

555555

private.tf

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,20 @@ resource "aws_subnet" "private" {
1818
cidr_block = cidrsubnet(var.cidr_block, ceil(log(var.max_subnets, 2)), count.index)
1919
map_public_ip_on_launch = var.map_public_ip_on_launch_enabled
2020

21-
tags = merge({
22-
"Name" = "${module.private_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
23-
"Stage" = module.private_label.stage
24-
"Namespace" = module.private_label.namespace
25-
"Named" = var.subnet_names[count.index]
26-
"Type" = var.type
21+
tags = merge(module.private_label.tags, {
22+
"Name" = "${module.private_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
23+
"Named" = var.subnet_names[count.index]
24+
"Type" = var.type
2725
}, var.tags)
2826
}
2927

3028
resource "aws_route_table" "private" {
3129
count = local.private_count
3230
vpc_id = var.vpc_id
3331

34-
tags = {
35-
"Name" = "${module.private_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
36-
"Stage" = module.private_label.stage
37-
"Namespace" = module.private_label.namespace
38-
}
32+
tags = merge(module.private_label.tags, {
33+
"Name" = "${module.private_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
34+
})
3935
}
4036

4137
resource "aws_route" "private" {

public.tf

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,20 @@ resource "aws_subnet" "public" {
1919
cidr_block = cidrsubnet(var.cidr_block, ceil(log(var.max_subnets, 2)), count.index)
2020
map_public_ip_on_launch = var.map_public_ip_on_launch_enabled
2121

22-
tags = merge({
23-
"Name" = "${module.public_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
24-
"Stage" = module.public_label.stage
25-
"Namespace" = module.public_label.namespace
26-
"Named" = var.subnet_names[count.index]
27-
"Type" = var.type
22+
tags = merge(module.public_label.tags, {
23+
"Name" = "${module.public_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
24+
"Named" = var.subnet_names[count.index]
25+
"Type" = var.type
2826
}, var.tags)
2927
}
3028

3129
resource "aws_route_table" "public" {
3230
count = local.public_count
3331
vpc_id = var.vpc_id
3432

35-
tags = {
36-
"Name" = "${module.public_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
37-
"Stage" = module.public_label.stage
38-
"Namespace" = module.public_label.namespace
39-
}
33+
tags = merge(module.public_label.tags, {
34+
"Name" = "${module.public_label.id}${module.this.delimiter}${element(var.subnet_names, count.index)}"
35+
})
4036
}
4137

4238
resource "aws_route" "public" {

0 commit comments

Comments
 (0)