Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update resources and github action #1

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 11 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,51 @@

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
open-pull-requests-limit: 3
assignees:
- "clouddrove-ci"
- "clouddrove-ci"
reviewers:
- "approvers"
- "approvers"

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/basic" # Location of package manifests
directory: "/_examples/complete" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/complete" # Location of package manifests
directory: "/_examples/basic" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3
3 changes: 1 addition & 2 deletions .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ name: Auto Assign PRs
on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assign-pr:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
assignees: 'clouddrove-ci'
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'
4 changes: 2 additions & 2 deletions .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 }}
GITHUB: ${{ secrets.GITHUB }}
3 changes: 2 additions & 1 deletion .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: '.'
106 changes: 93 additions & 13 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,116 @@
#

# Name of this project
name : Terraform Module Template
name : Terraform DigitalOcean Load Balancer

# License of this project
license: "APACHE"

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

# 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"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-module-template/actions/workflows/tfsec.yml/badge.svg"
url: ""
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.15-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"

# description of this project
description: |-
Terraform module template to create new modules using this as baseline
Provides a DigitalOcean Load Balancer resource that allows you to manage Load between droplets.

# extra content
include:
- "terraform.md"

# How to use this project
# How to use this project
usage: |-
Here are some examples of how you can use this module in your inventory structure:
usage : |-
Here are examples of how you can use this module in your inventory structure:
### basic example
```hcl
module "load-balancer" {
source = "terraform-do-modules/load-balancer/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
vpc_uuid = module.vpc.id
droplet_ids = module.droplet.id

######
enabled_redirect_http_to_https = false
forwarding_rule = [
{
entry_port = 80
entry_protocol = "http"
target_port = 80
target_protocol = "http"
},
{
entry_port = 443
entry_protocol = "https"
target_port = 80
target_protocol = "http"
certificate_name = "demo"
}
]
}
```
### complete example
```hcl
```
module "load-balancer" {
source = "terraform-do-modules/load-balancer/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
vpc_uuid = module.vpc.id
droplet_ids = module.droplet.id

######
enabled_redirect_http_to_https = false
forwarding_rule = [
{
entry_port = 80
entry_protocol = "http"
target_port = 80
target_protocol = "http"
},
{
entry_port = 443
entry_protocol = "https"
target_port = 80
target_protocol = "http"
certificate_name = "demo"
}
]

healthcheck = [
{
port = 80
protocol = "http"
check_interval_seconds = 10
response_timeout_seconds = 5
unhealthy_threshold = 3
healthy_threshold = 5
}
]
sticky_sessions = [
{
type = "cookies"
cookie_name = "lb-cookie"
cookie_ttl_seconds = 300
}
]

firewall = [
{
deny = ["cidr:0.0.0.0/0"]
allow = ["cidr:143.244.136.144/32"]
}
]
}
```
3 changes: 0 additions & 3 deletions _examples/basic/README.md

This file was deleted.

79 changes: 75 additions & 4 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,75 @@
# ------------------------------------------------------------------------------
# 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"
}

##------------------------------------------------
## Droplet module call
##------------------------------------------------
module "droplet" {
source = "terraform-do-modules/droplet/digitalocean"
version = "1.0.0"
droplet_count = 2
name = local.name
environment = local.environment
region = local.region
vpc_uuid = module.vpc.id
ssh_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA"
user_data = file("user-data.sh")
####firewall
inbound_rules = [
{
allowed_ip = ["0.0.0.0/0"]
allowed_ports = "22"
},
{
allowed_ip = ["0.0.0.0/0"]
allowed_ports = "80"
}
]
}

##------------------------------------------------
## Load Balancer module call
##------------------------------------------------
module "load-balancer" {
source = "./../../"
name = local.name
environment = local.environment
region = local.region
vpc_uuid = module.vpc.id
droplet_ids = module.droplet.id
######
enabled_redirect_http_to_https = false
forwarding_rule = [
{
entry_port = 80
entry_protocol = "http"
target_port = 80
target_protocol = "http"
},
{
entry_port = 443
entry_protocol = "https"
target_port = 80
target_protocol = "http"
certificate_name = "demo"
}
]
}

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.load-balancer[*].id
description = "The ID of the Load Balancer."
}
8 changes: 8 additions & 0 deletions _examples/basic/user-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
apt-get update
apt-get install python -y
sudo adduser ubuntu --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
usermod -aG sudo ubuntu
cp -r /root/.ssh /home/ubuntu
chown -R ubuntu:ubuntu /home/ubuntu/.ssh
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