Skip to content

Commit 4575f03

Browse files
committed
fix: Updated cloud-init for operator so users can select Oracle Linux 9
missing rule for bastion nsg to get yum updates. Signed-off-by: Ali Mukadam <[email protected]>
1 parent ba5171e commit 4575f03

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

module-operator.tf

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,26 @@ module "operator" {
5454
bastion_user = var.bastion_user
5555

5656
# Operator
57-
assign_dns = var.assign_dns
58-
availability_domain = coalesce(var.operator_availability_domain, lookup(local.ad_numbers_to_names, local.ad_numbers[0]))
59-
cloud_init = var.operator_cloud_init
60-
image_id = local.operator_image_id
61-
install_helm = var.operator_install_helm
62-
install_k9s = var.operator_install_k9s
63-
install_kubectx = var.operator_install_kubectx
64-
kubeconfig = yamlencode(local.kubeconfig_private)
65-
kubernetes_version = var.kubernetes_version
66-
nsg_ids = compact(flatten([var.operator_nsg_ids, try(module.network.operator_nsg_id, null)]))
67-
pv_transit_encryption = var.operator_pv_transit_encryption
68-
shape = var.operator_shape
69-
ssh_private_key = sensitive(local.ssh_private_key) # to await cloud-init completion
70-
ssh_public_key = local.ssh_public_key
71-
subnet_id = try(module.network.operator_subnet_id, "") # safe destroy; validated in submodule
72-
timezone = var.timezone
73-
upgrade = var.operator_upgrade
74-
user = var.operator_user
75-
volume_kms_key_id = var.operator_volume_kms_key_id
57+
assign_dns = var.assign_dns
58+
availability_domain = coalesce(var.operator_availability_domain, lookup(local.ad_numbers_to_names, local.ad_numbers[0]))
59+
cloud_init = var.operator_cloud_init
60+
image_id = local.operator_image_id
61+
install_helm = var.operator_install_helm
62+
install_k9s = var.operator_install_k9s
63+
install_kubectx = var.operator_install_kubectx
64+
kubeconfig = yamlencode(local.kubeconfig_private)
65+
kubernetes_version = var.kubernetes_version
66+
nsg_ids = compact(flatten([var.operator_nsg_ids, try(module.network.operator_nsg_id, null)]))
67+
operator_image_os_version = var.operator_image_os_version
68+
pv_transit_encryption = var.operator_pv_transit_encryption
69+
shape = var.operator_shape
70+
ssh_private_key = sensitive(local.ssh_private_key) # to await cloud-init completion
71+
ssh_public_key = local.ssh_public_key
72+
subnet_id = try(module.network.operator_subnet_id, "") # safe destroy; validated in submodule
73+
timezone = var.timezone
74+
upgrade = var.operator_upgrade
75+
user = var.operator_user
76+
volume_kms_key_id = var.operator_volume_kms_key_id
7677

7778
# Standard tags as defined if enabled for use, or freeform
7879
# User-provided tags are merged last and take precedence

modules/network/nsg-bastion.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ locals {
2020
protocol = local.tcp_protocol, port = local.ssh_port, source = cidr, source_type = local.rule_type_cidr,
2121
}
2222
},
23+
{
24+
"Allow TCP egress from bastion to OCI services" : {
25+
protocol = local.tcp_protocol, port = local.all_ports, destination = local.osn, destination_type = local.rule_type_service,
26+
},
27+
},
2328
local.operator_nsg_enabled ? {
2429
"Allow SSH egress from bastion to operator" = {
2530
protocol = local.tcp_protocol, port = local.ssh_port, destination = local.operator_nsg_id, destination_type = local.rule_type_nsg,

modules/operator/cloudinit.tf

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ locals {
77

88
# https://canonical-cloud-init.readthedocs-hosted.com/en/latest/reference/merging.html
99
default_cloud_init_merge_type = "list(append)+dict(no_replace,recurse_list)+str(append)"
10+
11+
baserepo = "ol${var.operator_image_os_version}"
12+
developer_EPEL = "${local.baserepo}_developer_EPEL"
13+
olcne17 = "${local.baserepo}_olcne17"
14+
developer_olcne = "${local.baserepo}_developer_olcne"
15+
1016
}
1117

1218
# https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/cloudinit_config.html
@@ -29,23 +35,23 @@ data "cloudinit_config" "operator" {
2935
var.install_helm ? "helm" : null,
3036
])
3137
yum_repos = {
32-
ol8_developer_EPEL = {
38+
"${local.developer_EPEL}" = {
3339
name = "Oracle Linux $releasever EPEL Packages for Development ($basearch)"
34-
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/developer/EPEL/$basearch/"
40+
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL${var.operator_image_os_version}/developer/EPEL/$basearch/"
3541
gpgkey = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
3642
gpgcheck = true
3743
enabled = true
3844
}
39-
ol8_olcne17 = {
45+
"${local.olcne17}" = {
4046
name = "Oracle Linux Cloud Native Environment 1.7 ($basearch)"
41-
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/olcne17/$basearch/"
47+
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL${var.operator_image_os_version}/olcne17/$basearch/"
4248
gpgkey = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
4349
gpgcheck = true
4450
enabled = true
4551
}
46-
ol8_developer_olcne = {
52+
"${local.developer_olcne}" = {
4753
name = "Developer Preview for Oracle Linux Cloud Native Environment ($basearch)"
48-
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/developer/olcne/$basearch/"
54+
baseurl = "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL${var.operator_image_os_version}/developer/olcne/$basearch/"
4955
gpgkey = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
5056
gpgcheck = true
5157
enabled = false

modules/operator/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ variable "install_kubectx" { type = bool }
2020
variable "kubeconfig" { type = string }
2121
variable "kubernetes_version" { type = string }
2222
variable "nsg_ids" { type = list(string) }
23+
variable "operator_image_os_version" { type = string}
2324
variable "pv_transit_encryption" { type = bool }
2425
variable "shape" { type = map(any) }
2526
variable "ssh_private_key" {

0 commit comments

Comments
 (0)