Skip to content

Commit 6488d45

Browse files
feat: fixed log config issue (#7)
* feat: fixed log config issue * feat: formated code
1 parent 2ef0822 commit 6488d45

File tree

13 files changed

+150
-25
lines changed

13 files changed

+150
-25
lines changed

.github/workflows/tfchecks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ on:
55
pull_request:
66
workflow_dispatch:
77
jobs:
8-
tf-checks-example:
8+
tf-checks-basic-example:
99
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
1010
with:
11-
working_directory: './_example/'
11+
working_directory: './example/basic'
12+
13+
tf-checks-complete-example:
14+
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
15+
with:
16+
working_directory: './example/complete'

README.yaml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66

77
# Name of this project
8-
name : Terraform gcp subnet
8+
name : Terraform GCP Subnet
99

1010
# License of this project
1111
license: "APACHE"
@@ -15,18 +15,28 @@ github_repo: clouddrove/terraform-gcp-subnet
1515

1616
# Badges to display
1717
badges:
18-
- name: "Terraform"
19-
image: "https://img.shields.io/badge/Terraform-v1.1.7-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"
18+
- name: "Latest Release"
19+
image: "https://img.shields.io/github/release/clouddrove/terraform-gcp-subnet.svg"
20+
url: "https://github.com/clouddrove/terraform-gcp-subnet/releases/latest"
2421
- name: "tfsec"
2522
image: "https://github.com/clouddrove/terraform-gcp-subnet/actions/workflows/tfsec.yml/badge.svg"
2623
url: "https://github.com/clouddrove/terraform-gcp-subnet/actions/workflows/tfsec.yml"
27-
- name: "static-checks"
28-
image: "https://github.com/clouddrove/terraform-gcp-subnet/actions/workflows/terraform.yml/badge.svg"
29-
url: "https://github.com/clouddrove/terraform-gcp-subnet/actions/workflows/terraform.yml"
24+
- name: "Licence"
25+
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
26+
url: "LICENSE.md"
27+
- name: "Changelog"
28+
image: "https://img.shields.io/badge/Changelog-blue"
29+
url: "CHANGELOG.md"
30+
31+
prerequesties:
32+
- name: Terraform
33+
url: https://learn.hashicorp.com/terraform/getting-started/install.html
34+
version: ">= 1.4.6"
35+
36+
providers:
37+
- name: gcp
38+
url: https://cloud.google.com/
39+
version: ">= 5.22.0"
3040

3141
# description of this project
3242
description: |-

_example/example.tf renamed to example/basic/example.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ module "vpc" {
99
version = "1.0.0"
1010

1111
name = "vpc"
12-
environment = "test"
12+
environment = "test-1"
1313
label_order = ["environment", "name"]
1414
google_compute_network_enabled = true
1515
}
1616

1717

1818
module "subnet" {
19-
source = "../"
19+
source = "../../"
2020

2121
name = "dev"
2222
environment = var.environment
@@ -31,7 +31,6 @@ module "subnet" {
3131
network = module.vpc.vpc_id
3232
project_id = "clouddrove"
3333
private_ip_google_access = true
34-
allow = [{ "protocol" : "tcp", "ports" : ["1-65535"] }]
3534
source_ranges = ["10.10.0.0/16"]
3635
asn = 64514
3736
nat_ip_allocate_option = "MANUAL_ONLY"
@@ -51,4 +50,10 @@ module "subnet" {
5150
"ip_cidr_range" : "10.3.0.0/16"
5251
}
5352
]
53+
allow = [
54+
{
55+
"protocol" : "tcp",
56+
"ports" : ["1-65535"]
57+
}
58+
]
5459
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

example/complete/example.tf

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
provider "google" {
2+
project = var.gcp_project_id
3+
region = var.gcp_region
4+
zone = var.gcp_zone
5+
}
6+
7+
module "vpc" {
8+
source = "clouddrove/vpc/gcp"
9+
version = "1.0.0"
10+
11+
name = "vpc"
12+
environment = "test-1"
13+
label_order = ["environment", "name"]
14+
google_compute_network_enabled = true
15+
}
16+
17+
18+
module "subnet" {
19+
source = "../../"
20+
21+
name = "dev"
22+
environment = var.environment
23+
label_order = var.label_order
24+
gcp_region = "us-central1"
25+
26+
google_compute_subnetwork_enabled = true
27+
google_compute_firewall_enabled = true
28+
google_compute_router_nat_enabled = true
29+
module_enabled = true
30+
ipv6_access_type = "EXTERNAL"
31+
network = module.vpc.vpc_id
32+
project_id = "clouddrove"
33+
private_ip_google_access = true
34+
source_ranges = ["10.10.0.0/16"]
35+
asn = 64514
36+
nat_ip_allocate_option = "MANUAL_ONLY"
37+
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
38+
filter = "ERRORS_ONLY"
39+
dest_range = "0.0.0.0/0"
40+
next_hop_gateway = "default-internet-gateway"
41+
priority = 1000
42+
secondary_ip_ranges = [
43+
{
44+
"range_name" : "services",
45+
"ip_cidr_range" : "10.1.0.0/16"
46+
},
47+
48+
{
49+
"range_name" : "pods",
50+
"ip_cidr_range" : "10.3.0.0/16"
51+
}
52+
]
53+
allow = [
54+
{
55+
"protocol" : "tcp",
56+
"ports" : ["1-65535"]
57+
}
58+
]
59+
log_config = {
60+
aggregation_interval = "INTERVAL_15_MIN"
61+
flow_sampling = 0
62+
metadata = "EXCLUDE_ALL_METADATA"
63+
}
64+
}

example/complete/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "id" {
2+
value = module.subnet[*].id
3+
description = "The ID of the s3 bucket."
4+
}

example/complete/varriables.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
variable "environment" {
2+
type = string
3+
default = "subnetwork"
4+
description = "Environment name"
5+
}
6+
7+
variable "label_order" {
8+
type = list(any)
9+
default = ["name", "environment"]
10+
description = "Label order, e.g. `name`,`application`."
11+
}
12+
13+
variable "gcp_project_id" {
14+
type = string
15+
default = "clouddrove"
16+
description = "Google Cloud project ID"
17+
}
18+
19+
variable "gcp_region" {
20+
type = string
21+
default = "europe-west3"
22+
description = "Google Cloud region"
23+
}
24+
25+
variable "gcp_zone" {
26+
type = string
27+
default = "Europe-west3-c"
28+
description = "Google Cloud zone"
29+
}

example/complete/versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 0.14, < 2.0"
3+
4+
required_providers {
5+
google = {
6+
source = "hashicorp/google"
7+
version = ">= 3.50, < 5.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)