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

fix:update azurerm version #41

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 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
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/auto_assignee.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
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@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'complete-example / Check code format'
...
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
secrets: inherit
with:
branch: 'master'
branch: 'master'
30 changes: 0 additions & 30 deletions .github/workflows/semantic-releaser.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/static-checks.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
secrets: inherit
with:
working_directory: './examples/complete/'

basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
secrets: inherit
with:
working_directory: './examples/basic/'

mysql-flexible-server-replication-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
secrets: inherit
with:
working_directory: './examples/mysql-flexible-server-replication/'
12 changes: 12 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

name: tf-lint
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
2 changes: 1 addition & 1 deletion .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
secrets: inherit
with:
working_directory: '.'
working_directory: '.'
25 changes: 22 additions & 3 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Run `make readme` to rebuild the `README.md`
#


# Name of this project
name: Terraform AZURE FLEXIBLE MYSQL

Expand All @@ -19,20 +18,40 @@ badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v1.1.7-green"
url: "https://www.terraform.io"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-azure-log-analytics/actions/workflows/tfsec.yml/badge.svg"
vjdbj marked this conversation as resolved.
Show resolved Hide resolved
url: "https://github.com/clouddrove/terraform-azure-log-analytics/actions/workflows/tfsec.yml"
vjdbj marked this conversation as resolved.
Show resolved Hide resolved
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"

# Prerequesties to display
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.7.8"

providers:
- name: azure
url: https://azure.microsoft.com/
version: ">= 3.39.0"

module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-azure-labels
description: Provides resource tagging.

# description of this project
description: |-
Terraform module to create flexible-mysql resource on AZURE.

# extra content
include:
- "terraform.md"

# How to use this project
# yamllint disable rule:line-length
usage: |-
### Simple Example
Here is an example of how you can use this module in your inventory structure:
Expand Down
1 change: 0 additions & 1 deletion examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module "flexible-mysql" {
virtual_network_id = "/subscriptions/---------------<vnet_id>---------------"
delegated_subnet_id = "/subscriptions/---------------<delegated_subnet_id>---------------"
mysql_version = "8.0.21"
mysql_server_name = "testmysqlserver"
private_dns = true
zone = "1"
admin_username = "mysqlusername"
Expand Down
5 changes: 3 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
provider "azurerm" {
features {}
subscription_id = "000000-11111-1223-XXX-XXXXXXXXXXXX"
}

locals {
Expand Down Expand Up @@ -65,7 +66,7 @@ module "subnet" {
##-----------------------------------------------------------------------------
module "log-analytics" {
source = "clouddrove/log-analytics/azure"
version = "1.0.1"
version = "1.1.0"
name = local.name
environment = local.environment
label_order = local.label_order
Expand All @@ -77,6 +78,7 @@ module "log-analytics" {
internet_query_enabled = true
resource_group_name = module.resource_group.resource_group_name
log_analytics_workspace_location = module.resource_group.resource_group_location
log_analytics_workspace_id = module.log-analytics.workspace_id
}

##-----------------------------------------------------------------------------
Expand All @@ -92,7 +94,6 @@ module "flexible-mysql" {
virtual_network_id = module.vnet.vnet_id[0]
delegated_subnet_id = module.subnet.default_subnet_id[0]
mysql_version = "8.0.21"
mysql_server_name = "testmysqlserver"
private_dns = true
zone = "1"
admin_username = "mysqlusername"
Expand Down
6 changes: 5 additions & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.112.0"
version = ">=3.112.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.1"
vjdbj marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
3 changes: 1 addition & 2 deletions examples/mysql-flexible-server-replication/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ data "azurerm_private_dns_zone" "main" {
##-----------------------------------------------------------------------------
module "flexible-mysql" {
depends_on = [module.resource_group, module.vnet, data.azurerm_resource_group.main]
source = "clouddrove/flexible-mysql/azure"
source = "../../"
name = local.name
environment = local.environment
main_rg_name = data.azurerm_resource_group.main.name
Expand All @@ -92,7 +92,6 @@ module "flexible-mysql" {
virtual_network_id = module.vnet.vnet_id[0]
delegated_subnet_id = module.subnet.default_subnet_id[0]
mysql_version = "8.0.21"
mysql_server_name = "testmysqlserver"
zone = "1"
admin_username = "mysqlusern"
admin_password = "ba5yatgfgfhdsvvc6A3ns2lu4gqzzc"
Expand Down
19 changes: 4 additions & 15 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
##-----------------------------------------------------------------------------
## Vritual Network and Subnet Creation
##-----------------------------------------------------------------------------
data "azurerm_client_config" "current" {}

##-----------------------------------------------------------------------------
## Locals Declaration
##-----------------------------------------------------------------------------
locals {
resource_group_name = var.resource_group_name
location = var.location
}

##-----------------------------------------------------------------------------
Expand Down Expand Up @@ -51,7 +49,7 @@ resource "azurerm_mysql_flexible_server" "main" {
administrator_password = var.admin_password == null ? random_password.main[0].result : var.admin_password
backup_retention_days = var.backup_retention_days
delegated_subnet_id = var.delegated_subnet_id
private_dns_zone_id = var.private_dns ? join("", azurerm_private_dns_zone.main.*.id) : var.existing_private_dns_zone_id
private_dns_zone_id = var.private_dns ? azurerm_private_dns_zone.main[0].id : var.existing_private_dns_zone_id
sku_name = var.sku_name
create_mode = var.create_mode
geo_redundant_backup_enabled = var.geo_redundant_backup_enabled
Expand Down Expand Up @@ -88,7 +86,7 @@ resource "azurerm_mysql_flexible_database" "main" {
count = var.enabled ? 1 : 0
name = var.db_name
resource_group_name = local.resource_group_name
server_name = join("", azurerm_mysql_flexible_server.main.*.name)
server_name = azurerm_mysql_flexible_server.main[0].name
charset = var.charset
collation = var.collation
depends_on = [azurerm_mysql_flexible_server.main]
Expand All @@ -102,19 +100,10 @@ resource "azurerm_mysql_flexible_server_configuration" "main" {
count = var.enabled ? length(var.server_configuration_names) : 0
name = element(var.server_configuration_names, count.index)
resource_group_name = local.resource_group_name
server_name = join("", azurerm_mysql_flexible_server.main.*.name)
server_name = azurerm_mysql_flexible_server.main[0].name
value = element(var.values, count.index)
}

##------------------------------------------------------------------------
## Manages a Customer Managed Key for a MySQL Server. - Default is "false"
##------------------------------------------------------------------------
resource "azurerm_mysql_server_key" "main" {
vjdbj marked this conversation as resolved.
Show resolved Hide resolved
count = var.enabled && var.key_vault_key_id != null ? 1 : 0
server_id = join("", azurerm_mysql_flexible_server.main.*.id)
key_vault_key_id = var.key_vault_key_id
}

##-----------------------------------------------------------------------------
## Below resource will deploy private dns for flexible mysql server.
##-----------------------------------------------------------------------------
Expand All @@ -131,7 +120,7 @@ resource "azurerm_private_dns_zone" "main" {
resource "azurerm_private_dns_zone_virtual_network_link" "main" {
count = var.enabled && var.private_dns ? 1 : 0
name = format("mysql-endpoint-link-%s", module.labels.id)
private_dns_zone_name = join("", azurerm_private_dns_zone.main.*.name)
private_dns_zone_name = azurerm_private_dns_zone.main[0].name
virtual_network_id = var.virtual_network_id
resource_group_name = local.resource_group_name
registration_enabled = var.registration_enabled
Expand Down
Loading