Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Oidc and Latest Flagscript Cicd #18

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: release
on:
push:
branches:
- main

jobs:
main:
runs-on: ubuntu-latest
environment:
name: release #your environment name
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,6 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/osx,node,linux,windows,visualstudiocode,terraform

# Custom
.commit
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# echo "Generating pre-commit flag"
# touch .commit
terraform fmt -check
19 changes: 0 additions & 19 deletions .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
]
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "CHANGELOG.md",
"label": "CHANGELOG"
}
]
}
]
]
}
3 changes: 3 additions & 0 deletions modules/account-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ No modules.
|------|------|
| [aws_iam_account_alias.alias](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_account_alias) | resource |
| [aws_iam_account_password_policy.password_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_account_password_policy) | resource |
| [aws_iam_openid_connect_provider.github_openid_provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_openid_connect_provider) | resource |
| [aws_s3_account_public_access_block.account_s3_public_access_block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_account_public_access_block) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_install_github_openid_profider"></a> [install\_github\_openid\_profider](#input\_install\_github\_openid\_profider) | Whether or not to install the github oidc provider. Currently for flagscript, this is only for accounts where github is pushing s3 content. | `bool` | `false` | no |
| <a name="input_name"></a> [name](#input\_name) | The name for the aws account. | `string` | n/a | yes |
| <a name="input_openid_provider_name"></a> [openid\_provider\_name](#input\_openid\_provider\_name) | Name of the github openid provider. | `string` | `"FlagscriptGitHibOpenIdProvider"` | no |

## Outputs

Expand Down
15 changes: 15 additions & 0 deletions modules/account-setup/openid.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "aws_iam_openid_connect_provider" "github_openid_provider" {
count = var.install_github_openid_profider ? 1 : 0
url = "https://token.actions.githubusercontent.com"
client_id_list = [
"sts.amazonaws.com",
]
thumbprint_list = ["D89E3BD43D5D909B47A18977AA9D5CE36CEE184C"]
tags = merge(
local.common_tags,
{
Name = var.openid_provider_name
"oidc-provider-type" : "github"
}
)
}
11 changes: 11 additions & 0 deletions modules/account-setup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ variable "name" {

# OPTIONAL PARAMETERS
# These parameters have reasonable defaults.
variable "install_github_openid_profider" {
default = false
description = "Whether or not to install the github oidc provider. Currently for flagscript, this is only for accounts where github is pushing s3 content."
type = bool
}

variable "openid_provider_name" {
default = "FlagscriptGitHibOpenIdProvider"
description = "Name of the github openid provider."
type = string
}
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "terraform-aws-flagscript-organization",
"description": "Flagscript structured organization and account setup modules adhering to reasonable aws standards.",
"main": "index.js",
"scripts": {
"prepare": "husky"
},
"repository": {
"type": "git",
"url": "git+https://github.com/flagscript/terraform-aws-flagscript-organization.git"
},
"keywords": [
"flagscript",
"aws",
"terraform",
"kms"
],
"author": {
"name": "Greg Kaestle",
"email": "[email protected]"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/flagscript/terraform-aws-flagscript-organization/issues"
},
"homepage": "https://github.com/flagscript/terraform-aws-flagscript-organization#readme",
"dependencies": {
"husky": "^9.1.5"
}
}
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.