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

deny ssh #13

Merged
merged 1 commit into from
Feb 21, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ override.tf.json

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

.DS_Store
# Ignore CLI configuration files
.terraformrc
terraform.rc
Expand Down
27 changes: 20 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ provider "google" {
region = var.region
}

resource "random_string" "vpc_suffix" {
length = 4
lower = true
upper = false
special = false
}
# resource "random_string" "vpc_suffix" {
# length = 4
# lower = true
# upper = false
# special = false
# }

resource "google_compute_network" "private_vpc" {
name = var.vpc_name
Expand Down Expand Up @@ -44,8 +44,21 @@ resource "google_compute_firewall" "private_vpc_firewall" {

allow {
protocol = var.webapp_firewall_protocol
ports = var.webapp_firewall_protocol_ports
ports = var.webapp_firewall_protocol_allow_ports
}
source_tags = var.webapp_firewall_source_tags
target_tags = var.webapp_firewall_target_tags
}

resource "google_compute_firewall" "private_vpc_firewall1" {
name = var.webapp_firewall_ssh
network = google_compute_network.private_vpc.name

deny {
protocol = var.webapp_firewall_protocol
ports = var.webapp_firewall_protocol_deny_ports
}

source_tags = var.webapp_firewall_source_tags
target_tags = var.webapp_firewall_target_tags
}
Expand Down
10 changes: 9 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ variable "webapp_firewall_protocol" {
type = string
}

variable "webapp_firewall_protocol_ports" {
variable "webapp_firewall_ssh" {
type = string
}

variable "webapp_firewall_protocol_allow_ports" {
type = list(string)
}

variable "webapp_firewall_protocol_deny_ports" {
type = list(string)
}

Expand Down
Loading