Skip to content

Commit

Permalink
Merge pull request #2 from clouddrove/internal-205
Browse files Browse the repository at this point in the history
Internal 205
  • Loading branch information
themaniskshah committed Mar 9, 2023
2 parents 5e7be39 + daa57db commit cc89d4a
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 109 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: 'Create README.md file'
on:
push:
branches:
- master
pull_request:

jobs:
readme-create:
Expand Down
108 changes: 69 additions & 39 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,84 @@
name: 'Create README.md file'
name: static-checks

on:
push:
branches:
- master
pull_request:

jobs:
readme-create:
name: 'readme-create'
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 min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@main
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}


- name: Set up Python 3.7.
uses: actions/setup-python@v2
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/complete/

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

- name: Install Terraform v${{ matrix.version }}
uses: hashicorp/setup-terraform@v1
with:
python-version: '3.x'
terraform_version: ${{ matrix.version }}

- name: 'create readme'
uses: 'clouddrove/github-actions@v9.0.2'
- name: 'Configure AWS Credentials'
uses: clouddrove/configure-aws-credentials@v1
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB}}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
aws-region: us-east-2

- name: Init & validate v${{ matrix.version }}
run: |
cd ${{ matrix.directory }}
terraform init
terraform validate
terraform plan -input=false -no-color
- name: tflint
uses: reviewdog/action-tflint@master
with:
tflint_version: v0.29.0
github_token: ${{ secrets.GITHUB }}
working_directory: ${{ matrix.directory }}
fail_on_error: 'true'
filter_mode: 'nofilter'
flags: '--module'

- name: 'pre-commit check errors'
uses: pre-commit/action@v2.0.0
continue-on-error: true
format:
name: Check code format
runs-on: ubuntu-latest
needs: versionExtract

- name: 'pre-commit fix erros'
uses: pre-commit/action@v2.0.0
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v2

- name: 'push readme'
uses: 'clouddrove/github-actions@v9.0.2'
continue-on-error: true
- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
uses: hashicorp/setup-terraform@v1
with:
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
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()
- name: Check Terraform format changes
run: terraform fmt --recursive
1 change: 0 additions & 1 deletion .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
branches:
- master
types: [labeled]

jobs:
terraform:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB}}
working_directory: ./_example/complete/


- name: 'Terraform security scan Advanced'
uses: triat/terraform-security-scan@v3.0.3
if: github.event_name == 'pull_request'
Expand Down
128 changes: 64 additions & 64 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,75 +42,75 @@ usage: |-
Here are the example of how you can use this module in your inventory structure:
### Example
```hcl
provider "aws" {
region = "us-east-1"
}
provider "aws" {
region = "us-east-1"
}
module "dashboard" {
source = "../../"
start = "-PT4H"
widgets = [
{
height = 5
width = 14
y = 19
x = 10
module "dashboard" {
source = "../../"
start = "-PT4H"
widgets = [
{
height = 5
width = 14
y = 19
x = 10
type = "metric"
properties = {
metrics = [
[ "ContainerInsights", "pod_number_of_container_restarts", "PodName", "api", "ClusterName", "prod-xcheck-eks-cluster", "Namespace", "api-mbj" ],
[ "...", "testing", ".", ".", ".", "testing" ],
]
view = "pie"
stacked = false
region = "us-east-1"
liveData = true
title = "Number of container restarts"
period = 300
setPeriodToTimeRange = false,
stat = "Average"
legend = {
"position": "bottom"
}
sparkline = true
trend = true
labels = {
"visible": "true"
}
}
},
{
height = 14
width = 10
y = 5
x = 0
type = "metric"
properties = {
metrics = [
[ "ContainerInsights", "pod_number_of_container_restarts", "PodName", "api", "ClusterName", "prod-xcheck-eks-cluster", "Namespace", "api-mbj" ],
[ "...", "testing", ".", ".", ".", "testing" ],
]
view = "pie"
stacked = false
region = "us-east-1"
liveData = true
title = "Number of container restarts"
period = 300
setPeriodToTimeRange = false,
stat = "Average"
legend = {
"position": "bottom"
}
sparkline = true
trend = true
labels = {
"visible": "true"
}
}
},
{
height = 14
width = 10
y = 5
x = 0
type = "metric"
properties = {
metrics = [
[ "ContainerInsights", "pod_memory_utilization", "PodName", "api", "ClusterName", "test-xcheck-eks-cluster", "Namespace", "api-puj" ],
[ "...", "api-test" ],
]
view = "pie"
region = "us-east-1"
title = "Tet pod Memory Utilization"
period = 300
trend = true
liveData = true
sparkline = true
setPeriodToTimeRange = false,
labels = {
"visible": "true"
type = "metric"
properties = {
metrics = [
[ "ContainerInsights", "pod_memory_utilization", "PodName", "api", "ClusterName", "test-xcheck-eks-cluster", "Namespace", "api-puj" ],
[ "...", "api-test" ],
]
view = "pie"
region = "us-east-1"
title = "Tet pod Memory Utilization"
period = 300
trend = true
liveData = true
sparkline = true
setPeriodToTimeRange = false,
labels = {
"visible": "true"
}
}
}
}
]
}
]
}
resource "aws_cloudwatch_dashboard" "dashboard" {
dashboard_body = module.dashboard.json_map_encoded
dashboard_name = "test-dashboard"
}
resource "aws_cloudwatch_dashboard" "dashboard" {
dashboard_body = module.dashboard.json_map_encoded
dashboard_name = "test-dashboard"
}
```
2 changes: 1 addition & 1 deletion _test/complete/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestCloudWatch(t *testing.T) {

terraformOptions := &terraform.Options{
// Source path of Terraform directory.
TerraformDir: "../../_example/complete",
TerraformDir: "../../_example/complete/",
}

// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
Expand Down

0 comments on commit cc89d4a

Please sign in to comment.