Skip to content

Commit 03fa1ff

Browse files
committed
fix coding conventions related problems
- Use snake_case when naming variables/resources - If your variable is controlling a behaviour, use imperative style to name it e.g. lockdown_default_seclist - Use simple file names where possible; avoid '-', '' for terraform files. '' is ok for bash/python. - Add documentation for new variable in docs/terraformoptions.adoc
1 parent afd82ea commit 03fa1ff

File tree

11 files changed

+109
-105
lines changed

11 files changed

+109
-105
lines changed

docs/terraformoptions.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,9 @@ tags = {
111111
|
112112
|
113113

114+
|`lockdown_default_seclist`
115+
|whether to remove all default security rules from the VCN Default Security List
116+
|true/false
117+
|true
118+
114119
|===

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module "vcn" {
7878
vcn_cidr = var.vcn_cidr
7979
vcn_dns_label = var.vcn_dns_label
8080
vcn_name = var.vcn_name
81-
default_SL_lockdown = var.default_SL_lockdown
81+
lockdown_default_seclist = var.lockdown_default_seclist
8282
}
8383
```
8484

examples/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2020 Oracle Corporation and/or affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2021, Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
module "vcn" {
@@ -25,7 +25,7 @@ module "vcn" {
2525

2626
vcn_name = "vcn"
2727

28-
default_SL_lockdown = "true"
28+
lockdown_default_seclist = true
2929

3030
tags = {
3131
environment = "dev"

examples/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2020 Oracle Corporation and/or affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2021, Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
# provider identity parameters
@@ -83,7 +83,7 @@ variable "vcn_name" {
8383
type = string
8484
}
8585

86-
variable "default_SL_lockdown" {
86+
variable "lockdown_default_seclist" {
8787
description = "whether to remove all default security rules from the VCN Default Security List"
8888
default = true
8989
type = bool

nat.tf

Lines changed: 0 additions & 40 deletions
This file was deleted.

schema.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ groupings:
99
- vcn_cidr
1010
- vcn_name
1111
- vcn_dns_label
12-
- default_SL_lockdown
12+
- lockdown_default_seclist
1313

1414
variables:
1515
region:
@@ -49,7 +49,7 @@ variables:
4949
required: true
5050
default: vcn
5151

52-
default_SL_lockdown:
52+
lockdown_default_seclist:
5353
title: Enable VCN Default Security List Lockdown
5454
type: string
5555
required: false

servicegateway.tf

Lines changed: 0 additions & 25 deletions
This file was deleted.

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ variable "vcn_name" {
6666
type = string
6767
}
6868

69-
variable "default_SL_lockdown" {
69+
variable "lockdown_default_seclist" {
7070
description = "whether to remove all default security rules from the VCN Default Security List"
7171
default = true
7272
type = bool

vcn.tf

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2020 Oracle Corporation and/or affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2021, Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
resource "oci_core_vcn" "vcn" {
@@ -9,30 +9,3 @@ resource "oci_core_vcn" "vcn" {
99

1010
freeform_tags = var.tags
1111
}
12-
13-
resource "oci_core_internet_gateway" "ig" {
14-
compartment_id = var.compartment_id
15-
display_name = var.label_prefix == "none" ? "internet-gateway" : "${var.label_prefix}-internet-gateway"
16-
17-
freeform_tags = var.tags
18-
19-
vcn_id = oci_core_vcn.vcn.id
20-
21-
count = var.internet_gateway_enabled == true ? 1 : 0
22-
}
23-
24-
resource "oci_core_route_table" "ig" {
25-
compartment_id = var.compartment_id
26-
display_name = var.label_prefix == "none" ? "internet-route" : "${var.label_prefix}-internet-route"
27-
28-
freeform_tags = var.tags
29-
30-
route_rules {
31-
destination = local.anywhere
32-
network_entity_id = oci_core_internet_gateway.ig[0].id
33-
}
34-
35-
vcn_id = oci_core_vcn.vcn.id
36-
37-
count = var.internet_gateway_enabled == true ? 1 : 0
38-
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Copyright (c) 2021 Oracle Corporation and/or affiliates.
1+
# Copyright (c) 2021, Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
# VCN default Security List Lockdown
5-
// See Issue #22 for
5+
// See Issue #22 for the reasoning
66
resource "oci_core_default_security_list" "lockdown" {
77
// If variable is true, removes all rules from default security list
8-
count = var.default_SL_lockdown == true ? 1 : 0
8+
count = var.lockdown_default_seclist == true ? 1 : 0
99
manage_default_resource_id = oci_core_vcn.vcn.default_security_list_id
1010
}
1111

1212
resource "oci_core_default_security_list" "restore_default" {
1313
// If variable is false, restore all default rules to default security list
14-
count = var.default_SL_lockdown == false ? 1 : 0
14+
count = var.lockdown_default_seclist == false ? 1 : 0
1515
manage_default_resource_id = oci_core_vcn.vcn.default_security_list_id
1616

1717
egress_security_rules {

0 commit comments

Comments
 (0)