├── CHANGELOG.md ├── .deepsource.toml ├── Makefile ├── .github ├── CODEOWNERS ├── workflows │ ├── tflint.yml │ ├── tfsec.yml │ ├── automerge.yml │ ├── changelog.yml │ ├── auto_assignee.yml │ ├── tf-checks.yml │ └── readme.yml ├── PULL_REQUEST_TEMPLATE.md └── dependabot.yml ├── versions.tf ├── _examples ├── basic │ ├── versions.tf │ ├── outputs.tf │ ├── user-data.sh │ └── main.tf └── complete │ ├── versions.tf │ ├── outputs.tf │ ├── user-data.sh │ └── main.tf ├── outputs.tf ├── .editorconfig ├── .pre-commit-config.yaml ├── docs └── io.md ├── main.tf ├── README.yaml ├── .gitignore ├── variables.tf ├── README.md └── LICENSE /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "terraform" -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GENIE_PATH ?= $(shell 'pwd')/../../../genie 2 | include $(GENIE_PATH)/Makefile 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo. 2 | @terraform-do-modules/approvers @clouddrove-ci @anmolnagpal 3 | -------------------------------------------------------------------------------- /versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.4.6" 4 | required_providers { 5 | digitalocean = { 6 | source = "digitalocean/digitalocean" 7 | version = ">= 2.28.1" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_examples/basic/versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.4.6" 4 | required_providers { 5 | digitalocean = { 6 | source = "digitalocean/digitalocean" 7 | version = ">= 2.28.1" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_examples/complete/versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.4.6" 4 | required_providers { 5 | digitalocean = { 6 | source = "digitalocean/digitalocean" 7 | version = ">= 2.28.1" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.github/workflows/tflint.yml: -------------------------------------------------------------------------------- 1 | name: tf-lint 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | tf-lint: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.4.0 10 | secrets: 11 | GITHUB: ${{ secrets.GITHUB }} 12 | -------------------------------------------------------------------------------- /_examples/basic/outputs.tf: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Outputs 3 | # ------------------------------------------------------------------------------ 4 | output "id" { 5 | value = module.load-balancer[*].id 6 | description = "The ID of the Load Balancer." 7 | } 8 | -------------------------------------------------------------------------------- /_examples/complete/outputs.tf: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Outputs 3 | # ------------------------------------------------------------------------------ 4 | output "id" { 5 | value = module.load-balancer[*].id 6 | description = "The ID of the Load Balancer." 7 | } 8 | -------------------------------------------------------------------------------- /.github/workflows/tfsec.yml: -------------------------------------------------------------------------------- 1 | name: tfsec 2 | permissions: write-all 3 | on: 4 | pull_request: 5 | workflow_dispatch: 6 | jobs: 7 | tfsec: 8 | uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.4.0 9 | secrets: 10 | GITHUB: ${{ secrets.GITHUB }} 11 | with: 12 | working_directory: '.' 13 | -------------------------------------------------------------------------------- /_examples/basic/user-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt-get update 3 | apt-get install python -y 4 | sudo adduser ubuntu --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password 5 | echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers 6 | usermod -aG sudo ubuntu 7 | cp -r /root/.ssh /home/ubuntu 8 | chown -R ubuntu:ubuntu /home/ubuntu/.ssh -------------------------------------------------------------------------------- /_examples/complete/user-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt-get update 3 | apt-get install python -y 4 | sudo adduser ubuntu --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password 5 | echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers 6 | usermod -aG sudo ubuntu 7 | cp -r /root/.ssh /home/ubuntu 8 | chown -R ubuntu:ubuntu /home/ubuntu/.ssh -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Auto merge 3 | on: 4 | pull_request: 5 | jobs: 6 | auto-merge: 7 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@1.4.0 8 | secrets: 9 | GITHUB: ${{ secrets.GITHUB }} 10 | with: 11 | tfcheck: 'tf-checks-basic-example / Check code format' 12 | ... -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: changelog 3 | permissions: write-all 4 | on: 5 | push: 6 | tags: 7 | - "*" 8 | workflow_dispatch: 9 | jobs: 10 | changelog: 11 | uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.4.0 12 | secrets: inherit 13 | with: 14 | branch: 'master' 15 | ... -------------------------------------------------------------------------------- /.github/workflows/auto_assignee.yml: -------------------------------------------------------------------------------- 1 | name: Auto Assign PRs 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | workflow_dispatch: 7 | jobs: 8 | assignee: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.4.0 10 | secrets: 11 | GITHUB: ${{ secrets.GITHUB }} 12 | with: 13 | assignees: 'clouddrove-ci' -------------------------------------------------------------------------------- /.github/workflows/tf-checks.yml: -------------------------------------------------------------------------------- 1 | name: tf-checks 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | tf-checks-complete-example: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.4.0 10 | with: 11 | working_directory: './_examples/complete/' 12 | tf-checks-basic-example: 13 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.4.0 14 | with: 15 | working_directory: './_examples/basic/' 16 | -------------------------------------------------------------------------------- /outputs.tf: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Outputs 3 | # ------------------------------------------------------------------------------ 4 | output "id" { 5 | value = join("", digitalocean_loadbalancer.main[*].id) 6 | description = "The ID of the Load Balancer." 7 | } 8 | output "ip" { 9 | value = join("", digitalocean_loadbalancer.main[*].ip) 10 | description = "The ip of the Load Balancer." 11 | } 12 | output "urn" { 13 | value = join("", digitalocean_loadbalancer.main[*].urn) 14 | description = "The uniform resource name for the Load Balancer." 15 | } 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## what 2 | * Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?) 3 | * Use bullet points to be concise and to the point. 4 | 5 | ## why 6 | * Provide the justifications for the changes (e.g. business case). 7 | * Describe why these changes were made (e.g. why do these commits fix the problem?) 8 | * Use bullet points to be concise and to the point. 9 | 10 | ## references 11 | * Link to any supporting jira issues or helpful documentation to add some context (e.g. stackoverflow). 12 | * Use `closes #123`, if this PR closes a Jira issue `#123` 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | # Uses editorconfig to maintain consistent coding styles 3 | 4 | # top-most EditorConfig file 5 | root = true 6 | 7 | # Unix-style newlines with a newline ending every file 8 | [*] 9 | charset = utf-8 10 | end_of_line = lf 11 | indent_size = 2 12 | indent_style = space 13 | insert_final_newline = true 14 | max_line_length = 80 15 | trim_trailing_whitespace = true 16 | 17 | [*.{tf,tfvars}] 18 | indent_size = 2 19 | indent_style = space 20 | 21 | [*.md] 22 | max_line_length = 0 23 | trim_trailing_whitespace = false 24 | 25 | [Makefile] 26 | tab_width = 2 27 | indent_style = tab 28 | 29 | [COMMIT_EDITMSG] 30 | max_line_length = 0 31 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | 3 | - repo: https://github.com/gruntwork-io/pre-commit 4 | rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases 5 | hooks: 6 | - id: terraform-fmt 7 | - id: shellcheck 8 | - id: tflint 9 | 10 | - repo: git://github.com/pre-commit/pre-commit-hooks 11 | rev: v4.0.1 # Use the ref you want to point at 12 | hooks: 13 | - id: end-of-file-fixer 14 | - id: trailing-whitespace 15 | - id: mixed-line-ending 16 | - id: check-byte-order-marker 17 | - id: check-executables-have-shebangs 18 | - id: check-merge-conflict 19 | - id: debug-statements 20 | - id: check-yaml 21 | - id: check-added-large-files 22 | -------------------------------------------------------------------------------- /.github/workflows/readme.yml: -------------------------------------------------------------------------------- 1 | name: 'Create README.md file' 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | readme: 9 | name: 'readme-create' 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: 'Checkout' 13 | uses: actions/checkout@master 14 | 15 | - name: 'Set up Python 3.7' 16 | uses: actions/setup-python@v5 17 | with: 18 | python-version: '3.x' 19 | 20 | - name: 'create readme' 21 | uses: 'clouddrove/github-actions@9.0.3' 22 | with: 23 | actions_subcommand: 'readme' 24 | github_token: '${{ secrets.GITHUB }}' 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | 28 | 29 | - name: 'pre-commit check errors' 30 | uses: pre-commit/action@v3.0.1 31 | continue-on-error: true 32 | 33 | - name: 'pre-commit fix erros' 34 | uses: pre-commit/action@v3.0.1 35 | continue-on-error: true 36 | 37 | - name: 'push readme' 38 | uses: 'clouddrove/github-actions@9.0.3' 39 | continue-on-error: true 40 | with: 41 | actions_subcommand: 'push' 42 | env: 43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 44 | 45 | - name: 'Slack Notification' 46 | uses: clouddrove/action-slack@v2 47 | with: 48 | status: ${{ job.status }} 49 | fields: repo,author 50 | author_name: 'CloudDrove' 51 | env: 52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required 53 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required 54 | if: always() 55 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | open-pull-requests-limit: 3 13 | assignees: 14 | - "clouddrove-ci" 15 | reviewers: 16 | - "approvers" 17 | 18 | - package-ecosystem: "terraform" # See documentation for possible values 19 | directory: "/" # Location of package manifests 20 | schedule: 21 | interval: "weekly" 22 | # Add assignees 23 | assignees: 24 | - "clouddrove-ci" 25 | # Add reviewer 26 | reviewers: 27 | - "approvers" 28 | # Allow up to 3 open pull requests for pip dependencies 29 | open-pull-requests-limit: 3 30 | 31 | - package-ecosystem: "terraform" # See documentation for possible values 32 | directory: "/_examples/complete" # Location of package manifests 33 | schedule: 34 | interval: "weekly" 35 | # Add assignees 36 | assignees: 37 | - "clouddrove-ci" 38 | # Add reviewer 39 | reviewers: 40 | - "approvers" 41 | # Allow up to 3 open pull requests for pip dependencies 42 | open-pull-requests-limit: 3 43 | 44 | - package-ecosystem: "terraform" # See documentation for possible values 45 | directory: "/_examples/basic" # Location of package manifests 46 | schedule: 47 | interval: "weekly" 48 | # Add assignees 49 | assignees: 50 | - "clouddrove-ci" 51 | # Add reviewer 52 | reviewers: 53 | - "approvers" 54 | # Allow up to 3 open pull requests for pip dependencies 55 | open-pull-requests-limit: 3 56 | -------------------------------------------------------------------------------- /_examples/basic/main.tf: -------------------------------------------------------------------------------- 1 | provider "digitalocean" {} 2 | 3 | locals { 4 | name = "app" 5 | environment = "test" 6 | region = "blr1" 7 | } 8 | 9 | ##------------------------------------------------ 10 | ## VPC module call 11 | ##------------------------------------------------ 12 | module "vpc" { 13 | source = "terraform-do-modules/vpc/digitalocean" 14 | version = "1.0.0" 15 | name = local.name 16 | environment = local.environment 17 | region = local.region 18 | ip_range = "10.10.0.0/16" 19 | } 20 | 21 | ##------------------------------------------------ 22 | ## Droplet module call 23 | ##------------------------------------------------ 24 | module "droplet" { 25 | source = "terraform-do-modules/droplet/digitalocean" 26 | version = "1.0.1" 27 | droplet_count = 2 28 | name = local.name 29 | environment = local.environment 30 | region = local.region 31 | vpc_uuid = module.vpc.id 32 | ssh_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA" 33 | user_data = file("user-data.sh") 34 | ####firewall 35 | inbound_rules = [ 36 | { 37 | allowed_ip = ["0.0.0.0/0"] 38 | allowed_ports = "22" 39 | }, 40 | { 41 | allowed_ip = ["0.0.0.0/0"] 42 | allowed_ports = "80" 43 | } 44 | ] 45 | } 46 | 47 | ##------------------------------------------------ 48 | ## Load Balancer module call 49 | ##------------------------------------------------ 50 | module "load-balancer" { 51 | source = "./../../" 52 | name = local.name 53 | environment = local.environment 54 | region = local.region 55 | vpc_uuid = module.vpc.id 56 | droplet_ids = module.droplet.id 57 | ###### 58 | enabled_redirect_http_to_https = false 59 | forwarding_rule = [ 60 | { 61 | entry_port = 80 62 | entry_protocol = "http" 63 | target_port = 80 64 | target_protocol = "http" 65 | }, 66 | { 67 | entry_port = 443 68 | entry_protocol = "https" 69 | target_port = 80 70 | target_protocol = "http" 71 | certificate_name = "demo" 72 | } 73 | ] 74 | } 75 | 76 | -------------------------------------------------------------------------------- /_examples/complete/main.tf: -------------------------------------------------------------------------------- 1 | provider "digitalocean" {} 2 | 3 | locals { 4 | name = "app" 5 | environment = "test" 6 | region = "blr1" 7 | } 8 | 9 | ##------------------------------------------------ 10 | ## VPC module call 11 | ##------------------------------------------------ 12 | module "vpc" { 13 | source = "terraform-do-modules/vpc/digitalocean" 14 | version = "1.0.0" 15 | name = local.name 16 | environment = local.environment 17 | region = local.region 18 | ip_range = "10.10.0.0/16" 19 | } 20 | 21 | ##------------------------------------------------ 22 | ## Droplet module call 23 | ##------------------------------------------------ 24 | module "droplet" { 25 | source = "terraform-do-modules/droplet/digitalocean" 26 | version = "1.0.1" 27 | droplet_count = 2 28 | name = local.name 29 | environment = local.environment 30 | region = local.region 31 | vpc_uuid = module.vpc.id 32 | ssh_key = "ssh-rsa AAAAB3NzaC1yc2E" 33 | user_data = file("user-data.sh") 34 | ####firewall 35 | inbound_rules = [ 36 | { 37 | allowed_ip = ["0.0.0.0/0"] 38 | allowed_ports = "22" 39 | }, 40 | { 41 | allowed_ip = ["0.0.0.0/0"] 42 | allowed_ports = "80" 43 | } 44 | ] 45 | } 46 | 47 | ##------------------------------------------------ 48 | ## Load Balancer module call 49 | ##------------------------------------------------ 50 | module "load-balancer" { 51 | source = "./../../" 52 | name = local.name 53 | environment = local.environment 54 | region = local.region 55 | vpc_uuid = module.vpc.id 56 | droplet_ids = module.droplet.id 57 | ###### 58 | enabled_redirect_http_to_https = false 59 | forwarding_rule = [ 60 | { 61 | entry_port = 80 62 | entry_protocol = "http" 63 | target_port = 80 64 | target_protocol = "http" 65 | }, 66 | { 67 | entry_port = 443 68 | entry_protocol = "https" 69 | target_port = 80 70 | target_protocol = "http" 71 | certificate_name = "demo" 72 | } 73 | ] 74 | 75 | healthcheck = [ 76 | { 77 | port = 80 78 | protocol = "http" 79 | check_interval_seconds = 10 80 | response_timeout_seconds = 5 81 | unhealthy_threshold = 3 82 | healthy_threshold = 5 83 | } 84 | ] 85 | sticky_sessions = [ 86 | { 87 | type = "cookies" 88 | cookie_name = "lb-cookie" 89 | cookie_ttl_seconds = 300 90 | } 91 | ] 92 | 93 | firewall = [ 94 | { 95 | deny = ["cidr:0.0.0.0/0"] 96 | allow = ["cidr:143.244.136.144/32"] 97 | } 98 | ] 99 | } 100 | 101 | -------------------------------------------------------------------------------- /docs/io.md: -------------------------------------------------------------------------------- 1 | ## Inputs 2 | 3 | | Name | Description | Type | Default | Required | 4 | |------|-------------|------|---------|:--------:| 5 | | algorithm | The load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either round\_robin or least\_connections. The default value is round\_robin. | `string` | `"round_robin"` | no | 6 | | disable\_lets\_encrypt\_dns\_records | A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is false. | `bool` | `false` | no | 7 | | droplet\_ids | A list of the IDs of each droplet to be attached to the Load Balancer. | `list(string)` | `[]` | no | 8 | | droplet\_tag | The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer. | `string` | `null` | no | 9 | | enable\_backend\_keepalive | A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is false. | `bool` | `false` | no | 10 | | enable\_proxy\_protocol | A boolean value indicating whether PROXY Protocol should be used to pass information from connecting client requests to the backend service. Default value is false. | `bool` | `false` | no | 11 | | enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources. | `bool` | `true` | no | 12 | | enabled\_redirect\_http\_to\_https | A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. Default value is false. | `bool` | `false` | no | 13 | | environment | Environment (e.g. `prod`, `dev`, `staging`). | `string` | `""` | no | 14 | | firewall | List of objects that represent the configuration of each healthcheck. | `list(any)` | `[]` | no | 15 | | forwarding\_rule | List of objects that represent the configuration of each forwarding\_rule. | `list(any)` | `[]` | no | 16 | | healthcheck | List of objects that represent the configuration of each healthcheck. | `list(any)` | `[]` | no | 17 | | http\_idle\_timeout\_seconds | Specifies the idle timeout for HTTPS connections on the load balancer in seconds. | `number` | `null` | no | 18 | | label\_order | Label order, e.g. `name`,`application`. | `list(any)` |
[| no | 19 | | lb\_size | The size of the Load Balancer. It must be either lb-small, lb-medium, or lb-large. Defaults to lb-small. Only one of size or size\_unit may be provided. | `string` | `"lb-small"` | no | 20 | | managedby | ManagedBy, eg 'terraform-do-modules' or 'hello@clouddrove.com' | `string` | `"terraform-do-modules"` | no | 21 | | name | Name (e.g. `app` or `cluster`). | `string` | `""` | no | 22 | | project\_id | The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. | `string` | `null` | no | 23 | | region | The region to create VPC, like `london-1` , `bangalore-1` ,`newyork-3` `toronto-1`. | `string` | `"blr-1"` | no | 24 | | size\_unit | The size of the Load Balancer. It must be in the range (1, 100). Defaults to 1. Only one of size or size\_unit may be provided. | `number` | `1` | no | 25 | | sticky\_sessions | List of objects that represent the configuration of each healthcheck. | `list(any)` | `[]` | no | 26 | | vpc\_uuid | The ID of the VPC where the load balancer will be located. | `string` | `""` | no | 27 | 28 | ## Outputs 29 | 30 | | Name | Description | 31 | |------|-------------| 32 | | id | The ID of the Load Balancer. | 33 | | ip | The ip of the Load Balancer. | 34 | | urn | The uniform resource name for the Load Balancer. | 35 | 36 | -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | ##----------------------------------------------------------------------------- 2 | ## Labels module callled that will be used for naming and tags. 3 | ##----------------------------------------------------------------------------- 4 | module "labels" { 5 | source = "terraform-do-modules/labels/digitalocean" 6 | version = "1.0.1" 7 | name = var.name 8 | environment = var.environment 9 | managedby = var.managedby 10 | label_order = var.label_order 11 | } 12 | 13 | ##--------------------------------------------------------------------------------------------------------------- 14 | ## Provides a DigitalOcean Load Balancer resource. This can be used to create, modify, and delete Load Balancers. 15 | ##--------------------------------------------------------------------------------------------------------------- 16 | #tfsec:ignore:digitalocean-compute-enforce-https ## For testing we are used http entry_protocol 80, do not use in prod env. 17 | resource "digitalocean_loadbalancer" "main" { 18 | count = var.enabled ? 1 : 0 19 | name = format("%s-lb", module.labels.id) 20 | region = var.region 21 | size = var.lb_size 22 | size_unit = var.size_unit 23 | algorithm = var.algorithm 24 | redirect_http_to_https = var.enabled_redirect_http_to_https 25 | enable_proxy_protocol = var.enable_proxy_protocol 26 | enable_backend_keepalive = var.enable_backend_keepalive 27 | http_idle_timeout_seconds = var.http_idle_timeout_seconds 28 | disable_lets_encrypt_dns_records = var.disable_lets_encrypt_dns_records 29 | project_id = var.project_id 30 | vpc_uuid = var.vpc_uuid 31 | droplet_ids = var.droplet_ids 32 | droplet_tag = var.droplet_tag 33 | 34 | dynamic "firewall" { 35 | for_each = var.firewall 36 | content { 37 | deny = lookup(firewall.value, "deny", null) 38 | allow = lookup(firewall.value, "allow", null) 39 | } 40 | } 41 | 42 | dynamic "forwarding_rule" { 43 | for_each = var.forwarding_rule 44 | content { 45 | entry_port = forwarding_rule.value.entry_port 46 | entry_protocol = forwarding_rule.value.entry_protocol 47 | target_port = forwarding_rule.value.target_port 48 | target_protocol = forwarding_rule.value.target_protocol 49 | certificate_name = lookup(forwarding_rule.value, "certificate_name", null) 50 | tls_passthrough = lookup(forwarding_rule.value, "tls_passthrough", false) 51 | } 52 | } 53 | 54 | dynamic "healthcheck" { 55 | for_each = var.healthcheck 56 | content { 57 | port = healthcheck.value.port 58 | protocol = healthcheck.value.protocol 59 | path = healthcheck.value.protocol == "tcp" ? null : lookup(healthcheck.value, "path", "/") 60 | check_interval_seconds = healthcheck.value.check_interval_seconds 61 | response_timeout_seconds = healthcheck.value.response_timeout_seconds 62 | unhealthy_threshold = healthcheck.value.unhealthy_threshold 63 | healthy_threshold = healthcheck.value.healthy_threshold 64 | } 65 | } 66 | 67 | dynamic "sticky_sessions" { 68 | for_each = var.sticky_sessions 69 | content { 70 | type = lookup(sticky_sessions.value, "type", "none") 71 | cookie_name = lookup(sticky_sessions.value, "cookie_name", null) 72 | cookie_ttl_seconds = lookup(sticky_sessions.value, "cookie_ttl_seconds", null) 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /README.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # This is the canonical configuration for the `README.md` 4 | # Run `make readme` to rebuild the `README.md` 5 | # 6 | 7 | # Name of this project 8 | name : Terraform DigitalOcean Load Balancer 9 | 10 | # License of this project 11 | license: "APACHE" 12 | 13 | # Canonical GitHub repo 14 | github_repo: terraform-do-modules/terraform-digitalocean-load-balancer 15 | 16 | # Badges to display 17 | badges: 18 | - name: "Terraform" 19 | image: "https://img.shields.io/badge/Terraform-v0.15-green" 20 | url: "https://www.terraform.io" 21 | - name: "Licence" 22 | image: "https://img.shields.io/badge/License-APACHE-blue.svg" 23 | url: "LICENSE.md" 24 | 25 | # description of this project 26 | description: |- 27 | Provides a DigitalOcean Load Balancer resource that allows you to manage Load between droplets. 28 | 29 | # extra content 30 | include: 31 | - "terraform.md" 32 | 33 | # How to use this project 34 | usage : |- 35 | Here are examples of how you can use this module in your inventory structure: 36 | ### basic example 37 | ```hcl 38 | module "load-balancer" { 39 | source = "terraform-do-modules/load-balancer/digitalocean" 40 | version = "1.0.0" 41 | name = local.name 42 | environment = local.environment 43 | region = local.region 44 | vpc_uuid = module.vpc.id 45 | droplet_ids = module.droplet.id 46 | 47 | ###### 48 | enabled_redirect_http_to_https = false 49 | forwarding_rule = [ 50 | { 51 | entry_port = 80 52 | entry_protocol = "http" 53 | target_port = 80 54 | target_protocol = "http" 55 | }, 56 | { 57 | entry_port = 443 58 | entry_protocol = "https" 59 | target_port = 80 60 | target_protocol = "http" 61 | certificate_name = "demo" 62 | } 63 | ] 64 | } 65 | ``` 66 | ### complete example 67 | ```hcl 68 | module "load-balancer" { 69 | source = "terraform-do-modules/load-balancer/digitalocean" 70 | version = "1.0.0" 71 | name = local.name 72 | environment = local.environment 73 | region = local.region 74 | vpc_uuid = module.vpc.id 75 | droplet_ids = module.droplet.id 76 | 77 | ###### 78 | enabled_redirect_http_to_https = false 79 | forwarding_rule = [ 80 | { 81 | entry_port = 80 82 | entry_protocol = "http" 83 | target_port = 80 84 | target_protocol = "http" 85 | }, 86 | { 87 | entry_port = 443 88 | entry_protocol = "https" 89 | target_port = 80 90 | target_protocol = "http" 91 | certificate_name = "demo" 92 | } 93 | ] 94 | 95 | healthcheck = [ 96 | { 97 | port = 80 98 | protocol = "http" 99 | check_interval_seconds = 10 100 | response_timeout_seconds = 5 101 | unhealthy_threshold = 3 102 | healthy_threshold = 5 103 | } 104 | ] 105 | sticky_sessions = [ 106 | { 107 | type = "cookies" 108 | cookie_name = "lb-cookie" 109 | cookie_ttl_seconds = 300 110 | } 111 | ] 112 | 113 | firewall = [ 114 | { 115 | deny = ["cidr:0.0.0.0/0"] 116 | allow = ["cidr:143.244.136.144/32"] 117 | } 118 | ] 119 | } 120 | ``` 121 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignored files 2 | *~ 3 | 4 | # temporary files which can be created if a process still has a handle open of a deleted file 5 | .fuse_hidden* 6 | 7 | # KDE directory preferences 8 | .directory 9 | 10 | # Linux trash folder which might appear on any partition or disk 11 | .Trash-* 12 | 13 | # .nfs files are created when an open file is removed but is still being accessed 14 | .nfs* 15 | ### Eclipse template 16 | 17 | .metadata 18 | bin/ 19 | tmp/ 20 | *.tmp 21 | *.bak 22 | *.swp 23 | *~.nib 24 | local.properties 25 | .settings/ 26 | .loadpath 27 | .recommenders 28 | 29 | # External tool builders 30 | .externalToolBuilders/ 31 | 32 | # Locally stored "Eclipse launch configurations" 33 | *.launch 34 | 35 | # PyDev specific (Python IDE for Eclipse) 36 | *.pydevproject 37 | 38 | # CDT-specific (C/C++ Development Tooling) 39 | .cproject 40 | 41 | # Java annotation processor (APT) 42 | .factorypath 43 | 44 | # PDT-specific (PHP Development Tools) 45 | .buildpath 46 | 47 | # sbteclipse plugin 48 | .target 49 | 50 | # Tern plugin 51 | .tern-project 52 | 53 | # TeXlipse plugin 54 | .texlipse 55 | 56 | # STS (Spring Tool Suite) 57 | .springBeans 58 | 59 | # Code Recommenders 60 | .recommenders/ 61 | 62 | # Scala IDE specific (Scala & Java development for Eclipse) 63 | .cache-main 64 | .scala_dependencies 65 | .worksheet 66 | ### Windows template 67 | # Windows thumbnail cache files 68 | Thumbs.db 69 | ehthumbs.db 70 | ehthumbs_vista.db 71 | 72 | # Dump file 73 | *.stackdump 74 | 75 | # Folder config file 76 | [Dd]esktop.ini 77 | 78 | # Recycle Bin used on file shares 79 | $RECYCLE.BIN/ 80 | 81 | # Windows Installer files 82 | *.cab 83 | *.msi 84 | *.msm 85 | *.msp 86 | 87 | # Windows shortcuts 88 | *.lnk 89 | ### Ansible template 90 | *.retry 91 | ### macOS template 92 | # General 93 | .DS_Store 94 | .AppleDouble 95 | .LSOverride 96 | 97 | # Icon must end with two \r 98 | Icon 99 | 100 | # Thumbnails 101 | ._* 102 | 103 | # Files that might appear in the root of a volume 104 | .DocumentRevisions-V100 105 | .fseventsd 106 | .Spotlight-V100 107 | .TemporaryItems 108 | .Trashes 109 | .VolumeIcon.icns 110 | .com.apple.timemachine.donotpresent 111 | 112 | # Directories potentially created on remote AFP share 113 | .AppleDB 114 | .AppleDesktop 115 | Network Trash Folder 116 | Temporary Items 117 | .apdisk 118 | ### Archives template 119 | # It's better to unpack these files and commit the raw source because 120 | # git has its own built in compression methods. 121 | *.7z 122 | *.jar 123 | *.rar 124 | *.zip 125 | *.gz 126 | *.tgz 127 | *.bzip 128 | *.bz2 129 | *.xz 130 | *.lzma 131 | *.cab 132 | 133 | # Packing-only formats 134 | *.iso 135 | *.tar 136 | 137 | # Package management formats 138 | *.dmg 139 | *.xpi 140 | *.gem 141 | *.egg 142 | *.deb 143 | *.rpm 144 | *.msi 145 | *.msm 146 | *.msp 147 | ### JetBrains template 148 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 149 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 150 | 151 | /.idea/ 152 | # User-specific stuff: 153 | .idea/**/workspace.xml 154 | .idea/**/tasks.xml 155 | .idea/dictionaries 156 | 157 | # Sensitive or high-churn files: 158 | .idea/**/dataSources/ 159 | .idea/**/dataSources.ids 160 | .idea/**/dataSources.xml 161 | .idea/**/dataSources.local.xml 162 | .idea/**/sqlDataSources.xml 163 | .idea/**/dynamic.xml 164 | .idea/**/uiDesigner.xml 165 | 166 | # Gradle: 167 | .idea/**/gradle.xml 168 | .idea/**/libraries 169 | 170 | # CMake 171 | cmake-build-debug/ 172 | 173 | # Mongo Explorer plugin: 174 | .idea/**/mongoSettings.xml 175 | 176 | ## File-based project format: 177 | *.iws 178 | 179 | ## Plugin-specific files: 180 | 181 | # IntelliJ 182 | out/ 183 | 184 | # mpeltonen/sbt-idea plugin 185 | .idea_modules/ 186 | # User-specific stuff: 187 | .idea/* 188 | # JIRA plugin 189 | atlassian-ide-plugin.xml 190 | 191 | # Cursive Clojure plugin 192 | .idea/replstate.xml 193 | 194 | # TFstste 195 | *.tfstate* 196 | 197 | deployment/_logs/ansible-log.json 198 | deployment/_logs/ansible-log.log 199 | deployment/_logs/facts/* 200 | deployment/_logs/retry/* 201 | _app/* 202 | ansible-log.json 203 | .terraform 204 | terraform.tfstate 205 | 206 | *.tfstate 207 | *.tfstate.backup 208 | *.iml 209 | *.terraform.lock.hcl 210 | *.lock.hcl 211 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | #Module : LABEL 2 | #Description : Terraform label module variables. 3 | variable "name" { 4 | type = string 5 | default = "" 6 | description = "Name (e.g. `app` or `cluster`)." 7 | } 8 | 9 | variable "environment" { 10 | type = string 11 | default = "" 12 | description = "Environment (e.g. `prod`, `dev`, `staging`)." 13 | } 14 | 15 | variable "label_order" { 16 | type = list(any) 17 | default = ["name", "environment"] 18 | description = "Label order, e.g. `name`,`application`." 19 | } 20 | 21 | variable "managedby" { 22 | type = string 23 | default = "terraform-do-modules" 24 | description = "ManagedBy, eg 'terraform-do-modules' or 'hello@clouddrove.com'" 25 | } 26 | 27 | variable "enabled" { 28 | type = bool 29 | default = true 30 | description = "Whether to create the resources. Set to `false` to prevent the module from creating any resources." 31 | } 32 | 33 | variable "lb_size" { 34 | type = string 35 | default = "lb-small" 36 | description = "The size of the Load Balancer. It must be either lb-small, lb-medium, or lb-large. Defaults to lb-small. Only one of size or size_unit may be provided." 37 | } 38 | 39 | variable "size_unit" { 40 | type = number 41 | default = 1 42 | description = "The size of the Load Balancer. It must be in the range (1, 100). Defaults to 1. Only one of size or size_unit may be provided." 43 | } 44 | 45 | variable "algorithm" { 46 | type = string 47 | default = "round_robin" 48 | description = "The load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either round_robin or least_connections. The default value is round_robin." 49 | } 50 | 51 | variable "enabled_redirect_http_to_https" { 52 | type = bool 53 | default = false 54 | description = "A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. Default value is false." 55 | } 56 | 57 | variable "enable_proxy_protocol" { 58 | type = bool 59 | default = false 60 | description = "A boolean value indicating whether PROXY Protocol should be used to pass information from connecting client requests to the backend service. Default value is false." 61 | } 62 | 63 | variable "enable_backend_keepalive" { 64 | type = bool 65 | default = false 66 | description = "A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is false." 67 | } 68 | 69 | variable "http_idle_timeout_seconds" { 70 | type = number 71 | default = null 72 | description = "Specifies the idle timeout for HTTPS connections on the load balancer in seconds." 73 | } 74 | 75 | variable "disable_lets_encrypt_dns_records" { 76 | type = bool 77 | default = false 78 | description = "A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is false." 79 | } 80 | 81 | variable "project_id" { 82 | type = string 83 | default = null 84 | description = "The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project." 85 | } 86 | 87 | variable "vpc_uuid" { 88 | type = string 89 | default = "" 90 | description = "The ID of the VPC where the load balancer will be located." 91 | } 92 | 93 | variable "droplet_ids" { 94 | type = list(string) 95 | default = [] 96 | description = "A list of the IDs of each droplet to be attached to the Load Balancer." 97 | } 98 | 99 | variable "droplet_tag" { 100 | type = string 101 | default = null 102 | description = "The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer." 103 | } 104 | 105 | variable "region" { 106 | type = string 107 | default = "blr-1" 108 | description = "The region to create VPC, like ``london-1`` , ``bangalore-1`` ,``newyork-3`` ``toronto-1``. " 109 | } 110 | 111 | variable "forwarding_rule" { 112 | type = list(any) 113 | default = [] 114 | description = "List of objects that represent the configuration of each forwarding_rule." 115 | } 116 | 117 | variable "healthcheck" { 118 | type = list(any) 119 | default = [] 120 | description = "List of objects that represent the configuration of each healthcheck." 121 | } 122 | 123 | variable "sticky_sessions" { 124 | type = list(any) 125 | default = [] 126 | description = "List of objects that represent the configuration of each healthcheck." 127 | } 128 | 129 | variable "firewall" { 130 | type = list(any) 131 | default = [] 132 | description = "List of objects that represent the configuration of each healthcheck." 133 | } 134 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [][website] 3 |
"name",
"environment"
]
10 | With our comprehensive DevOps toolkit - streamline operations, automate workflows, enhance collaboration and, most importantly, deploy with confidence. 11 |
12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
We are The Cloud Experts!
163 |We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.
165 | 166 | [website]: https://clouddrove.com 167 | [blog]: https://blog.clouddrove.com 168 | [slack]: https://www.launchpass.com/devops-talks 169 | [github]: https://github.com/clouddrove 170 | [linkedin]: https://cpco.io/linkedin 171 | [twitter]: https://twitter.com/clouddrove/ 172 | [email]: https://clouddrove.com/contact-us.html 173 | [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= 174 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 CloudDrove Inc. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------