Skip to content

Commit b163ae9

Browse files
author
Dennis Ploeger
authored
Merge pull request #1 from dodevops/feature/te/DO-779-first-version
Feature/te/do 779 first version
2 parents 64ed197 + 98ee62e commit b163ae9

File tree

6 files changed

+195
-2
lines changed

6 files changed

+195
-2
lines changed

.terraform-docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
formatter: markdown document
2+
output:
3+
file: "README.md"
4+
settings:
5+
anchor: false

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 DO! DevOps
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,95 @@
1-
# terraform-azure-certmanager
2-
Highly opinionated Terraform management of cert manager on Azure Kubernetes Service (AKS)
1+
# Terraform management of cert-manager on AKS
2+
3+
## Introduction
4+
5+
This module manages cert-manager on AKS (Azure Kubernetes Service)
6+
7+
## Usage
8+
9+
Instantiate the module by calling it from Terraform like this:
10+
11+
```hcl
12+
module "azure-basics" {
13+
source = "dodevops/certmanager/azure"
14+
version = "<version>"
15+
}
16+
```
17+
18+
<!-- BEGIN_TF_DOCS -->
19+
## Requirements
20+
21+
The following requirements are needed by this module:
22+
23+
- helm (>= 2.4.1)
24+
25+
## Providers
26+
27+
The following providers are used by this module:
28+
29+
- helm (>= 2.4.1)
30+
31+
- kubernetes
32+
33+
## Modules
34+
35+
No modules.
36+
37+
## Resources
38+
39+
The following resources are used by this module:
40+
41+
- [helm_release.cert-manager](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) (resource)
42+
- [helm_release.cert-manager-issuers](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) (resource)
43+
- [kubernetes_namespace.cert-manager](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) (resource)
44+
45+
## Required Inputs
46+
47+
No required inputs.
48+
49+
## Optional Inputs
50+
51+
The following input variables are optional (have default values):
52+
53+
### cert-manager-issuers-version
54+
55+
Description: Version of the Cert-Manager-issuers helm chart to use
56+
57+
Type: `string`
58+
59+
Default: `"0.2.2"`
60+
61+
### cert-manager-version
62+
63+
Description: Version of the Cert-Manager helm chart to use
64+
65+
Type: `string`
66+
67+
Default: `"v1.5.4"`
68+
69+
### cluster-issuers-yaml
70+
71+
Description: The YAML code to define cluster issuers for cert-manager. Example: https://github.com/adfinis-sygroup/helm-charts/blob/master/charts/cert-manager-issuers/examples/letsencrypt-clusterissuers.yaml
72+
73+
Type: `string`
74+
75+
Default: `""`
76+
77+
### issuers-yaml
78+
79+
Description: The YAML code to define issuers for cert-manager. Example: https://github.com/adfinis-sygroup/helm-charts/blob/master/charts/cert-manager-issuers/examples/disable-issuers.yaml
80+
81+
Type: `string`
82+
83+
Default: `""`
84+
85+
## Outputs
86+
87+
No outputs.
88+
<!-- END_TF_DOCS -->
89+
90+
## Development
91+
92+
Use [terraform-docs](https://terraform-docs.io/) to generate the API documentation by running
93+
94+
terraform fmt .
95+
terraform-docs .

main.tf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
resource "kubernetes_namespace" "cert-manager" {
2+
metadata {
3+
name = "cert-manager"
4+
}
5+
}
6+
7+
# https://artifacthub.io/packages/helm/cert-manager/cert-manager
8+
resource "helm_release" "cert-manager" {
9+
name = "cert-manager"
10+
repository = "https://charts.jetstack.io"
11+
chart = "cert-manager"
12+
version = var.cert-manager-version
13+
namespace = kubernetes_namespace.cert-manager.metadata.0.name
14+
15+
set {
16+
name = "installCRDs"
17+
value = "true"
18+
}
19+
}
20+
21+
locals {
22+
clusterIssuers = <<EOT
23+
clusterIssuers:
24+
${var.cluster-issuers-yaml}
25+
EOT
26+
issuers = <<EOT
27+
issuers:
28+
${var.issuers-yaml}
29+
EOT
30+
}
31+
32+
# https://artifacthub.io/packages/helm/adfinis/cert-manager-issuers
33+
resource "helm_release" "cert-manager-issuers" {
34+
chart = "cert-manager-issuers"
35+
name = "cert-manager-issuers"
36+
version = var.cert-manager-issuers-version
37+
repository = "https://charts.adfinis.com"
38+
39+
values = [
40+
var.cluster-issuers-yaml == "" ? "" : local.clusterIssuers,
41+
var.issuers-yaml == "" ? "" : local.issuers
42+
]
43+
}

terraform.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
helm = {
4+
source = "hashicorp/helm"
5+
version = ">= 2.4.1"
6+
}
7+
}
8+
}

vars.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
variable "cert-manager-version" {
2+
type = string
3+
default = "v1.5.4"
4+
description = "Version of the Cert-Manager helm chart to use"
5+
}
6+
7+
variable "cert-manager-issuers-version" {
8+
type = string
9+
default = "0.2.2"
10+
description = "Version of the Cert-Manager-issuers helm chart to use"
11+
}
12+
13+
variable "issuers-yaml" {
14+
type = string
15+
default = ""
16+
description = "The YAML code to define issuers for cert-manager. Example: https://github.com/adfinis-sygroup/helm-charts/blob/master/charts/cert-manager-issuers/examples/disable-issuers.yaml"
17+
}
18+
19+
variable "cluster-issuers-yaml" {
20+
type = string
21+
default = ""
22+
description = "The YAML code to define cluster issuers for cert-manager. Example: https://github.com/adfinis-sygroup/helm-charts/blob/master/charts/cert-manager-issuers/examples/letsencrypt-clusterissuers.yaml"
23+
}

0 commit comments

Comments
 (0)