Skip to content

Commit 717692d

Browse files
authored
added support for private bastion, changed default shape to E4.Flex (#25)
* added support for private bastion, changed default shape to E4.Flex * updated changelog
1 parent e9be4a2 commit 717692d

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on {uri-changelog}[Keep a Changelog].
1313
* New variable (`bastion_operating_system_version`) to specify Autonomous Linux version (#15)
1414
* Added sort_order on images (#16)
1515
* New variable (`bastion_state`) to specify state of bastion host (#17)
16+
* Added support for private bastion host (#23)
1617

1718
=== Deprecation notice
1819

compute.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "oci_core_instance" "bastion" {
77
freeform_tags = var.tags
88

99
create_vnic_details {
10-
assign_public_ip = true
10+
assign_public_ip = var.bastion_type == "public" ? true : false
1111
display_name = var.label_prefix == "none" ? "bastion-vnic" : "${var.label_prefix}-bastion-vnic"
1212
hostname_label = "bastion"
1313
subnet_id = oci_core_subnet.bastion[0].id

docs/terraformoptions.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
146146
|`bastion_shape`
147147
|The shape of bastion instance. This is now specified as a map and supports E3.Flex. If a non-Flex shape is specified, then the other parameters are ignored.
148148
|e.g. `bastion_shape = {
149-
shape="VM.Standard.E3.Flex",
149+
shape="VM.Standard.E4.Flex",
150150
ocpus=1,
151151
memory=4,
152152
boot_volume_size=50
153153
}`
154154
|`bastion_shape = {
155-
shape="VM.Standard.E3.Flex",
155+
shape="VM.Standard.E4.Flex",
156156
ocpus=1,
157157
memory=4,
158158
boot_volume_size=50
@@ -163,6 +163,11 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
163163
|RUNNING|STOPPED
164164
|RUNNING
165165

166+
|`bastion_type`
167+
|Whether to make the bastion host public or private.
168+
|public|private
169+
|public
170+
166171
|`bastion_upgrade`
167172
|Whether to upgrade the bastion host packages after provisioning. It's useful to set this to false during development/testing so the bastion is provisioned faster.
168173
|true/false

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
output "bastion_public_ip" {
5-
value = join(",", data.oci_core_vnic.bastion_vnic.*.public_ip_address)
5+
value = join(",", var.bastion_type == "public" ? data.oci_core_vnic.bastion_vnic.*.public_ip_address : data.oci_core_vnic.bastion_vnic.*.private_ip_address )
66
}

subnets.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "oci_core_subnet" "bastion" {
77
display_name = var.label_prefix == "none" ? "bastion" : "${var.label_prefix}-bastion"
88
dns_label = "bastion"
99
freeform_tags = var.tags
10-
prohibit_public_ip_on_vnic = false
10+
prohibit_public_ip_on_vnic = var.bastion_type == "public" ? false : true
1111
route_table_id = var.ig_route_id
1212
security_list_ids = [oci_core_security_list.bastion[0].id]
1313
vcn_id = var.vcn_id

terraform.tfvars.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bastion_operating_system_version = "7.9"
4141

4242
bastion_shape = {
4343
# shape = "VM.Standard.E2.2"
44-
shape="VM.Standard.E3.Flex",
44+
shape="VM.Standard.E4.Flex",
4545
ocpus=1,
4646
memory=4,
4747
boot_volume_size=50

variables.tf

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,29 @@ variable "bastion_operating_system_version" {
105105
variable "bastion_shape" {
106106
description = "The shape of bastion instance."
107107
default = {
108-
shape = "VM.Standard.E3.Flex", ocpus = 1, memory = 4, boot_volume_size = 50
108+
shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 4, boot_volume_size = 50
109109
}
110110
type = map(any)
111111
}
112112

113-
variable "bastion_upgrade" {
114-
description = "Whether to upgrade the bastion host packages after provisioning. It's useful to set this to false during development/testing so the bastion is provisioned faster."
115-
default = false
116-
type = bool
117-
}
118-
119113
variable "bastion_state" {
120114
description = "The target state for the instance. Could be set to RUNNING or STOPPED. (Updatable)"
121115
default = "RUNNING"
122116
type = string
123117
}
124118

119+
variable "bastion_type" {
120+
description = "Whether to make the bastion host public or private."
121+
default = "public"
122+
type = string
123+
}
124+
125+
variable "bastion_upgrade" {
126+
description = "Whether to upgrade the bastion host packages after provisioning. It's useful to set this to false during development/testing so the bastion is provisioned faster."
127+
default = false
128+
type = bool
129+
}
130+
125131
variable "ssh_public_key" {
126132
description = "the content of the ssh public key used to access the bastion. set this or the ssh_public_key_path"
127133
default = ""

0 commit comments

Comments
 (0)