diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..fe37cf9 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,22 @@ +name: Generate terraform docs +on: + pull_request: + branches: + - main + - master + +jobs: + AutogenerateTerraformRepoDocs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + 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: + working-dir: . + output-file: README.md + output-method: inject + git-push: "true" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a8a23a..d66171f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,9 +4,6 @@ repos: hooks: - id: terraform_fmt - id: terraform_validate - - id: terraform_docs - args: - - '--args=--lockfile=false' - id: terraform_tflint args: - '--args=--only=terraform_deprecated_interpolation' diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..a62f4e4 --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,48 @@ +formatter: "markdown table" # this is required + +version: "" + +header-from: "main.tf" +footer-from: "" + +recursive: + enabled: false + path: modules + +sections: + hide: [] + show: [] + +content: "" + +# see: https://terraform-docs.io/user-guide/configuration/output +output: + file: README.md + mode: inject + 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: false + html: true + indent: 2 + lockfile: true + read-comments: true + required: true + sensitive: true + type: true diff --git a/README.md b/README.md index cd159e8..3fe987e 100644 --- a/README.md +++ b/README.md @@ -64,48 +64,47 @@ module "automation-runbook" { ## Requirements -| Name | Version | -| ---------------------------------------------------------------------------- | --------- | -| [terraform](#requirement\_terraform) | >= 1.0.0 | -| [azurerm](#requirement\_azurerm) | >= 3.40.0 | +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [azurerm](#requirement\_azurerm) | >= 3.40.0 | ## Providers -| Name | Version | -| ---------------------------------------------------------------------- | ------- | -| [azurerm](#provider\_azurerm) | 3.40.0 | +| Name | Version | +|------|---------| +| [azurerm](#provider\_azurerm) | >= 3.40.0 | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [resource\_group](#input\_resource\_group)| The name of the resource group | `string` | n/a | yes | -| [location](#input\_location)| Azure location | `string` | n/a | yes | -| [automation\_account\_name](#input\_automation\_account\_name)| Automation Account name. | `string` | n/a | yes | -| [runbook](#input\_runbook)| Objects with parameters to configure Runbook |
object({| n/a | no | -| [schedules](#input\_schedules)| Set of objects with parameters to configure Schedules for Runbook. |
name = optional(string),
description = optional(string),
script_path = optional(string),
content = optional(string),
log_verbose = optional(bool, true),
log_progress = optional(bool, true),
runbook_type = optional(string, "PowerShellWorkflow")
})
set(object({| [] | no | - ## Modules No modules. ## Resources -| Name | Type | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -| [azurerm_automation_runbook.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_runbook) | resource | -| [azurerm_automation_schedule.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_schedule) | resource | -| [azurerm_automation_job_schedule.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_job_schedule) | resource | +| Name | Type | +|------|------| +| [azurerm_automation_job_schedule.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_job_schedule) | resource | +| [azurerm_automation_runbook.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_runbook) | resource | +| [azurerm_automation_schedule.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_schedule) | resource | +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [automation\_account\_name](#input\_automation\_account\_name) | Automation Account name | `string` | n/a | yes | +| [location](#input\_location) | Azure location | `string` | n/a | yes | +| [resource\_group](#input\_resource\_group) | Resource group name where Automation Account is located | `string` | n/a | yes | +| [runbook](#input\_runbook) | Objects with parameters to configure Runbook |
name = optional(string),
description = optional(string),
frequency = optional(string, "Week"),
interval = optional(string, "1"),
start_time = optional(string, null),
week_days = optional(list(string), ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]),
parameters = optional(any, {})
}))
object({| n/a | yes | +| [schedules](#input\_schedules) | Set of objects with parameters to configure Schedules for Runbook |
name = optional(string),
description = optional(string),
script_path = optional(string),
content = optional(string)
log_verbose = optional(bool, true),
log_progress = optional(bool, true),
runbook_type = optional(string, "PowerShellWorkflow")
})
set(object({| `[]` | no | +| [tags](#input\_tags) | Resource tags | `map(any)` | `{}` | no | ## Outputs -| Name | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| Name | Description | +|------|-------------| | [runbook\_id](#output\_runbook\_id) | Automation Runbook Id | ## License -Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm-automation-runbook/blob/main/LICENSE) +Apache 2 Licensed. For more information please see [LICENSE](./LICENSE)
name = optional(string),
description = optional(string),
frequency = optional(string, "Week"),
interval = optional(string, "1"),
start_time = optional(string, null),
week_days = optional(list(string), ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"])
parameters = optional(any, {})
}))