From a071804dd4421f7b8148987166106c5d6a28c961 Mon Sep 17 00:00:00 2001 From: Tasdik Rahman Date: Sat, 23 Sep 2017 22:20:32 +0530 Subject: [PATCH] v0.0.1 --- LICENSE | 22 ++++++++++++++++++++++ input.tf | 11 +++++++++++ main.tf | 12 ++++++++++++ output.tf | 3 +++ 4 files changed, 48 insertions(+) create mode 100644 LICENSE create mode 100644 input.tf create mode 100644 main.tf create mode 100644 output.tf diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..207aac0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ + +MIT License + +Copyright (c) 2017 tasdikrahman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/input.tf b/input.tf new file mode 100644 index 0000000..fa5b363 --- /dev/null +++ b/input.tf @@ -0,0 +1,11 @@ +variable name {} +variable network {} +variable protocol {} + +variable ports { + type = "list" +} + +variable source_ranges { + type = "list" +} diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..3494b38 --- /dev/null +++ b/main.tf @@ -0,0 +1,12 @@ +resource "google_compute_firewall" "new-firewall" { + name = "${var.network}-firewall-${var.name}" + network = "${var.network}" + + allow { + protocol = "${var.protocol}" + ports = "${var.ports}" + } + + target_tags = ["${var.network}-firewall-${var.name}"] + source_ranges = "${var.source_ranges}" +} diff --git a/output.tf b/output.tf new file mode 100644 index 0000000..2cfb3dc --- /dev/null +++ b/output.tf @@ -0,0 +1,3 @@ +output "self_link" { + value = "${google_compute_firewall.new-firewall.self_link}" +}