Skip to content

Commit

Permalink
feat: changes in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkhandale2024 committed Mar 29, 2024
1 parent 0ea8f0c commit bf873c7
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 171 deletions.
44 changes: 42 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,52 @@

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 3
assignees:
- "clouddrove-ci"
reviewers:
- "approvers"

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "_example/" # Location of package manifests
directory: "/_example/" # Location of package manifests
schedule:
interval: "weekly"

# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3
14 changes: 14 additions & 0 deletions .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Assign PRs

on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
changelog:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.2.2
secrets: inherit
with:
branch: 'master'
79 changes: 0 additions & 79 deletions .github/workflows/terraform.yml

This file was deleted.

81 changes: 0 additions & 81 deletions .github/workflows/terratest.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
basic:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
with:
working_directory: './_example/'
11 changes: 11 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-lint
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
4 changes: 2 additions & 2 deletions .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
jobs:
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.2.2
secrets: inherit
with:
working_directory: '.'
working_directory: './_example'
14 changes: 12 additions & 2 deletions _example/example.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# ------------------------------------------------------------------------------
# Provider
# ------------------------------------------------------------------------------

provider "google" {
project = var.gcp_project_id
credentials = var.gcp_credentials
region = var.gcp_region
zone = var.gcp_zone
}

# ------------------------------------------------------------------------------
# Module
# ------------------------------------------------------------------------------


module "service-account" {
source = "../"

Expand All @@ -13,10 +22,11 @@ module "service-account" {
label_order = var.label_order

service_account_enabled = true
project_id = "clouddrove"
project_id = "clouddrove-1"
service_account_key_enabled = true
key_algorithm = "KEY_ALG_RSA_2048"
public_key_type = "TYPE_X509_PEM_FILE"
private_key_type = "TYPE_GOOGLE_CREDENTIALS_FILE"
members = []
roles = ["roles/iam.serviceAccountUser", "roles/editor"]
members = ["user:[email protected]", "user:[email protected]"]
}
4 changes: 4 additions & 0 deletions _example/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------

output "id" {
value = module.service-account.*.id
description = "The ID of the service-account."
Expand Down
4 changes: 4 additions & 0 deletions _example/varriables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ------------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------------

variable "environment" {
type = string
default = "service-account"
Expand Down
4 changes: 4 additions & 0 deletions _example/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ------------------------------------------------------------------------------
# Versions
# ------------------------------------------------------------------------------

terraform {
required_version = ">= 0.14, < 2.0"

Expand Down
14 changes: 12 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module "labels" {
environment = var.environment
label_order = var.label_order
}
# ------------------------------------------------------------------------------
# resource_to_create_service_account
# ------------------------------------------------------------------------------

resource "google_service_account" "default" {
count = var.service_account_enabled && var.module_enabled ? 1 : 0
Expand All @@ -15,6 +18,9 @@ resource "google_service_account" "default" {
description = var.description
project = var.project_id
}
# ------------------------------------------------------------------------------
# resource_to_create_service_account_key
# ------------------------------------------------------------------------------

resource "google_service_account_key" "default" {
count = var.service_account_key_enabled && var.module_enabled ? 1 : 0
Expand All @@ -26,11 +32,15 @@ resource "google_service_account_key" "default" {
public_key_data = var.public_key_data
keepers = var.keepers
}
# ------------------------------------------------------------------------------
# resource_to_create_service_account_iam_binding
# ------------------------------------------------------------------------------

resource "google_service_account_iam_binding" "admin-account-iam" {
count = var.google_service_account_iam_binding_enabled && var.module_enabled ? 1 : 0
count = var.google_service_account_iam_binding_enabled && var.module_enabled ? length(var.roles) : 0


service_account_id = join("", google_service_account.default.*.name)

Check warning on line 43 in main.tf

View workflow job for this annotation

GitHub Actions / tf-lint / tflint

List items should be accessed using square brackets
role = "roles/iam.serviceAccountUser"
role = var.roles[count.index]
members = var.members
}
3 changes: 3 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------

output "email" {
value = join("", google_service_account.default.*.email)

Check warning on line 6 in outputs.tf

View workflow job for this annotation

GitHub Actions / tf-lint / tflint

List items should be accessed using square brackets
Expand Down
Loading

0 comments on commit bf873c7

Please sign in to comment.