Initial Oracle Deep Data Security lab kit
This commit is contained in:
30
terraform/modules/compute_bastion/main.tf
Normal file
30
terraform/modules/compute_bastion/main.tf
Normal file
@@ -0,0 +1,30 @@
|
||||
resource "oci_core_instance" "this" {
|
||||
availability_domain = var.availability_domain
|
||||
compartment_id = var.compartment_id
|
||||
display_name = var.display_name
|
||||
shape = var.shape
|
||||
freeform_tags = var.freeform_tags
|
||||
|
||||
dynamic "shape_config" {
|
||||
for_each = length(regexall("Flex$", var.shape)) > 0 ? [1] : []
|
||||
content {
|
||||
ocpus = var.ocpus
|
||||
memory_in_gbs = var.memory_in_gbs
|
||||
}
|
||||
}
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = var.subnet_id
|
||||
assign_public_ip = var.assign_public_ip
|
||||
nsg_ids = var.nsg_ids
|
||||
}
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_public_key
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = var.image_ocid
|
||||
}
|
||||
}
|
||||
10
terraform/modules/compute_bastion/outputs.tf
Normal file
10
terraform/modules/compute_bastion/outputs.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
output "instance_id" {
|
||||
description = "Bastion instance OCID."
|
||||
value = oci_core_instance.this.id
|
||||
}
|
||||
|
||||
output "public_ip" {
|
||||
description = "Bastion public IP."
|
||||
value = oci_core_instance.this.public_ip
|
||||
}
|
||||
|
||||
63
terraform/modules/compute_bastion/variables.tf
Normal file
63
terraform/modules/compute_bastion/variables.tf
Normal file
@@ -0,0 +1,63 @@
|
||||
variable "compartment_id" {
|
||||
description = "Compartment OCID."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "display_name" {
|
||||
description = "Instance display name."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "shape" {
|
||||
description = "Compute shape."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ocpus" {
|
||||
description = "OCPUs for flexible shapes."
|
||||
type = number
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "memory_in_gbs" {
|
||||
description = "Memory in GB for flexible shapes."
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
|
||||
variable "image_ocid" {
|
||||
description = "Image OCID."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "subnet_id" {
|
||||
description = "Subnet OCID."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "nsg_ids" {
|
||||
description = "NSG OCIDs."
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "ssh_public_key" {
|
||||
description = "SSH public key."
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "assign_public_ip" {
|
||||
description = "Assign public IP to bastion."
|
||||
type = bool
|
||||
}
|
||||
|
||||
variable "freeform_tags" {
|
||||
description = "Freeform tags."
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
9
terraform/modules/compute_bastion/versions.tf
Normal file
9
terraform/modules/compute_bastion/versions.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
oci = {
|
||||
source = "oracle/oci"
|
||||
version = ">= 6.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user