Skip to content

Commit

Permalink
fix: update source version and readme.yml file and dependabot.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
themaheshyadav committed Jul 26, 2023
1 parent 17f2149 commit bb3aec6
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 52 deletions.
12 changes: 1 addition & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@

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

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down Expand Up @@ -65,7 +55,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_examples/database_firewall" # Location of package manifests
directory: "/_examples/database-firewall" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
tf-database-firewall-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './_examples/database_firewall/'
working_directory: './_examples/database-firewall/'
4 changes: 2 additions & 2 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ usage : |-
```hcl
module "firewall" {
source = "terraform-do-modules/firewall/digitalocean"
version = "0.15.0"
version = "1.0.0"
name = "app"
environment = "test"
allowed_ip = ["0.0.0.0/0"]
Expand All @@ -53,7 +53,7 @@ usage : |-
```hcl
module "firewall" {
source = "terraform-do-modules/firewall/digitalocean"
version = "0.15.0"
version = "1.0.0"
name = local.name
environment = local.environment
database_firewall_enabled = true
Expand Down
3 changes: 3 additions & 0 deletions _examples/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "name" {
value = module.firewall[*].name
description = "The name of the Firewall."
Expand Down
6 changes: 4 additions & 2 deletions _examples/complete/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ locals {
## VPC module call
##------------------------------------------------
module "vpc" {
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-vpc.git?ref=internal-423"
source = "terraform-do-modules/vpc/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
Expand All @@ -21,7 +22,8 @@ module "vpc" {
## Droplet module call
##------------------------------------------------
module "droplet" {
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-droplet.git?ref=internal-425"
source = "terraform-do-modules/droplet/digitalocean"
version = "1.0.0"
name = local.name
environment = local.environment
region = local.region
Expand Down
3 changes: 3 additions & 0 deletions _examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "name" {
value = module.firewall[*].name
description = "The name of the Firewall."
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions _examples/database-firewall/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "uuid" {
value = module.firewall[*].database_uuid
description = "A unique identifier for the firewall rule."
}
File renamed without changes.
4 changes: 0 additions & 4 deletions _examples/database_firewall/outputs.tf

This file was deleted.

37 changes: 14 additions & 23 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
## Labels module callled that will be used for naming and tags.
##-----------------------------------------------------------------------------
module "labels" {
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-labels.git?ref=internal-426m"
source = "terraform-do-modules/labels/digitalocean"
version = "1.0.0"
name = var.name
environment = var.environment
managedby = var.managedby
Expand Down Expand Up @@ -32,25 +33,17 @@ resource "digitalocean_firewall" "default" {
source_tags = var.tags
}
}

outbound_rule {
protocol = "tcp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
destination_droplet_ids = var.droplet_ids
destination_kubernetes_ids = var.kubernetes_ids
destination_load_balancer_uids = var.load_balancer_uids
destination_tags = var.tags
}

outbound_rule {
protocol = "udp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
destination_droplet_ids = var.droplet_ids
destination_kubernetes_ids = var.kubernetes_ids
destination_load_balancer_uids = var.load_balancer_uids
destination_tags = var.tags
dynamic "outbound_rule" {
for_each = var.outbound_rule
content {
protocol = outbound_rule.value.protocol
port_range = outbound_rule.value.port_range
destination_addresses = outbound_rule.value.destination_addresses
destination_droplet_ids = var.droplet_ids
destination_kubernetes_ids = var.kubernetes_ids
destination_load_balancer_uids = var.load_balancer_uids
destination_tags = var.tags
}
}

tags = [
Expand All @@ -64,10 +57,8 @@ resource "digitalocean_firewall" "default" {
#Description : Provides a DigitalOcean database firewall resource allowing you to restrict connections to your database to trusted sources.
##------------------------------------------------------------------------------------------------------------------------------------------
resource "digitalocean_database_firewall" "default" {
count = var.enabled == true && var.database_cluster_id != null ? 1 : 0

count = var.enabled == true && var.database_cluster_id != null ? 1 : 0
cluster_id = var.database_cluster_id

dynamic "rule" {
for_each = var.rules
content {
Expand Down
10 changes: 3 additions & 7 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
#Module : Firewall
#Description : Provides a DigitalOcean Cloud Firewall resource. This can be used to create, modify, and delete Firewalls.
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "id" {
value = digitalocean_firewall.default[*].id
description = "A unique ID that can be used to identify and reference a Firewall."
}

output "name" {
value = digitalocean_firewall.default[*].name
description = "The name of the Firewall."
}

output "droplet_ids" {
value = digitalocean_firewall.default[*].droplet_ids
description = "The list of the IDs of the Droplets assigned to the Firewall."
}

output "inbound_rule" {
value = digitalocean_firewall.default[*].inbound_rule
description = "The inbound access rule block for the Firewall."
}

output "outbound_rule" {
value = digitalocean_firewall.default[*].outbound_rule
description = "The name of the Firewall."
}

output "database_uuid" {
value = digitalocean_database_firewall.default[*].id
description = "A unique identifier for the firewall rule."
Expand Down
28 changes: 26 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ variable "name" {
description = "Name (e.g. `app` or `cluster`)."
}


variable "environment" {
type = string
default = ""
Expand All @@ -31,7 +30,6 @@ variable "enabled" {
description = "Flag to control the firewall creation."
}


variable "allowed_ip" {
type = list(any)
default = []
Expand Down Expand Up @@ -84,4 +82,30 @@ variable "rules" {
type = any
default = []
description = "List of objects that represent the configuration of each inbound rule."
}

variable "outbound_rule" {
type = list(object({
protocol = string
port_range = string
destination_addresses = list(string)
}))
default = [
{
protocol = "tcp"
port_range = "1-65535"
destination_addresses = [
"0.0.0.0/0",
"::/0"]
destination_droplet_ids = []
},
{
protocol = "udp"
port_range = "1-65535"
destination_addresses = [
"0.0.0.0/0",
"::/0"]
}
]
description = "List of objects that represent the configuration of each outbound rule."
}

0 comments on commit bb3aec6

Please sign in to comment.