Skip to content

Commit

Permalink
added support to specify state of bastion instance (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyder authored May 11, 2021
1 parent a37aa0a commit d589ac2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 29 deletions.
10 changes: 10 additions & 0 deletions docs/terraformoptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ Configuration Terraform Options:
|imageid/Autonomous
|Autonomous

|`bastion_operating_system_version`
|The version of the operating system.
|7.9
|7.9

|`bastion_shape`
|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.
|e.g. `bastion_shape = {
Expand All @@ -241,6 +246,11 @@ Configuration Terraform Options:
boot_volume_size=50
}`

|`bastion_shape`
|The default state of the bastion compute instance.
|RUNNING | STOPPED
|RUNNING

|`bastion_upgrade`
|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.
|true/false
Expand Down
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module "vcn" {

module "bastion" {
source = "oracle-terraform-modules/bastion/oci"
version = "2.0.0"
version = "2.1.0"

# provider identity parameters
api_fingerprint = var.oci_base_provider.api_fingerprint
Expand All @@ -54,13 +54,15 @@ module "bastion" {
vcn_id = module.vcn.vcn_id

# bastion parameters
bastion_enabled = var.oci_base_bastion.bastion_enabled
bastion_image_id = var.oci_base_bastion.bastion_image_id
bastion_shape = var.oci_base_bastion.bastion_shape
bastion_upgrade = var.oci_base_bastion.bastion_upgrade
ssh_public_key = var.oci_base_bastion.ssh_public_key
ssh_public_key_path = var.oci_base_bastion.ssh_public_key_path
timezone = var.oci_base_bastion.timezone
bastion_enabled = var.oci_base_bastion.bastion_enabled
bastion_image_id = var.oci_base_bastion.bastion_image_id
bastion_operating_system_version = var.oci_base_bastion.bastion_operating_system_version
bastion_shape = var.oci_base_bastion.bastion_shape
bastion_state = var.oci_base_bastion.bastion_state
bastion_upgrade = var.oci_base_bastion.bastion_upgrade
ssh_public_key = var.oci_base_bastion.ssh_public_key
ssh_public_key_path = var.oci_base_bastion.ssh_public_key_path
timezone = var.oci_base_bastion.timezone

# notification
notification_enabled = var.oci_base_bastion.notification_enabled
Expand Down
2 changes: 2 additions & 0 deletions terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ oci_base_bastion = {
bastion_access = "ANYWHERE"
bastion_enabled = true
bastion_image_id = "Autonomous"
bastion_operating_system_version = "7.9"
bastion_shape = {
# shape = "VM.Standard.E2.2"
shape="VM.Standard.E3.Flex",
ocpus=1,
memory=4,
boot_volume_size=50
}
bastion_state = "RUNNING"
bastion_upgrade = true
netnum = 0
newbits = 14
Expand Down
46 changes: 25 additions & 21 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,37 +62,41 @@ variable "oci_base_vcn" {

variable "oci_base_bastion" {
type = object({
availability_domain = number
bastion_access = string
bastion_enabled = bool
bastion_image_id = string
bastion_shape = map(any)
bastion_upgrade = bool
netnum = number
newbits = number
notification_enabled = bool
notification_endpoint = string
notification_protocol = string
notification_topic = string
ssh_private_key_path = string
ssh_public_key = string
ssh_public_key_path = string
tags = map(any)
timezone = string
availability_domain = number
bastion_access = string
bastion_enabled = bool
bastion_image_id = string
bastion_operating_system_version = string
bastion_shape = map(any)
bastion_state = string
bastion_upgrade = bool
netnum = number
newbits = number
notification_enabled = bool
notification_endpoint = string
notification_protocol = string
notification_topic = string
ssh_private_key_path = string
ssh_public_key = string
ssh_public_key_path = string
tags = map(any)
timezone = string
})
description = "bastion host parameters"
default = {
availability_domain = 1
bastion_access = "ANYWHERE"
bastion_enabled = false
bastion_image_id = "Autonomous"
availability_domain = 1
bastion_access = "ANYWHERE"
bastion_enabled = false
bastion_image_id = "Autonomous"
bastion_operating_system_version = "7.9"
bastion_shape = {
# shape = "VM.Standard.E2.2"
shape = "VM.Standard.E3.Flex",
ocpus = 1,
memory = 4,
boot_volume_size = 50
}
bastion_state = "RUNNING"
bastion_upgrade = true
netnum = 0
newbits = 14
Expand Down

0 comments on commit d589ac2

Please sign in to comment.