Skip to content

Commit

Permalink
feat: provide Makefile, terraform-docs action, release-please action (#3
Browse files Browse the repository at this point in the history
)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
wood-push-melon and github-actions[bot] committed Jul 14, 2023
1 parent 22e13bd commit d5fa08a
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/documentation.yaml
@@ -0,0 +1,20 @@
name: Render Terraform Docs
on:
workflow_call:

jobs:
terraform-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:
config-file: .terraform-docs.yml
working-dir: .
output-file: MODULE_SPECS.md
output-method: inject
git-push: "true"
8 changes: 7 additions & 1 deletion .github/workflows/pull_request.yaml
Expand Up @@ -5,6 +5,7 @@

jobs:
build:
name: Terraform Checks and Plans
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -15,7 +16,7 @@

- name: Terraform Format
id: fmt
run: terraform fmt -check
run: terraform fmt -recursive -check
continue-on-error: true

- name: Terraform Init
Expand Down Expand Up @@ -95,3 +96,8 @@
body: output
})
}
documentation:
name: Render Terraform Docs
needs: build
uses: ./.github/workflows/documentation.yaml
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
@@ -0,0 +1,21 @@
name: Release Terraform Module

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: terraform-module
default-branch: main
pull-request-title-pattern: "ci: release ${version}"
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -57,6 +57,10 @@ $ pre-commit install
$ pre-commit run <hook>
```

## Documentation
## Commits Convention

TBD.
Please follow
the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) to
create commit messages. This facilitates the usage of the
[Release Please Action](https://github.com/google-github-actions/release-please-action)
for automated releases of the Terraform module.
32 changes: 32 additions & 0 deletions MODULE_SPECS.md
@@ -0,0 +1,32 @@
# Terraform Module Specifications

This documentation shows the detailed specifications of the IAM bundle
Terraform module.

<!-- BEGIN_TF_DOCS -->
## Providers

| Name | Version |
|------|---------|
| <a name="provider_juju"></a> [juju](#provider\_juju) | 0.8.0 |
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.0 |
| <a name="requirement_juju"></a> [juju](#requirement\_juju) | ~> 0.8.0 |
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_model"></a> [model](#input\_model) | The name of the Juju model to deploy to. | `string` | `"iam-bundle"` | no |
| <a name="input_cloud"></a> [cloud](#input\_cloud) | The Juju cloud information. | <pre>object({<br> name = string<br> region = string<br> })</pre> | <pre>{<br> "name": "microk8s",<br> "region": "localhost"<br>}</pre> | no |
| <a name="input_hydra"></a> [hydra](#input\_hydra) | The configurations of the Hydra application. | <pre>object({<br> units = optional(number, 1)<br> channel = optional(string, "edge")<br> series = optional(string, "jammy")<br> trust = optional(string, true)<br> config = optional(map(string), {})<br> })</pre> | `{}` | no |
| <a name="input_kratos"></a> [kratos](#input\_kratos) | The configurations of the Kratos application. | <pre>object({<br> units = optional(number, 1)<br> channel = optional(string, "edge")<br> series = optional(string, "jammy")<br> trust = optional(string, true)<br> config = optional(map(string), {})<br> })</pre> | `{}` | no |
| <a name="input_login_ui"></a> [login\_ui](#input\_login\_ui) | The configurations of the Identity Platform Login UI application. | <pre>object({<br> units = optional(number, 1)<br> trust = optional(bool, true)<br> config = optional(map(string), {})<br> channel = optional(string, "edge")<br> series = optional(string, "jammy")<br> })</pre> | `{}` | no |
| <a name="input_idp_provider_config"></a> [idp\_provider\_config](#input\_idp\_provider\_config) | The external Idp provider configurations. | <pre>object({<br> client_id : string<br> issuer_url : optional(string)<br> provider : string<br> provider_id : string<br> scope : optional(string, "profile email address phone")<br> microsoft_tenant_id : optional(string)<br> apple_team_id : optional(string)<br> apple_private_key_id : optional(string)<br> })</pre> | <pre>{<br> "client_id": "client_id",<br> "provider": "generic",<br> "provider_id": "provider_id"<br>}</pre> | no |
| <a name="input_idp_provider_credentials"></a> [idp\_provider\_credentials](#input\_idp\_provider\_credentials) | The external Idp provider credentials. | <pre>object({<br> client_secret : string<br> apple_private_key : optional(string)<br> })</pre> | <pre>{<br> "client_secret": "client_secret"<br>}</pre> | no |
## Outputs

No outputs.
<!-- END_TF_DOCS -->
26 changes: 26 additions & 0 deletions Makefile
@@ -0,0 +1,26 @@
.PHONY: init fmt validate plan

## help: Show help messages.
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

## init: Initialize remote S3 backend.
init:
@terraform init

## fmt: Format the Terraform module to a canonical format and style.
fmt:
@terraform fmt -recursive

## validate: Check syntactical validation.
validate:
@terraform validate

## plan: Plan the changes.
plan: verify-var-file-set
@terraform plan -var-files=${VAR_FILE}

verify-var-file-set:
ifndef VAR_FILE
$(error VAR_FILE is not defined. Please provide VAR_FILE.)
endif
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -55,6 +55,10 @@ $ juju status --relations

TBD.

## Terraform Module Specifications

Please refer to the [doc](./MODULE_SPECS.md) to learn the module specifications.

## Contributing

Please refer to the [doc](./CONTRIBUTING.md) to learn how to make code changes.

0 comments on commit d5fa08a

Please sign in to comment.