-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from devwithkrishna/feature/tf-module-for-api-mgmt
Feature/tf module for api mgmt
- Loading branch information
Showing
7 changed files
with
198 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Generate terraform docs | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
generate-terraform-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Render terraform docs and push changes back to PR | ||
uses: terraform-docs/gh-actions@main | ||
with: | ||
recursive: true | ||
config-file: .terraform-docs.yml | ||
output-file: README.md | ||
output-method: inject | ||
git-push: "true" |
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
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
formatter: "markdown table" # this is required | ||
version: "0.18" | ||
header-from: main.tf | ||
footer-from: "" | ||
recursive: | ||
enabled: true | ||
path: "." | ||
# - "api-management" | ||
recursive-include-main: false | ||
# enabled: false | ||
sections: | ||
hide: [] | ||
show: [] | ||
hide-all: false # deprecated in v0.13.0, removed in v0.15.0 | ||
show-all: true # deprecated in v0.13.0, removed in v0.15.0 | ||
content: |- | ||
{{ .Requirements }} | ||
## Usage | ||
Basic usage of this module is as follows: | ||
```hcl | ||
module "example" { | ||
{{"\t"}} source = "<module-path>" | ||
{{- if .Module.RequiredInputs }} | ||
{{"\n\t"}} # Required variables | ||
{{- range .Module.RequiredInputs }} | ||
{{"\t"}} {{ .Name }} = {{ .GetValue }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Module.OptionalInputs }} | ||
{{"\n\t"}} # Optional variables | ||
{{- range .Module.OptionalInputs }} | ||
{{"\t"}} {{ .Name }} = {{ .GetValue | printf "%s" }} | ||
{{- end }} | ||
{{- end }} | ||
} | ||
```` | ||
{{ .Resources }} | ||
{{ .Inputs }} | ||
{{ .Outputs }} | ||
output: | ||
file: README.md | ||
mode: inject | ||
template: |- | ||
<!-- BEGIN_AUTOMATED_TF_DOCS_BLOCK --> | ||
{{ .Content }} | ||
<!-- END_AUTOMATED_TF_DOCS_BLOCK --> | ||
output-values: | ||
enabled: false | ||
from: "" | ||
sort: | ||
enabled: true | ||
by: name | ||
settings: | ||
anchor: true | ||
color: true | ||
default: false | ||
description: true | ||
escape: false | ||
hide-empty: false | ||
html: false | ||
indent: 2 | ||
lockfile: true | ||
read-comments: true | ||
required: true | ||
sensitive: true | ||
type: true | ||
pretty: true |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "azurerm_resource_group" "rg" { | ||
name = var.resource_group_name | ||
location = var.location | ||
} | ||
|
||
resource "azurerm_api_management" "apim" { | ||
name = var.api_management_name | ||
location = var.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
publisher_name = tostring(var.publisher_name) | ||
publisher_email = tostring(var.publisher_email) | ||
|
||
sku_name = "${var.sku_name_part1}_${var.sku_name_part2}" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
output "azure_resource_group_name" { | ||
description = "Azure resource group name" | ||
value = azurerm_resource_group.rg.name | ||
} | ||
|
||
output "azure_api_management_name" { | ||
description = "Azure API management name" | ||
value = azurerm_api_management.apim.name | ||
} | ||
|
||
output "azure_api_management_location" { | ||
description = "Azure API management location" | ||
value = azurerm_api_management.apim.location | ||
} | ||
|
||
output "azure_api_management_publisher_name" { | ||
description = "Azure API management" | ||
value = azurerm_api_management.apim.publisher_name | ||
} | ||
|
||
output "azure_api_management_publisher_emailids" { | ||
description = "Azure API management publisher emails" | ||
value = azurerm_api_management.apim.publisher_email | ||
} | ||
|
||
output "azure_api_management_sku" { | ||
description = "Azure API management SKU" | ||
value = azurerm_api_management.apim.sku_name | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
variable "resource_group_name" { | ||
type = string | ||
description = "Azure Storage Account Rg" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Azure storage account location" | ||
} | ||
|
||
variable "api_management_name" { | ||
description = "Azure api management name" | ||
type = string | ||
} | ||
|
||
variable "publisher_name" { | ||
description = "Publisher of API" | ||
type = list(string) | ||
validation { | ||
condition = can(index(var.publisher_name, 0)) | ||
error_message = "A value is required for Publisher name." | ||
} | ||
} | ||
|
||
variable "publisher_email" { | ||
description = "Email ID of API publishers" | ||
type = list(string) | ||
validation { | ||
condition = can(index(var.publisher_email, 0)) | ||
error_message = "At least one Publisher email is required." | ||
} | ||
} | ||
|
||
variable "sku_name_part1" { | ||
description = "SKU name of API management " | ||
type = string | ||
validation { | ||
condition = contains(["Consumption","Developer","Basic","Standard", "Premium"], var.sku_name_part1) | ||
error_message = "SKU name should be one among Consumption, Developer,Basic,Standard,Premium." | ||
} | ||
} | ||
|
||
variable "sku_name_part2" { | ||
description = "Sku capacity part" | ||
type = string | ||
} |
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,27 +1,34 @@ | ||
output "azurerm_resource_group" { | ||
description = "Azure resource group name" | ||
value = azurerm_resource_group.storage_rg.name | ||
} | ||
|
||
output "storage_account_name" { | ||
description = "Azure storage account name" | ||
value = azurerm_storage_account.storage.name | ||
} | ||
|
||
output "storage_account_location" { | ||
description = "Azure storage account location" | ||
value = azurerm_storage_account.storage.location | ||
} | ||
|
||
output "storage_account_delete_retention_policy" { | ||
description = "Azure blob retention policy" | ||
value = azurerm_storage_account.storage.blob_properties[0].delete_retention_policy | ||
} | ||
|
||
output "storage_account_tier" { | ||
description = "Azure storage account tier" | ||
value = azurerm_storage_account.storage.access_tier | ||
} | ||
|
||
output "storage_account_replication_type" { | ||
description = "Azure storage account replication type" | ||
value = azurerm_storage_account.storage.account_replication_type | ||
} | ||
|
||
output "storage_account_tags" { | ||
description = "Azure storage account tags" | ||
value = azurerm_storage_account.storage.tags | ||
} |