Skip to content

Commit

Permalink
Merge pull request #2 from clouddrove/test-cognito
Browse files Browse the repository at this point in the history
Test cognito
  • Loading branch information
themaniskshah committed Dec 2, 2022
2 parents 29eef1c + 13691d5 commit 1061d5f
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 112 deletions.
98 changes: 59 additions & 39 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
name: 'Terraform GitHub Actions'
name: static-checks

on:
pull_request:
branches:
- master

jobs:
fmt:
name: 'terraform fmt'
versionExtract:
name: Get min/max versions
runs-on: ubuntu-latest

steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: Checkout
uses: actions/checkout@v2

- name: 'Terraform Format'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'fmt'
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@main
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}

multi-node:
name: 'multi-node'
needs: fmt

versionEvaluate:
name: Evaluate Terraform versions
runs-on: ubuntu-latest
needs: versionExtract
strategy:
fail-fast: false
matrix:
version:
- ${{ needs.versionExtract.outputs.minVersion }}
- ${{ needs.versionExtract.outputs.maxVersion }}
directory:
- _example/

steps:
- name: Checkout
uses: actions/checkout@v2

- name: 'Checkout'
uses: actions/checkout@master
- name: Install Terraform v${{ matrix.version }}
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.version }}

- name: 'Configure AWS Credentials'
uses: clouddrove/configure-aws-credentials@v1
Expand All @@ -33,31 +49,35 @@ jobs:
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
aws-region: us-east-2

- name: 'Terraform init'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example
- name: Init & validate v${{ matrix.version }}
run: |
cd ${{ matrix.directory }}
terraform init
terraform validate
terraform plan -input=false -no-color
- name: 'Terraform validate'
uses: 'clouddrove/github-actions@v6.0'
- name: tflint
uses: reviewdog/action-tflint@master
with:
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example
github_token: ${{ secrets.GITHUB }}
working_directory: ${{ matrix.directory }}
fail_on_error: 'true'
filter_mode: 'nofilter'
flags: '--module'

- name: 'Terraform plan'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example
format:
name: Check code format
runs-on: ubuntu-latest
needs: versionExtract

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
uses: hashicorp/setup-terraform@v1
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}

- name: Check Terraform format changes
run: terraform fmt --recursive
10 changes: 7 additions & 3 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ module "cognito" {
label_order = ["environment", "name"]

enabled = true
cognito_domain = "cd-es-cog"
region = "eu-west-1"
software_token_enabled = false
allow_admin_create_user_only = false
advanced_security_mode = "ENFORCED"
cognito_domain = "test"
region = "eu-west-1"
software_token_enabled = true
mfa_configuration = "ON"

}
24 changes: 12 additions & 12 deletions _example/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
output "user_pool_id" {
value = module.cognito-ex.user_pool_id
description = "ARN of the Elasticsearch domain."
}
# output "user_pool_id" {
# value = module.cognito-ex.user_pool_id
# description = "ARN of the Elasticsearch domain."
# }

output "identity_pool_id" {
value = module.cognito-ex.identity_pool_id
description = "ARN of the Elasticsearch domain."
}
# output "identity_pool_id" {
# value = module.cognito-ex.identity_pool_id
# description = "ARN of the Elasticsearch domain."
# }

output "tags" {
value = module.cognito-ex.tags
description = "A mapping of tags to assign to the resource."
}
# output "tags" {
# value = module.cognito-ex.tags
# description = "A mapping of tags to assign to the resource."
# }
Loading

0 comments on commit 1061d5f

Please sign in to comment.