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

module code added #3

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 6 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# These owners will be the default owners for everything in the repo.
* @anmolnagpal @clouddrove/approvers @clouddrove-ci
.github/* @clouddrove/approvers

* @clouddrove/clouddrovians @clouddrove/approvers

.github/mergify.yml @clouddrove/admins
.github/CODEOWNERS @clouddrove/admins
17 changes: 15 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ updates:
interval: "daily"
open-pull-requests-limit: 3
assignees:
- "clouddrove-ci"
- "clouddrove-ci"
reviewers:
- "approvers"
- "approvers"

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/" # Location of package manifests
Expand Down Expand Up @@ -54,3 +54,16 @@ updates:
- "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/vnet_with_existing_ddos_id" # 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
2 changes: 1 addition & 1 deletion .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.2.1
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Auto merge
on:
pull_request:
jobs:
auto-merge:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@1.2.1
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'basic-example / Check code format'
...
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.1
secrets: inherit
with:
branch: 'master'
5 changes: 2 additions & 3 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
- master

jobs:
readme:
readme-create:
name: 'readme-create'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master

- name: 'Set up Python 3.7'
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -25,7 +25,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: 'pre-commit check errors'
uses: pre-commit/action@v3.0.0
continue-on-error: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
name: tf-lint
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tflint:
uses: clouddrove/test-tfsec/.github/workflows/tflint.yaml@1.0.6
secrets:
GITHUB: ${{ secrets.GITHUB }}
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.0.6
secrets: inherit
basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.2.1
with:
working_directory: '.'
tf-checks-complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.6
working_directory: './_examples/basic/'

complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.2.1
with:
working_directory: './_examples/complete/'
tf-checks-basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.6

pgsql-public:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.2.1
with:
working_directory: './_examples/basic/'
working_directory: './_examples/pgsql-public/'

pgsql-server-replication:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.2.1
with:
working_directory: './_examples/pgsql-server-replication/'
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/tf-lint.yml@1.2.1
secrets:
GITHUB: ${{ secrets.GITHUB }}
11 changes: 11 additions & 0 deletions .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tfsec
permissions: write-all
on:
pull_request:
workflow_dispatch:
jobs:
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.2.1
secrets: inherit
with:
working_directory: '.'
12 changes: 12 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}
178 changes: 163 additions & 15 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,188 @@
#

# Name of this project
name : Terraform Module Template
name: Terraform AZURE flexible-postgresql

# License of this project
license: "APACHE"

# Canonical GitHub repo
github_repo: clouddrove/terraform-module-template
github_repo: clouddrove/terraform-azure-flexible-postgresql

# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-module-template.svg"
url: "https://github.com/clouddrove/terraform-module-template/releases/latest"
image: "https://img.shields.io/github/release/clouddrove/terraform-azure-flexible-postgresql.svg"
url: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-module-template/actions/workflows/tfsec.yml/badge.svg"
url: ""
image: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"

prerequesties:
- name: Terraform 1.4.6
url: https://learn.hashicorp.com/terraform/getting-started/install.html

# description of this project
description: |-
Terraform module template to create new modules using this as baseline
Terraform module to create VIRTUAL-NETWORK resource on AZURE.

# extra content
include:
- "terraform.md"

# How to use this project
# How to use this project
# yamllint disable rule:line-length
usage: |-
Here are some examples of how you can use this module in your inventory structure:
```hcl
```
### Basic Example
```hcl
module "flexible-postgresql" {
source = "../.."
name = "app"
resource_group_name = "test"
location = "Canada Central"

#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"

#**************************private server*********************************
#(Resources to recreate when changing private to public cluster or vise-versa )
virtual_network_id = ""
private_dns = false
delegated_subnet_id = null

#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
enable_diagnostic = false
log_analytics_workspace_id = "/subscription/***************"

#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = false
key_vault_id = "/subscription/***************"
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}

```
### Complete Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group, module.vnet]
source = "../.."
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location

#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"

#**************************private server*********************************
#(Resources to recreate when changing private to public cluster or vise-versa )
virtual_network_id = module.vnet.vnet_id
private_dns = true
delegated_subnet_id = module.subnet.default_subnet_id[0]

#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
log_analytics_workspace_id = module.log-analytics.workspace_id

#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = true
key_vault_id = module.vault.id
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}

```
### flexible-pgsql-public Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group]
source = "../.."
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location

#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"

#**************************Public server*********************************
allowed_cidrs = {
"allowed_all_ip" = "0.0.0.0/0"
"allowed_specific_ip" = "11.32.16.78/32"
}

#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
log_analytics_workspace_id = module.log-analytics.workspace_id

#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = true
key_vault_id = module.vault.id
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}
```
### pgsql-server-replication Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group, module.vnet, data.azurerm_resource_group.main]
source = "../.."
name = "app"
environment = "test2"
label_order = ["name", "environment"]
main_rg_name = data.azurerm_resource_group.main.name
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_id = module.vnet.vnet_id[0]
delegated_subnet_id = module.subnet.default_subnet_id[0]
postgresql_version = "12"
zone = "1"
admin_username = "postgresqlusern"
admin_password = "ba5yatgfgfhdsvvc6A3ns2lu4gqzzc"
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
charset = "utf8"
collation = "en_US.utf8"
existing_private_dns_zone = true
existing_private_dns_zone_id = data.azurerm_private_dns_zone.main.id
existing_private_dns_zone_name = data.azurerm_private_dns_zone.main.name
}
```
3 changes: 0 additions & 3 deletions _examples/basic/README.md

This file was deleted.

Loading
Loading