diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..5a3a19d --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,19 @@ +name: Generate terraform docs +on: + - pull_request +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + - name: Render terraform docs inside the README.md and push changes back to PR branch + uses: terraform-docs/gh-actions@v1.0.0 + with: + github-token: ${{ secrets.GH_TOKEN }} + working-dir: . + output-file: README.md + output-method: replace + config-file: .terraform-docs.yml + git-push: "true" diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..db9c29e --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,40 @@ +# .terraform-docs.yaml +formatter: toml # this is required + +version: "" + +header-from: main.tf +footer-from: "variables.tf" + + +content: "" + +output: + file: README.md # output-file + mode: replace + template: |- + + {{ .Content }} + + +output-values: + enabled: false + from: "" + +sort: + enabled: true + by: name + +settings: + anchor: true + color: true + default: true + description: false + escape: true + hide-empty: true + html: true + indent: 4 + lockfile: true + required: true + sensitive: true + type: true diff --git a/README.md b/README.md index dfe5938..31de987 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,27 @@ -## Requirements +#### Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.6.4 | -| [azurerm](#requirement\_azurerm) | 3.94.0 | +| [azurerm](#requirement\_azurerm) | 3.100.0 | -## Providers +#### Providers | Name | Version | |------|---------| -| [azurerm](#provider\_azurerm) | 3.94.0 | +| [azurerm](#provider\_azurerm) | 3.100.0 | -## Modules - -No modules. - -## Resources +#### Resources | Name | Type | |------|------| -| [azurerm_mssql_firewall_rule.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.94.0/docs/resources/mssql_firewall_rule) | resource | -| [azurerm_mssql_server.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.94.0/docs/resources/mssql_server) | resource | -| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/3.94.0/docs/data-sources/client_config) | data source | -| [azurerm_resource_group.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.94.0/docs/data-sources/resource_group) | data source | +| [azurerm_mssql_firewall_rule.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.100.0/docs/resources/mssql_firewall_rule) | resource | +| [azurerm_mssql_server.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.100.0/docs/resources/mssql_server) | resource | +| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/3.100.0/docs/data-sources/client_config) | data source | +| [azurerm_resource_group.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.100.0/docs/data-sources/resource_group) | data source | -## Inputs +#### Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| @@ -46,7 +42,7 @@ No modules. | [resource\_group\_location](#input\_resource\_group\_location) | Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. | `string` | `"West Europe"` | no | | [resource\_group\_name](#input\_resource\_group\_name) | The name of the resource group in which to create the Microsoft SQL Server. Changing this forces a new resource to be created. | `string` | n/a | yes | -## Outputs +#### Outputs | Name | Description | |------|-------------| diff --git a/backend.tf b/backend.tf index 7f32883..ade662d 100644 --- a/backend.tf +++ b/backend.tf @@ -1,9 +1,9 @@ terraform { required_providers { azurerm = { - source = "hashicorp/azurerm" - version = "3.94.0" + source = "hashicorp/azurerm" + version = "3.100.0" } } required_version = ">= 1.6.4" -} \ No newline at end of file +} diff --git a/examples/mssql-server/README.md b/examples/mssql-server/README.md deleted file mode 100644 index 3a99b0c..0000000 --- a/examples/mssql-server/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Terraform Module: Azure SQL Server - -This Terraform module creates a Microsoft SQL Server instance in Azure, along with necessary configurations such as firewall rules. - -## Prerequisites - -- Terraform installed on your local machine -- Azure subscription -- Azure CLI installed (for authentication) - -## Usage - -### Example - -```hcl -provider "azurerm" { -features {} -} - -module "application_insight" { - source = "Think-Cube/mssql-server/azure" - version = "1.0.0" - resource_group_name = "dev-test-weu-rg" - resource_group_location = "West Europe" - application_insights_type = "web" - environment = "dev" - region = "weu" - mssql_server_name = "examplemssql" - mssql_server_version = "12.0" - mssql_server_admin_login = "mssqladministrator" - mssql_server_admin_password = "P@ssw0rd_123" - mssql_server_minimum_tls_version = "1.2" - mssql_server_public_network_access_enabled = true - mssql_server_connection_policy = "Default" - mssql_server_azure_ad_admin_login = "mssqladministrator@domain.com" - mssql_server_azure_ad_admin_object_id = "" - mssql_server_azure_tenant_id = "" - mssql_server_ip_rules = { - "rule-01" = "10.10.1.0/24" - } - default_tags = { - Administrator = "John Doe" - Department = "IT" - CostCentre = "CC123" - ContactPerson = "Jane Smith" - ManagedByTerraform = "True" -} -} -``` - -### Variables - -- `resource_group_name`: Name of the resource group. -- `mssql_server_name`: Name of the SQL Server instance. -- `environment`: Name of the environment. -- `region`: Azure region where resources will be provisioned. -- `mssql_server_ip_rules`: Map of IP addresses permitted for access to the database. -- `mssql_server_version`: Version for the new server. -- `mssql_server_admin_login`: Administrator login name. -- `mssql_server_admin_password`: Password associated with the admin login. -- `mssql_server_minimum_tls_version`: Minimum TLS Version for SQL databases. -- `mssql_server_public_network_access_enabled`: Public network access allowed. -- `mssql_server_connection_policy`: Connection policy for the server. -- `mssql_server_azure_ad_admin_login`: Azure AD admin login username. -- `mssql_server_azure_ad_admin_object_id`: Azure AD admin object ID. -- `mssql_server_azure_tenant_id`: Tenant ID of the Azure AD administrator. - -### Outputs - -- `sql_server_id`: The Microsoft SQL Server ID -- `sql_server_name`: Azure SQL Server Name -- `sql_server_fqdn`: Fully qualified domain name of the SQL Server -- `sql_server_identity`: Identity properties assigned to Azure SQL Server - -## License - -This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). - -## Contribution - -Feel free to contribute by opening issues or pull requests. Your feedback and improvements are highly appreciated! diff --git a/examples/mssql-server/main.tf b/examples/mssql-server/main.tf index 90b71a9..78c2ee1 100644 --- a/examples/mssql-server/main.tf +++ b/examples/mssql-server/main.tf @@ -2,12 +2,11 @@ provider "azurerm" { features {} } -module "application_insight" { +module "mssql_server" { source = "Think-Cube/mssql-server/azure" version = "1.0.0" resource_group_name = "dev-test-weu-rg" resource_group_location = "West Europe" - application_insights_type = "web" environment = "dev" region = "weu" mssql_server_name = "examplemssql" @@ -30,4 +29,4 @@ module "application_insight" { ContactPerson = "Jane Smith" ManagedByTerraform = "True" } -} \ No newline at end of file +}