-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
716 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,48 @@ | ||
variable "vnf_f5bigip_cos_instance_id" { | ||
default = "" | ||
description = "The COS instance-id hosting the F5-BIGIP qcow2 image." | ||
} | ||
variable "vnf_f5bigip_cos_image_url" { | ||
default = "" | ||
description = "The COS image object url for F5-BIGIP qcow2 image." | ||
} | ||
|
||
variable "zone" { | ||
default = "us-south-1" | ||
default = "us-south-1" | ||
description = "The VPC Zone that you want your VPC networks and virtual servers to be provisioned in. To list available zones, run `ibmcloud is zones`." | ||
} | ||
|
||
variable "vpc_name" { | ||
default = "f5-bigip-1nic-demo-vpc" | ||
default = "f5-1arm-vpc" | ||
description = "The name of your VPC to be provisioned." | ||
} | ||
|
||
variable "ssh_public_key" { | ||
default = "" | ||
default = "" | ||
description = "The [public SSH key](https://cloud.ibm.com/docs/vpc-on-classic-vsi?topic=vpc-on-classic-vsi-ssh-keys) that you use to access your VPC virtual servers. Use the public key from the `~/.ssh/id_rsa.pub` file generated by the latest version of ssh-keygen tool, with the recommended key-size 2048." | ||
} | ||
|
||
variable "ssh_key_name" { | ||
default = "f5-ssh-pub-key" | ||
default = "f5-sshkey" | ||
description = "The name of the public SSH key." | ||
} | ||
|
||
variable "f5_image" { | ||
default = "r006-648e7564-a7e1-40d5-8e92-6ff67c26ce9c" | ||
description = "The ID of the F5 custom image provisioned in your IBM Cloud account. To list available images, run `ibmcloud is images`. The default image is for an `f5-bigip` image in a demo account." | ||
variable "f5_image_name" { | ||
default = "f5-bigip-15-0-1-0-0-11" | ||
description = "The name of the F5 custom image to be provisioned in your IBM Cloud account." | ||
} | ||
|
||
variable "f5_vsi_name" { | ||
default = "f5-bigip-1nic-demo-appliance" | ||
default = "f5-1arm-vsi" | ||
description = "The name of your F5 Virtual Server to be provisioned." | ||
} | ||
|
||
variable "profile" { | ||
default = "bx2-2x8" | ||
default = "bx2-2x8" | ||
description = "The profile of compute CPU and memory resources that you want your VPC virtual servers to have. To list available profiles, run `ibmcloud is instance-profiles`." | ||
} | ||
|
||
variable "f5_license" { | ||
default = "" | ||
default = "" | ||
description = "Optional. The BYOL license key that you want your F5 virtual server in a VPC to be used by registration flow during cloud-init." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
############################################################################## | ||
# This file creates two compute instances that will be used by PoC to setup | ||
# F5-BIGIP loadbalancer. Each of the backend server will be enabled with nginx | ||
# and a customize welcome page via cloud-init. | ||
# - Two Virtual Server using ubuntu-18-04-amd64 | ||
############################################################################## | ||
|
||
data "template_file" "welcom_page" { | ||
template = "${file("${path.module}/templates/index.nginx-debian.html.tpl")}" | ||
vars = { | ||
server_marker = "One" | ||
} | ||
} | ||
|
||
############################################################################## | ||
# Read Public Image using the image name and visibility | ||
############################################################################## | ||
data "ibm_is_image" "ubuntu_18_image" { | ||
name = "ibm-ubuntu-18-04-64" | ||
visibility = "public" | ||
} | ||
|
||
resource "ibm_is_instance" "backend_vsi" { | ||
count = 2 | ||
name = "backend-vsi-0${count.index}" | ||
image = "${data.ibm_is_image.ubuntu_18_image.id}" | ||
profile = "cx2-2x4" | ||
|
||
primary_network_interface = { | ||
subnet = "${ibm_is_subnet.f5_subnet1.id}" | ||
} | ||
|
||
vpc = "${ibm_is_vpc.f5_vpc.id}" | ||
zone = "${var.zone}" | ||
keys = ["${ibm_is_ssh_key.f5_ssh_pub_key.id}"] | ||
user_data = <<EOF | ||
#!/bin/bash -v | ||
apt-get update -y | ||
apt-get install -y nginx > /tmp/nginx.log | ||
echo "${base64encode(data.template_file.welcom_page.rendered)}" | base64 -d | sed 's/SERVER_MARKER/${count.index}/g' > /var/www/html/index.nginx-debian.html | ||
service nginx start | ||
EOF | ||
|
||
//User can configure timeouts | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
############################################################################## | ||
# This file creates the compute instances for the solution. | ||
# - Virtual Server using F5-BIGIP custom image | ||
# - Two virtual servers initialized with nginx to demo Load Balancing using F5-BIGIP | ||
############################################################################## | ||
|
||
|
||
############################################################################## | ||
# Create ssh key for all virtual servers. | ||
############################################################################## | ||
resource "ibm_is_ssh_key" "f5_ssh_pub_key" { | ||
name = "${var.ssh_key_name}" | ||
public_key = "${var.ssh_public_key}" | ||
} | ||
|
||
############################################################################## | ||
# Create F5-BIGIP virtual server. | ||
############################################################################## | ||
resource "ibm_is_instance" "f5_vsi" { | ||
name = "${var.f5_vsi_name}" | ||
image = "${data.ibm_is_image.f5_custom_image.id}" | ||
profile = "${var.profile}" | ||
|
||
primary_network_interface = { | ||
subnet = "${ibm_is_subnet.f5_subnet1.id}" | ||
} | ||
|
||
vpc = "${ibm_is_vpc.f5_vpc.id}" | ||
zone = "${var.zone}" | ||
keys = ["${ibm_is_ssh_key.f5_ssh_pub_key.id}"] | ||
# user_data = "$(replace(file("f5-userdata.sh"), "F5-LICENSE-REPLACEMENT", var.f5_license)" | ||
|
||
//User can configure timeouts | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
|
||
# Hack to handle some race condition; will remove it once have root caused the issues. | ||
provisioner "local-exec" { | ||
command = "sleep 30" | ||
} | ||
} |
Oops, something went wrong.