Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Oct 26, 2024
0 parents commit 10fd3f0
Show file tree
Hide file tree
Showing 9 changed files with 631 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Main

on:
workflow_dispatch:
push:
branches:
- 'main'

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1

- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}

- name: Install AWS SAM
uses: aws-actions/setup-sam@v2

# FIXME: We're only validating the top-level template and not the rest.
- name: Validate SAM template
run: sam validate --lint -t template.yaml

- name: Validate StackSets SAM template (DNS Zone)
run: sam validate --lint -t stacksets/dns-zone/stackset.yaml

- name: Synethsize StackSet templates
run: |
for _f in $(find . -type f -name 'template.yaml'); do
_dir="$(dirname $_f)/" \
yq \
-i \
'(.. | select(has("localTemplateFile")) | .localTemplateFile) |= load_str(strenv(_dir) + .)' \
$_f;
done
- name: Package SAM artifact (Stacksets Template)
id: package-sam-stacksets
uses: ServerlessOpsIO/gha-package-aws-sam@v1
with:
packaged_template_file: packaged-template.yaml

- name: Store Artifacts
uses: ServerlessOpsIO/gha-store-artifacts@v1


deploy_stacksets:
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1
with:
checkout_artifact: true

- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
gha_build_role_name: ${{ secrets.AWS_CICD_BUILD_ROLE_NAME }}
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
gha_deploy_role_name: ${{ secrets.AWS_CICD_DEPLOY_ROLE_NAME }}

- name: Deploy via AWS SAM
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
with:
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
template_file: packaged-template.yaml
cfn_capabilities: CAPABILITY_AUTO_EXPAND
env_json: ${{ toJson(env) }}
secrets_json: ${{ toJson(secrets) }}
245 changes: 245 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
.aws-sam/

# Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule.*

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# Build folder

*/build/*

# End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AWS DNS Management

Manage DNS zone and records.
7 changes: 7 additions & 0 deletions cfn-parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"RootDomainName": "serverlessops.io",
"DnsManagementAccountId": "$secrets.DNS_ROOT_ZONE_ACCOUNT_ID",
"TargetOuIds": $secrets.AWS_ORG_ROOT_ID,
"TargetAccountIds": $secrets.DEPLOYMENT_ACCOUNT_ID,
"TargetRegions": "us-east-1"
}
1 change: 1 addition & 0 deletions cfn-tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
31 changes: 31 additions & 0 deletions samconfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# More information about the configuration file can be found here:
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html
version = 0.1

[default]
[default.global.parameters]
stack_name = "aws-dns-management"

[default.build.parameters]
cached = true
parallel = true

[default.validate.parameters]
lint = true

[default.deploy.parameters]
capabilities = "CAPABILITY_AUTO_EXPAND"
confirm_changeset = false
#resolve_s3 = true

[default.package.parameters]
#resolve_s3 = true

[default.sync.parameters]
watch = true

[default.local_start_api.parameters]
warm_containers = "EAGER"

[default.local_start_lambda.parameters]
warm_containers = "EAGER"
Loading

0 comments on commit 10fd3f0

Please sign in to comment.