Skip to content

Commit f60ebb0

Browse files
Merge pull request openshift#7695 from hamzy/PowerVS-create-service-instance
MULTIARCH-2590: PowerVS create service instance
2 parents f87f13a + 8261f9e commit f60ebb0

File tree

33 files changed

+203
-668
lines changed

33 files changed

+203
-668
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,18 +4166,10 @@ spec:
41664166
description: PowerVSResourceGroup is the resource group in which
41674167
Power VS resources will be created.
41684168
type: string
4169-
pvsNetworkName:
4170-
description: PVSNetworkName specifies an existing network within
4171-
the Power VS Service Instance.
4172-
type: string
41734169
region:
41744170
description: Region specifies the IBM Cloud colo region where
41754171
the cluster will be created.
41764172
type: string
4177-
serviceInstanceID:
4178-
description: ServiceInstanceID is the ID of the Power IAAS instance
4179-
created from the IBM Cloud Catalog
4180-
type: string
41814173
userID:
41824174
description: UserID is the login for the user's IBM Cloud account.
41834175
type: string
@@ -4204,7 +4196,6 @@ spec:
42044196
type: string
42054197
required:
42064198
- powervsResourceGroup
4207-
- serviceInstanceID
42084199
- userID
42094200
- zone
42104201
type: object
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
data "ibm_resource_group" "group" {
2+
name = var.resource_group
3+
}
4+
5+
data "ibm_resource_instance" "powervs_service_instance" {
6+
name = "${var.cluster_id}-power-iaas"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
output "si_guid" {
2+
value = data.ibm_resource_instance.powervs_service_instance.guid
3+
}
4+
5+
output "si_crn" {
6+
value = data.ibm_resource_instance.powervs_service_instance.crn
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "cluster_id" {
2+
type = string
3+
description = "The ID created by the installer to uniquely identify the created cluster."
4+
}
5+
6+
variable "resource_group" {
7+
type = string
8+
description = "The name of the Power VS resource group to which the user belongs."
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_version = ">= 0.14"
3+
required_providers {
4+
ibm = {
5+
source = "openshift/local/ibm"
6+
}
7+
}
8+
}

data/data/powervs/bootstrap/main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module "vm" {
3030
proc_type = var.powervs_proc_type
3131
image_id = var.boot_image_id
3232
sys_type = var.powervs_sys_type
33-
cloud_instance_id = var.powervs_cloud_instance_id
33+
cloud_instance_id = module.iaas.si_guid
3434
dhcp_network_id = var.dhcp_network_id
3535
dhcp_id = var.dhcp_id
3636
proxy_server_ip = var.proxy_server_ip
@@ -51,3 +51,16 @@ module "lb" {
5151
api_pool_ext_id = var.api_pool_ext_id
5252
}
5353

54+
module "iaas" {
55+
providers = {
56+
ibm = ibm.vpc
57+
}
58+
source = "./iaas"
59+
60+
#
61+
# define and pass variables to:
62+
# data/data/powervs/bootstrap/iaas/variables.tf
63+
#
64+
cluster_id = var.cluster_id
65+
resource_group = var.powervs_resource_group
66+
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
provider "ibm" {
2-
ibmcloud_api_key = var.powervs_api_key
3-
}
4-
51
data "ibm_resource_group" "group" {
6-
name = var.powervs_resource_group
2+
name = var.resource_group
73
}
84

9-
resource "ibm_resource_instance" "resource_instance" {
5+
resource "ibm_resource_instance" "powervs_service_instance" {
106
name = "${var.cluster_id}-power-iaas"
117
service = "power-iaas"
128
plan = "power-virtual-server-group"
13-
location = var.powervs_region
14-
tags = concat(var.service_tags, ["${var.cluster_id}-power-iaas", "${var.cluster_id}"])
9+
location = var.powervs_zone
10+
tags = ["${var.cluster_id}-power-iaas", "${var.cluster_id}"]
1511
resource_group_id = data.ibm_resource_group.group.id
1612

1713
timeouts {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
output "si_guid" {
2+
value = ibm_resource_instance.powervs_service_instance.guid
3+
}
4+
5+
output "si_crn" {
6+
value = ibm_resource_instance.powervs_service_instance.crn
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
variable "cluster_id" {
2+
type = string
3+
description = "The ID created by the installer to uniquely identify the created cluster."
4+
}
5+
6+
variable "resource_group" {
7+
type = string
8+
description = "The name of the Power VS resource group to which the user belongs."
9+
}
10+
11+
variable "powervs_zone" {
12+
type = string
13+
description = "The Power VS zone in which to create resources."
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_version = ">= 0.14"
3+
required_providers {
4+
ibm = {
5+
source = "openshift/local/ibm"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)