generated from telekom-mms/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring module, compare to template structure, add more examples (#1
) * Refactoring module, compare to template structure, add more examples, remove deprecated single mysql server configuration
- Loading branch information
1 parent
878cb42
commit a59d520
Showing
10 changed files
with
373 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
{ | ||
"repos": { | ||
"description": "A Terraform module that manages the tpl_resources resources from the azurerm provider.", | ||
"description": "A Terraform module that manages the database resources from the azurerm provider.", | ||
"visibility": "public", | ||
"default_branch": "main", | ||
"topics": [ | ||
"terraform", | ||
"azure" | ||
"azure", | ||
"mysql-flexible-server", | ||
"mysql-flexible-database", | ||
"mysql-flexible-server-firewall-rule" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +0,0 @@ | ||
# terraform-template | ||
|
||
This is a template for terraform modules. | ||
|
||
## Usage | ||
|
||
replace the following content from template | ||
|
||
`.github/settings.json` | ||
|
||
replace the following placeholder | ||
|
||
* tpl_resources | ||
|
||
```example | ||
tpl_resources = azurerm container | ||
``` | ||
|
||
`examples/*` | ||
|
||
replace the following placeholder | ||
|
||
* tpl_module | ||
* tpl_source | ||
* tpl_local_name | ||
* tpl_name | ||
|
||
```example | ||
tpl_module = container | ||
tpl_source = registry.terraform.io/telekom-mms/container/azurerm | ||
tpl_local_name = container_registry | ||
tpl_name = crmms | ||
``` | ||
|
||
`main.tf` | ||
|
||
replace the following placeholder | ||
|
||
* tpl_provider | ||
* tpl_module | ||
|
||
```example | ||
tpl_module = container | ||
tpl_provider = azurerm | ||
tpl_resource_type = azurerm_container_registry | ||
tpl_local_name = container_registry | ||
``` | ||
|
||
`outputs.tf` | ||
|
||
replace the following placeholder | ||
|
||
* tpl_resource_type | ||
* tpl_local_name | ||
|
||
```example | ||
tpl_resource_type = azurerm_container_registry | ||
tpl_local_name = container_registry | ||
``` | ||
|
||
`variables.tf` | ||
|
||
replace the following placeholder | ||
|
||
* tpl_local_name | ||
|
||
```example | ||
tpl_local_name = container_registry | ||
``` | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
# tpl_module | ||
|
||
This module manages the tpl_provider tpl_module resources. | ||
For more information see https://registry.terraform.io/providers/tpl_provider/latest/docs > tpl_module | ||
|
||
_<-- This file is autogenerated, please do not change. -->_ | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >=1.3 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| tpl | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [tpl_resource_type.tpl_local_name](https://registry.terraform.io/providers/hashicorp/tpl/latest/docs/resources/resource_type) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| tpl_local_name | Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs). | `any` | `{}` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| tpl_local_name | Outputs all attributes of resource_type. | | ||
| variables | Displays all configurable variables passed by the module. __default__ = predefined values per module. __merged__ = result of merging the default values and custom values passed to the module | | ||
|
||
## Examples | ||
|
||
Minimal configuration to install the desired resources with the module | ||
|
||
```hcl | ||
module "tpl_module" { | ||
source = "tpl_source" | ||
tpl_local_name = { | ||
tpl_name = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Advanced configuration to install the desired resources with the module | ||
|
||
```hcl | ||
module "tpl_module" { | ||
source = "tpl_source" | ||
tpl_local_name = { | ||
tpl_name = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
tags = { | ||
project = "mms-github" | ||
environment = terraform.workspace | ||
managed-by = "terraform" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
<!-- END_TF_DOCS --> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
module "tpl_module" { | ||
source = "tpl_source" | ||
tpl_local_name = { | ||
tpl_name = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
resource "random_password" "password" { | ||
for_each = toset(["mysql_root"]) | ||
|
||
length = 16 | ||
special = false | ||
} | ||
|
||
module "database" { | ||
source = "registry.terraform.io/telekom-mms/database/azurerm" | ||
mysql_flexible_server = { | ||
mysql-mms = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
administrator_login = "mysql_root" | ||
administrator_password = random_password.password["mysql_root"].result | ||
sku_name = "GP_Standard_D2ds_v4" | ||
} | ||
} | ||
mysql_flexible_server_configuration = { | ||
interactive_timeout = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
value = "600" | ||
} | ||
} | ||
mysql_flexible_database = { | ||
application = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
} | ||
} | ||
mysql_flexible_server_firewall_rule = { | ||
AzureServices = { | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
start_ip_address = cidrhost("0.0.0.0/32", 0) | ||
end_ip_address = cidrhost("0.0.0.0/32", -1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,54 @@ | ||
module "tpl_module" { | ||
source = "tpl_source" | ||
tpl_local_name = { | ||
tpl_name = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
resource "random_password" "password" { | ||
for_each = toset(["mysql_root"]) | ||
|
||
length = 16 | ||
special = false | ||
} | ||
|
||
module "database" { | ||
source = "registry.terraform.io/telekom-mms/database/azurerm" | ||
mysql_flexible_server = { | ||
mysql-mms = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
administrator_login = "mysql_root" | ||
administrator_password = random_password.password["mysql_root"].result | ||
sku_name = "GP_Standard_D2ds_v4" | ||
version = "8.0.21" | ||
zone = "1" | ||
storage = { | ||
size_gb = 20 | ||
} | ||
high_availability = terraform.workspace != "prod" ? {} : { | ||
mode = "ZoneRedundant" | ||
standby_availability_zone = 2 | ||
} | ||
tags = { | ||
project = "mms-github" | ||
environment = terraform.workspace | ||
managed-by = "terraform" | ||
} | ||
} | ||
} | ||
mysql_flexible_server_configuration = { | ||
interactive_timeout = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
value = "600" | ||
} | ||
} | ||
mysql_flexible_database = { | ||
application = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
} | ||
} | ||
mysql_flexible_server_firewall_rule = { | ||
AzureServices = { | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
start_ip_address = cidrhost("0.0.0.0/32", 0) | ||
end_ip_address = cidrhost("0.0.0.0/32", -1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
module "tpl_module" { | ||
source = "tpl_source" | ||
tpl_local_name = { | ||
tpl_name = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
resource "random_password" "password" { | ||
for_each = toset(["mysql_root"]) | ||
|
||
length = 16 | ||
special = false | ||
} | ||
|
||
module "database" { | ||
source = "registry.terraform.io/telekom-mms/database/azurerm" | ||
mysql_flexible_server = { | ||
mysql-mms = { | ||
location = "westeurope" | ||
resource_group_name = "rg-mms-github" | ||
administrator_login = "mysql_root" | ||
administrator_password = random_password.password["mysql_root"].result | ||
sku_name = "GP_Standard_D2ds_v4" | ||
} | ||
} | ||
mysql_flexible_server_configuration = { | ||
interactive_timeout = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
value = "600" | ||
} | ||
} | ||
mysql_flexible_database = { | ||
application = { | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
} | ||
} | ||
mysql_flexible_server_firewall_rule = { | ||
AzureServices = { | ||
server_name = module.database.mysql_flexible_server["mysql-mms"].name | ||
resource_group_name = module.database.mysql_flexible_server["mysql-mms"].resource_group_name | ||
start_ip_address = cidrhost("0.0.0.0/32", 0) | ||
end_ip_address = cidrhost("0.0.0.0/32", -1) | ||
} | ||
} | ||
} |
Oops, something went wrong.