Skip to content

Commit 8b9494f

Browse files
committed
Add basic README to all terraform modules
- Link to generated tfdoc - Link to examples directory if it exists - List all modules from top README
1 parent 086beeb commit 8b9494f

File tree

44 files changed

+307
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+307
-125
lines changed

README.md

Lines changed: 55 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,60 @@
1-
# Repository Template
2-
3-
[![CI/CD Pull Request](https://github.com/nhs-england-tools/repository-template/actions/workflows/cicd-1-pull-request.yaml/badge.svg)](https://github.com/nhs-england-tools/repository-template/actions/workflows/cicd-1-pull-request.yaml)
4-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=repository-template&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=repository-template)
5-
6-
Start with an overview or a brief description of what the project is about and what it does. For example -
7-
8-
Welcome to our repository template designed to streamline your project setup! This robust template provides a reliable starting point for your new projects, covering an essential tech stack and encouraging best practices in documenting.
9-
10-
This repository template aims to foster a user-friendly development environment by ensuring that every included file is concise and adequately self-documented. By adhering to this standard, we can promote increased clarity and maintainability throughout your project's lifecycle. Bundled within this template are resources that pave the way for seamless repository creation. Currently supported technologies are:
11-
12-
- Terraform
13-
- Docker
14-
15-
Make use of this repository template to expedite your project setup and enhance your productivity right from the get-go. Enjoy the advantage of having a well-structured, self-documented project that reduces overhead and increases focus on what truly matters - coding!
16-
17-
## Table of Contents
18-
19-
- [Repository Template](#repository-template)
20-
- [Table of Contents](#table-of-contents)
21-
- [Setup](#setup)
22-
- [Prerequisites](#prerequisites)
23-
- [Configuration](#configuration)
24-
- [Usage](#usage)
25-
- [Testing](#testing)
26-
- [Design](#design)
27-
- [Diagrams](#diagrams)
28-
- [Modularity](#modularity)
29-
- [Contributing](#contributing)
30-
- [Contacts](#contacts)
31-
- [Licence](#licence)
32-
33-
## Setup
34-
35-
By including preferably a one-liner or if necessary a set of clear CLI instructions we improve user experience. This should be a frictionless installation process that works on various operating systems (macOS, Linux, Windows WSL) and handles all the dependencies.
36-
37-
Clone the repository
1+
# DTOS Devops template
2+
3+
This repository contains terraform modules and Azure devops pipeline steps to deploy DTOS applications.
4+
5+
## Terraform modules
6+
- [api-management](infrastructure/modules/api-management/README.md)
7+
- [app-insights](infrastructure/modules/app-insights/README.md)
8+
- [app-service-plan](infrastructure/modules/app-service-plan/README.md)
9+
- [application-gateway](infrastructure/modules/application-gateway/README.md)
10+
- [baseline](infrastructure/modules/baseline/README.md)
11+
- [container-app](infrastructure/modules/container-app/README.md)
12+
- [container-app-environment](infrastructure/modules/container-app-environment/README.md)
13+
- [container-registry](infrastructure/modules/container-registry/README.md)
14+
- [diagnostic-settings](infrastructure/modules/diagnostic-settings/README.md)
15+
- [dns-a-record](infrastructure/modules/dns-a-record/README.md)
16+
- [event-grid-subscription](infrastructure/modules/event-grid-subscription/README.md)
17+
- [event-grid-topic](infrastructure/modules/event-grid-topic/README.md)
18+
- [event-hub](infrastructure/modules/event-hub/README.md)
19+
- [firewall](infrastructure/modules/firewall/README.md)
20+
- [firewall-policy](infrastructure/modules/firewall-policy/README.md)
21+
- [firewall-rule-collection-group](infrastructure/modules/firewall-rule-collection-group/README.md)
22+
- [function-app](infrastructure/modules/function-app/README.md)
23+
- [function-app-slots](infrastructure/modules/function-app-slots/README.md)
24+
- [key-vault](infrastructure/modules/key-vault/README.md)
25+
- [lets-encrypt-certificates](infrastructure/modules/lets-encrypt-certificates/README.md)
26+
- [linux-web-app](infrastructure/modules/linux-web-app/README.md)
27+
- [linux-web-app-slots](infrastructure/modules/linux-web-app-slots/README.md)
28+
- [log-analytics-data-export-rule](infrastructure/modules/log-analytics-data-export-rule/README.md)
29+
- [log-analytics-workspace](infrastructure/modules/log-analytics-workspace/README.md)
30+
- [managed-identity](infrastructure/modules/managed-identity/README.md)
31+
- [monitor-action-group](infrastructure/modules/monitor-action-group/README.md)
32+
- [network-security-group](infrastructure/modules/network-security-group/README.md)
33+
- [postgresql-flexible](infrastructure/modules/postgresql-flexible/README.md)
34+
- [private-dns-a-record](infrastructure/modules/private-dns-a-record/README.md)
35+
- [private-dns-zone](infrastructure/modules/private-dns-zone/README.md)
36+
- [private-dns-zone-resolver](infrastructure/modules/private-dns-zone-resolver/README.md)
37+
- [private-endpoint](infrastructure/modules/private-endpoint/README.md)
38+
- [private-link-scoped-service](infrastructure/modules/private-link-scoped-service/README.md)
39+
- [public-ip](infrastructure/modules/public-ip/README.md)
40+
- [rbac-assignment](infrastructure/modules/rbac-assignment/README.md)
41+
- [route-table](infrastructure/modules/route-table/README.md)
42+
- [service-bus](infrastructure/modules/service-bus/README.md)
43+
- [shared-config](infrastructure/modules/shared-config/README.md)
44+
- [sql-server](infrastructure/modules/sql-server/README.md)
45+
- [storage](infrastructure/modules/storage/README.md)
46+
- [subnet](infrastructure/modules/subnet/README.md)
47+
- [virtual-desktop](infrastructure/modules/virtual-desktop/README.md)
48+
- [vnet](infrastructure/modules/vnet/README.md)
49+
- [vnet-peering](infrastructure/modules/vnet-peering/README.md)
50+
51+
## Update terraform documentation
52+
After working on terraform modules, always update the terraform documentation by running:
3853

3954
```shell
40-
git clone https://github.com/nhs-england-tools/repository-template.git
41-
cd nhs-england-tools/repository-template
55+
make terraform-docs
4256
```
4357

44-
### Prerequisites
45-
46-
The following software packages, or their equivalents, are expected to be installed and configured:
47-
48-
- [Docker](https://www.docker.com/) container runtime or a compatible tool, e.g. [Podman](https://podman.io/),
49-
- [asdf](https://asdf-vm.com/) version manager,
50-
- [GNU make](https://www.gnu.org/software/make/) 3.82 or later,
51-
52-
> [!NOTE]<br>
53-
> The version of GNU make available by default on macOS is earlier than 3.82. You will need to upgrade it or certain `make` tasks will fail. On macOS, you will need [Homebrew](https://brew.sh/) installed, then to install `make`, like so:
54-
>
55-
> ```shell
56-
> brew install make
57-
> ```
58-
>
59-
> You will then see instructions to fix your [`$PATH`](https://github.com/nhs-england-tools/dotfiles/blob/main/dot_path.tmpl) variable to make the newly installed version available. If you are using [dotfiles](https://github.com/nhs-england-tools/dotfiles), this is all done for you.
60-
61-
- [GNU sed](https://www.gnu.org/software/sed/) and [GNU grep](https://www.gnu.org/software/grep/) are required for the scripted command-line output processing,
62-
- [GNU coreutils](https://www.gnu.org/software/coreutils/) and [GNU binutils](https://www.gnu.org/software/binutils/) may be required to build dependencies like Python, which may need to be compiled during installation,
63-
64-
> [!NOTE]<br>
65-
> For macOS users, installation of the GNU toolchain has been scripted and automated as part of the `dotfiles` project. Please see this [script](https://github.com/nhs-england-tools/dotfiles/blob/main/assets/20-install-base-packages.macos.sh) for details.
66-
67-
- [Python](https://www.python.org/) required to run Git hooks,
68-
- [`jq`](https://jqlang.github.io/jq/) a lightweight and flexible command-line JSON processor.
69-
70-
### Configuration
71-
72-
Installation and configuration of the toolchain dependencies
73-
74-
```shell
75-
make config
76-
```
77-
78-
## Usage
79-
80-
After a successful installation, provide an informative example of how this project can be used. Additional code snippets, screenshots and demos work well in this space. You may also link to the other documentation resources, e.g. the [User Guide](./docs/user-guide.md) to demonstrate more use cases and to show more features.
81-
82-
### Testing
83-
84-
There are `make` tasks for you to configure to run your tests. Run `make test` to see how they work. You should be able to use the same entry points for local development as in your CI pipeline.
85-
86-
## Design
87-
88-
### Diagrams
89-
90-
The [C4 model](https://c4model.com/) is a simple and intuitive way to create software architecture diagrams that are clear, consistent, scalable and most importantly collaborative. This should result in documenting all the system interfaces, external dependencies and integration points.
91-
92-
![Repository Template](./docs/diagrams/Repository_Template_GitHub_Generic.png)
93-
94-
The source for diagrams should be in Git for change control and review purposes. Recommendations are [draw.io](https://app.diagrams.net/) (example above in [docs](.docs/diagrams/) folder) and [Mermaids](https://github.com/mermaid-js/mermaid). Here is an example Mermaids sequence diagram:
95-
96-
```mermaid
97-
sequenceDiagram
98-
User->>+Service: GET /users?params=...
99-
Service->>Service: auth request
100-
Service->>Database: get all users
101-
Database-->>Service: list of users
102-
Service->>Service: filter users
103-
Service-->>-User: list[User]
104-
```
105-
106-
### Modularity
107-
108-
Most of the projects are built with customisability and extendability in mind. At a minimum, this can be achieved by implementing service level configuration options and settings. The intention of this section is to show how this can be used. If the system processes data, you could mention here for example how the input is prepared for testing - anonymised, synthetic or live data.
109-
110-
## Contributing
111-
112-
Describe or link templates on how to raise an issue, feature request or make a contribution to the codebase. Reference the other documentation files, like
113-
114-
- Environment setup for contribution, i.e. `CONTRIBUTING.md`
115-
- Coding standards, branching, linting, practices for development and testing
116-
- Release process, versioning, changelog
117-
- Backlog, board, roadmap, ways of working
118-
- High-level requirements, guiding principles, decision records, etc.
119-
120-
## Contacts
121-
122-
Provide a way to contact the owners of this project. It can be a team, an individual or information on the means of getting in touch via active communication channels, e.g. opening a GitHub discussion, raising an issue, etc.
123-
124-
## Licence
125-
126-
> The [LICENCE.md](./LICENCE.md) file will need to be updated with the correct year and owner
127-
128-
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.
58+
For each module, add a description to the README. Add basic usage to the README. If the code is more involved, add example code to the `examples/` directory instead.
12959

130-
Any HTML or Markdown documentation is [© Crown Copyright](https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms of the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).
60+
Make sure to link all modules from this README.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# api-management
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
5+
6+
## Examples
7+
See code examples in the [examples directory](examples/).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# app-insights
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# app-service-plan
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# application-gateway
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# baseline
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# container-app-environment
2+
3+
A [Container Apps environment](https://learn.microsoft.com/en-us/azure/container-apps/environment) is a secure boundary around one or more container apps and jobs. The Container Apps runtime manages each environment by handling OS upgrades, scale operations, failover procedures, and resource balancing.
4+
5+
Integrates with the [container-app module](../container-app/).
6+
7+
## Terraform documentation
8+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
9+
10+
## Usage
11+
12+
```hcl
13+
module "container-app-environment" {
14+
source = "../../../dtos-devops-templates/infrastructure/modules/container-app-environment"
15+
16+
name = "manage-breast-screening-${var.environment}"
17+
resource_group_name = azurerm_resource_group.this.name
18+
log_analytics_workspace_id = data.terraform_remote_state.audit.outputs.log_analytics_workspace_id
19+
vnet_integration_subnet_id = module.container_app_subnet.id
20+
}
21+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# container-app
2+
3+
Deploy an [Azure container app](https://learn.microsoft.com/en-us/azure/container-apps/overview) to a [Container app environment](https://learn.microsoft.com/en-us/azure/container-apps/environment). Integrates with the [container-app-environment module](../container-app-environment/).
4+
5+
## Terraform documentation
6+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
7+
8+
## Usage
9+
```hcl
10+
# Create the common container app environment
11+
module "container-app-environment" {
12+
source = "../../../dtos-devops-templates/infrastructure/modules/container-app-environment"
13+
14+
name = "manage-breast-screening-${var.environment}"
15+
resource_group_name = azurerm_resource_group.this.name
16+
log_analytics_workspace_id = data.terraform_remote_state.audit.outputs.log_analytics_workspace_id
17+
vnet_integration_subnet_id = module.container_app_subnet.id
18+
}
19+
20+
# Create a webapp for a container listening on port 8000
21+
# The webapp will be available on internal URL https://<name>.<container app environment default domain>
22+
module "webapp" {
23+
source = "../../../modules/dtos-devops-templates/infrastructure/modules/container-app"
24+
name = "manage-breast-screening-web-${var.environment}"
25+
container_app_environment_id = module.container-app-environment.id
26+
resource_group_name = azurerm_resource_group.this.name
27+
app_key_vault_name = module.app-key-vault.name # All secrets in the app key vault are mapped securely as environment variables
28+
docker_image = var.docker_image # Docker image and unique tag
29+
# Map of non secret environment variables
30+
environment_variables = {
31+
"ALLOWED_HOSTS" = "manage-breast-screening-web-${var.environment}.${module.container-app-environment.default_domain}"
32+
}
33+
is_web_app = true
34+
http_port = 8000
35+
}
36+
37+
# Create a background worker (no ingress)
38+
module "worker" {
39+
source = "../../../modules/dtos-devops-templates/infrastructure/modules/container-app"
40+
name = "manage-breast-screening-worker-${var.environment}"
41+
container_app_environment_id = module.container-app-environment.id
42+
resource_group_name = azurerm_resource_group.this.name
43+
app_key_vault_name = module.app-key-vault.name
44+
docker_image = var.docker_image_worker
45+
}
46+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# container-registry
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# diagnostic-settings
2+
3+
## Terraform documentation
4+
For the list of inputs, outputs, resources... check the [terraform module documentation](tfdocs.md).
5+
6+
## Examples
7+
See code examples in the [examples directory](examples/).

0 commit comments

Comments
 (0)