Skip to content

Commit e9be4a2

Browse files
hyderkral2
andauthored
added state and OS version for bastion host, renamed control variable… (#19)
* add State and OS version for bastion host * add sort order on images * add deprecation notice for bastion_enabled Input Variable Co-authored-by: Çetin ARDAL <[email protected]>
1 parent cb55448 commit e9be4a2

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed

CHANGELOG.adoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ All notable changes to this project are documented in this file.
77

88
The format is based on {uri-changelog}[Keep a Changelog].
99

10+
= Unreleased
11+
12+
== New features
13+
* New variable (`bastion_operating_system_version`) to specify Autonomous Linux version (#15)
14+
* Added sort_order on images (#16)
15+
* New variable (`bastion_state`) to specify state of bastion host (#17)
16+
17+
=== Deprecation notice
18+
19+
The following variables will be renamed at the next major release of this module (related to #18):
20+
21+
* var.bastion_enabled --> var.create_bastion
22+
23+
= v2.0.0 (December 8, 2020)
24+
* Added support for flex shapes (#11)
25+
* Set default launch options to PARAVIRTUALIZED
26+
* Set minimum version to Terraform 0.13 (#12)
27+
1028
= v1.0.7 (August 31,2020)
1129
* Reversed 1.04 and and 1.0.5 (#9)
1230

compute.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ resource "oci_core_instance" "bastion" {
4646
source_id = local.bastion_image_id
4747
}
4848

49+
state = var.bastion_state
50+
4951
timeouts {
5052
create = "60m"
5153
}

datasources.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ data "template_file" "autonomous_cloud_init_file" {
5151
data "oci_core_images" "autonomous_images" {
5252
compartment_id = var.compartment_id
5353
operating_system = "Oracle Autonomous Linux"
54+
operating_system_version = var.bastion_operating_system_version
5455
shape = lookup(var.bastion_shape, "shape", "VM.Standard.E2.2")
5556
sort_by = "TIMECREATED"
57+
sort_order = "DESC"
5658
}
5759

5860
# cloud init for bastion

docs/terraformoptions.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
105105
|`netnum`
106106
|0-based index of the bastion subnet when the VCN's CIDR is masked with the corresponding newbit value.
107107
|
108-
|32
108+
|0
109109

110110
|`newbits`
111111
|The difference between the VCN's netmask and the desired bastion subnet mask.
112112
|
113-
|13
113+
|14
114114

115115
|`vcn_id`
116116
|The id of the VCN to use when creating the bastion resources. *Required*
@@ -138,6 +138,11 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
138138
|imageid/Autonomous
139139
|Autonomous
140140

141+
|`bastion_operating_system_version`
142+
|In case Autonomous Linux is used, allow specification of Autonomous version
143+
|
144+
|7.9
145+
141146
|`bastion_shape`
142147
|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.
143148
|e.g. `bastion_shape = {
@@ -153,6 +158,11 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
153158
boot_volume_size=50
154159
}`
155160

161+
|`bastion_state`
162+
|The target state for the instance. Could be set to RUNNING or STOPPED. (Updatable)
163+
|RUNNING|STOPPED
164+
|RUNNING
165+
156166
|`bastion_upgrade`
157167
|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.
158168
|true/false

terraform.tfvars.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ bastion_enabled = true
3737

3838
bastion_image_id = "Autonomous"
3939

40+
bastion_operating_system_version = "7.9"
41+
4042
bastion_shape = {
4143
# shape = "VM.Standard.E2.2"
4244
shape="VM.Standard.E3.Flex",
@@ -45,6 +47,8 @@ bastion_shape = {
4547
boot_volume_size=50
4648
}
4749

50+
bastion_state= "RUNNING"
51+
4852
bastion_upgrade = false
4953

5054
ssh_public_key = ""

variables.tf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ variable "ig_route_id" {
6666

6767
variable "netnum" {
6868
description = "0-based index of the bastion subnet when the VCN's CIDR is masked with the corresponding newbit value."
69-
default = 32
69+
default = 0
7070
type = number
7171
}
7272

7373
variable "newbits" {
7474
description = "The difference between the VCN's netmask and the desired bastion subnet mask"
75-
default = 13
75+
default = 14
7676
type = number
7777
}
7878

@@ -84,6 +84,7 @@ variable "vcn_id" {
8484
# bastion host parameters
8585

8686
variable "bastion_enabled" {
87+
#! Deprecation notice: will be renamed to create_bastion at next major release
8788
description = "whether to create the bastion"
8889
default = false
8990
type = bool
@@ -95,6 +96,12 @@ variable "bastion_image_id" {
9596
type = string
9697
}
9798

99+
variable "bastion_operating_system_version" {
100+
description = "In case Autonomous Linux is used, allow specification of Autonomous version"
101+
default = "7.9"
102+
type = string
103+
}
104+
98105
variable "bastion_shape" {
99106
description = "The shape of bastion instance."
100107
default = {
@@ -109,6 +116,12 @@ variable "bastion_upgrade" {
109116
type = bool
110117
}
111118

119+
variable "bastion_state" {
120+
description = "The target state for the instance. Could be set to RUNNING or STOPPED. (Updatable)"
121+
default = "RUNNING"
122+
type = string
123+
}
124+
112125
variable "ssh_public_key" {
113126
description = "the content of the ssh public key used to access the bastion. set this or the ssh_public_key_path"
114127
default = ""

0 commit comments

Comments
 (0)