Skip to content

Commit

Permalink
major: VAC-000 allow to provide collection name
Browse files Browse the repository at this point in the history
major: VAC-000 allow to provide collection name
  • Loading branch information
robgutsopedra committed Mar 1, 2024
2 parents eb4db07 + 01a2f34 commit ba50045
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ on:

jobs:
lint_pr_title:
uses: ultimateai/workflows/.github/workflows/lint-pr.yml@0.15.0
secrets: inherit
with:
subjectPattern: ([-a-zA-Z0-9]{2,5}[/-]{1}[0-9]+.*) # PR Title example: minor: PLT-239 description. This subject pattern enforces the existance of a Jira issue after the type_word.
subjectPatternError: 'The subject "{subject}" found in the pull request title "{title}" did not match the configured pattern. Please start with the jira issue which originated your work - like feat(scope): PLT-000 additional info'
requireScope: false
allowed_types: |
fix
feat
breaking
minor
major
patch
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
subjectPattern: ([-a-zA-Z0-9]{2,5}[/-]{1}[0-9]+.*)
subjectPatternError: 'The subject "{subject}" found in the pull request title "{title}" did not match the configured pattern. Please start with the jira issue which originated your work - like feat(scope): PLT-000 additional info'
requireScope: false
types: |
fix
feat
breaking
minor
major
patch
8 changes: 3 additions & 5 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 0.15.5
terraform_version: ">=1.3.0"
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Terraform Format
Expand All @@ -31,5 +31,3 @@ jobs:
- name: Terraform Validate
id: validate
run: terraform validate -no-color


9 changes: 4 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ resource "mongodbatlas_database_user" "mongo_user" {
dynamic "roles" {
for_each = var.databases_roles
content {
role_name = roles.value.role
database_name = roles.value.database
role_name = roles.value.role
database_name = roles.value.database
collection_name = try(roles.value.collection, null)
}

}
}


resource "vault_generic_secret" "vault_secret" {
path = "${var.vault_path}-mongo-credentials"
data_json = <<EOT
Expand All @@ -28,4 +27,4 @@ EOT
resource "random_password" "mongo_password" {
length = 16
special = false
}
}
9 changes: 3 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ variable "user_name" {
variable "databases_roles" {
description = "List of databases this user needs access to"
type = list(object({
database = string
role = string
database = string
collection = optional(string)
role = string
}))
}


variable "vault_path" {
description = "Vault's secret path"
type = string
Expand All @@ -21,6 +21,3 @@ variable "mongo_project_id" {
description = "Mongo project ID"
type = string
}



3 changes: 2 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">=1.3.0"

required_providers {
mongodbatlas = {
Expand All @@ -8,4 +9,4 @@ terraform {
source = "hashicorp/vault"
}
}
}
}

0 comments on commit ba50045

Please sign in to comment.