Skip to content

Commit

Permalink
Merge pull request #2 from terraform-do-modules/internal-418
Browse files Browse the repository at this point in the history
feat: initial commit
  • Loading branch information
clouddrove-ci authored Jul 27, 2023
2 parents a8985f1 + 5d3d580 commit 93cf4d6
Show file tree
Hide file tree
Showing 30 changed files with 501 additions and 95 deletions.
30 changes: 0 additions & 30 deletions .editorconfig

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# These owners will be the default owners for everything in the repo.
* @anmolnagpal @clouddrove/approvers @clouddrove-ci
@terraform-do-modules/approvers @clouddrove-ci @anmolnagpal
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
open-pull-requests-limit: 3
assignees:
- "clouddrove-ci"
Expand All @@ -30,7 +30,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/basic" # Location of package manifests
directory: "/_examples/basic" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
Expand All @@ -43,7 +43,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/complete" # Location of package manifests
directory: "/_examples/complete" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
Expand All @@ -53,4 +53,4 @@ updates:
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3
open-pull-requests-limit: 3
1 change: 0 additions & 1 deletion .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Auto Assign PRs
on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assign-pr:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
call-workflow-changelog:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
secrets: inherit
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
branch: 'master'
1 change: 0 additions & 1 deletion .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: 'pre-commit check errors'
uses: pre-commit/action@v3.0.0
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ on:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/test-tfsec/.github/workflows/tflint.yaml@master
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
5 changes: 3 additions & 2 deletions .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
secrets: inherit
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
working_directory: '.'
working_directory: '.'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,4 @@ terraform.tfstate
*.iml
*.terraform.lock.hcl
*.lock.hcl
*kubeconfig
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
repos:

- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
Expand All @@ -18,4 +17,4 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- id: check-yaml
- id: check-added-large-files
- id: check-added-large-files
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
97 changes: 90 additions & 7 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,36 @@
#

# Name of this project
name : Terraform Module Template
name : Terraform Digitalocean Kubernetes

# License of this project
license: "APACHE"

# Canonical GitHub repo
github_repo: clouddrove/terraform-module-template
github_repo: terraform-do-modules/terraform-digitalocean-kubernetes

# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-module-template.svg"
url: "https://github.com/clouddrove/terraform-module-template/releases/latest"
image: "https://img.shields.io/github/release/terraform-do-modules/terraform-digitalocean-kubernetes.svg"
url: "https://github.com/terraform-do-modules/terraform-digitalocean-kubernetes/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-module-template/actions/workflows/tfsec.yml/badge.svg"
url: ""
image: "https://github.com/terraform-do-modules/terraform-digitalocean-kubernetes/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/terraform-do-modules/terraform-digitalocean-kubernetes/actions/workflows/tfsec.yml"
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v1.4.6-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"

prerequesties:
- name: Terraform 1.4.6
url: https://learn.hashicorp.com/terraform/getting-started/install.html

# description of this project
description: |-
Terraform module template to create new modules using this as baseline
Terraform module to create Digitalocean kubernetes service resource on Digitalocean.
# extra content
include:
- "terraform.md"
Expand All @@ -36,5 +43,81 @@ include:
# How to use this project
usage: |-
Here are some examples of how you can use this module in your inventory structure:
## basic example
```hcl
module "cluster" {
source = "terraform-do-modules/cluster/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
cluster_version = "1.27.2-do.0"
vpc_uuid = module.vpc.id
critical_node_pool = {
critical_node = {
node_count = 1
min_nodes = 1
max_nodes = 2
size = "s-1vcpu-2gb"
}
}
app_node_pools = {
app_node = {
node_count = 1
min_nodes = 1
max_nodes = 2
size = "s-1vcpu-2gb"
}
}
}
```
## complete example
```hcl
module "cluster" {
source = "terraform-do-modules/cluster/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
cluster_version = "1.27.2-do.0"
vpc_uuid = module.vpc.id
critical_node_pool = {
critical_node = {
node_count = 1
min_nodes = 1
max_nodes = 2
size = "s-1vcpu-2gb"
labels = { "cluster" = "critical-node", }
tags = ["demo"]
taint = [
{
key = "name"
value = "default"
effect = "NoSchedule"
}
]
}
}
app_node_pools = {
app_node = {
size = "s-1vcpu-2gb"
node_count = 1
min_nodes = 1
max_nodes = 2
labels = { "cluster" = "app-node" }
tags = ["demo"]
taint = [
{
key = "mysize"
value = "large"
effect = "NoSchedule"
}
]
}
}
}
```
3 changes: 0 additions & 3 deletions _examples/basic/README.md

This file was deleted.

54 changes: 50 additions & 4 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
# ------------------------------------------------------------------------------
# Resources
# ------------------------------------------------------------------------------
locals {}
provider "digitalocean" {}

locals {
name = "app"
environment = "test"
region = "blr1"
}

##------------------------------------------------
## VPC module call
##------------------------------------------------
module "vpc" {
source = "terraform-do-modules/vpc/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
ip_range = "10.10.0.0/16"
}

##------------------------------------------------
## Kubernetes module call
##------------------------------------------------
module "cluster" {
source = "./../../"
name = local.name
environment = local.environment
region = local.region
cluster_version = "1.27.4-do.0"
vpc_uuid = module.vpc.id

critical_node_pool = {
critical_node = {
node_count = 1
min_nodes = 1
max_nodes = 2
size = "s-1vcpu-2gb"
}
}

app_node_pools = {
app_node = {
node_count = 1
min_nodes = 1
max_nodes = 2
size = "s-1vcpu-2gb"
}
}
}

4 changes: 4 additions & 0 deletions _examples/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "id" {
value = module.cluster[*].id
description = "The id of Kubernetes cluster."
}
3 changes: 0 additions & 3 deletions _examples/basic/variables.auto.tfvars

This file was deleted.

3 changes: 0 additions & 3 deletions _examples/basic/variables.tf

This file was deleted.

10 changes: 10 additions & 0 deletions _examples/basic/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Terraform version
terraform {
required_version = ">= 1.4.6"
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = ">= 2.28.1"
}
}
}
3 changes: 0 additions & 3 deletions _examples/complete/README.md

This file was deleted.

Loading

0 comments on commit 93cf4d6

Please sign in to comment.