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

Makes possible to attach additional or replace default security groups to subnets #96

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ provider.tf
# macOS related files
**/.DS_Store
.terraform.lock.hcl
**/.idea/*
3 changes: 3 additions & 0 deletions modules/subnet/data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "oci_core_vcn" "vcn_this" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this datasource is not used anywhere and should be removed

vcn_id = var.vcn_id
}
3 changes: 1 addition & 2 deletions modules/subnet/subnet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ resource "oci_core_subnet" "vcn_subnet" {
#prohibit_internet_ingress = var.enable_ipv6 && lookup(each.value,"type","public") == "public" ? each.value.prohibit_internet_ingress : false
prohibit_public_ip_on_vnic = lookup(each.value, "type", "public") == "public" ? false : true
route_table_id = lookup(each.value, "type", "public") == "public" ? var.ig_route_id : var.nat_route_id
security_list_ids = null
security_list_ids = lookup(each.value, "security_list_ids", null)
}

data "oci_core_dhcp_options" "dhcp_options" {

compartment_id = var.compartment_id
vcn_id = var.vcn_id
}
1 change: 1 addition & 0 deletions terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ attached_drg_id = null
#subnets = {
# sub1 = {name = "subnet1",cidr_block = "10.0.4.0/24"}
# sub2 = {cidr_block="10.0.5.0/24",type="private"}
# sub3 = {cidr_block="10.0.6.0/24",type="private", security_list_ids=["ocid1.securitylist.oc1.eu-frankfurt-1.aaaa","ocid1.securitylist.oc1.eu-frankfurt-1.bbbb"]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subnet module is a submodule of vcn module. The security list must be created inside the VCN to be assigned to any subnet. Hence you can not have security lists created previous to the VCN itself. How do you intend to use this feature in a real scenario?

#}