Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
SHELL := /bin/bash

all: init apply output

clean: state destroy

version:
time terraform version

init:
time terraform init

validate:
time terraform validate

update:
time terraform get -update

plan:
time terraform plan

apply:
time terraform apply -auto-approve

destroy:
time terraform destroy -auto-approve

output:
time terraform output

state:
time terraform state list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IxLoad-on-GCP-1-App-2-Agents-2-VPCs-1-Public-Subnet-1-Private-Subnet
# IxLoad-on-GCP-1-App-1-VTA-2-VPCs-1-Public-Subnet-1-Private-Subnet

## Description
This deployment creates a topology with two virtual private clouds, one having a single public facing subnet and the other having a single private subnet.
Expand All @@ -12,9 +12,10 @@ Otherwise, Terraform will prompt the user to supply input arguents via cli.

## Optional Variables
```
terraform.gcp.auto.tfvars
terraform.optional.auto.tfvars
```
You **MAY** uncomment one or more lines as needed in this file and replace values to match your particular environment.
You **MAY** uncomment one or more lines as needed in these files and replace values to match your particular environment.

## Required Usage
```
Expand All @@ -29,4 +30,4 @@ terraform validate
terraform plan
terraform state list
terraform output
```
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
data "google_client_config" "current" {}

data "google_compute_machine_types" "Agent" {
filter = "name = ${local.AgentMachineType}"
zone = data.google_client_config.current.zone
}

data "google_compute_machine_types" "App" {
filter = "name = ${local.AppMachineType}"
zone = data.google_client_config.current.zone
}

data "http" "ip" {
url = "https://ifconfig.me/ip"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variable "Credentials" {
default = null
description = "Path to (or contents of) a service account key file in JSON format"
sensitive = true
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ locals {
Agent1InstanceId = "agent1"
AppMachineType = var.AppMachineType
AppTag = "ixload"
PrivateVpcNetworkMtu = var.PrivateVpcNetworkMtu
PublicFirewallRuleSourceIpRanges = var.PublicFirewallRuleSourceIpRanges == null ? [ "${data.http.ip.response_body}/32" ] : var.PublicFirewallRuleSourceIpRanges
UserEmailTag = var.UserEmailTag == null ? data.google_client_openid_userinfo.current.email : var.UserEmailTag
UserEmailTag = var.UserEmailTag == null ? "terraform@example.com" : var.UserEmailTag
UserLoginTag = var.UserLoginTag == null ? "terraform" : var.UserLoginTag
UserProjectTag = var.UserProjectTag == null ? lower(random_id.RandomId.id) : var.UserProjectTag
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "App" {
source = "git::https://github.com/armdupre/terraform-google-module-ixload-app.git?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-ixload-app.git?ref=26.0.0"
Eth0SubnetName = module.Vpc.PublicSubnet.name
Eth0VpcNetworkName = module.Vpc.PublicVpcNetwork.name
MachineType = local.AppMachineType
Expand All @@ -15,7 +15,7 @@ module "App" {
}

module "Agent1" {
source = "git::https://github.com/armdupre/terraform-google-module-ixload-agent.git?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-ixload-agent.git?ref=26.0.0"
Eth0SubnetName = module.Vpc.PublicSubnet.name
Eth0VpcNetworkName = module.Vpc.PublicVpcNetwork.name
Eth1SubnetName = module.Vpc.PrivateSubnet.name
Expand All @@ -35,4 +35,4 @@ module "Agent1" {

resource "random_id" "RandomId" {
byte_length = 4
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
output "Agent1" {
value = {
architecture = module.Agent1.Instance.architecture
can_ip_forward = module.Agent1.Instance.can_ip_forward
cpu_platform = module.Agent1.Instance.cpu_platform
current_status = module.Agent1.Instance.current_status
eth0 = {
public_ip_address = {
address = module.Agent1.Eth0PublicIpAddress.address
address_type = module.Agent1.Eth0PublicIpAddress.address_type
}
}
image = {
name = module.Agent1.Image.name
project = module.Agent1.Image.project
}
instance_id = module.Agent1.Instance.instance_id
machine = {
description = data.google_compute_machine_types.Agent.machine_types.0.description
guest_cpus = data.google_compute_machine_types.Agent.machine_types.0.guest_cpus
is_shared_cpus = data.google_compute_machine_types.Agent.machine_types.0.is_shared_cpus
machine_type = module.Agent1.Instance.machine_type
memory_mb = data.google_compute_machine_types.Agent.machine_types.0.memory_mb
}
name = module.Agent1.Instance.name
network_ip = module.Agent1.Instance.network_ip
project = module.Agent1.Instance.project
serial-port-enable = module.Agent1.Instance.serial-port-enable
zone = module.Agent1.Instance.zone
}
}

output "App" {
value = {
architecture = module.App.Instance.architecture
can_ip_forward = module.App.Instance.can_ip_forward
cpu_platform = module.App.Instance.cpu_platform
current_status = module.App.Instance.current_status
eth0 = {
public_ip_address = {
address = module.App.Eth0PublicIpAddress.address
address_type = module.App.Eth0PublicIpAddress.address_type
}
}
image = {
name = module.App.Image.name
project = module.App.Image.project
}
instance_id = module.App.Instance.instance_id
machine = {
description = data.google_compute_machine_types.App.machine_types.0.description
guest_cpus = data.google_compute_machine_types.App.machine_types.0.guest_cpus
is_shared_cpus = data.google_compute_machine_types.App.machine_types.0.is_shared_cpus
machine_type = module.App.Instance.machine_type
memory_mb = data.google_compute_machine_types.App.machine_types.0.memory_mb
}
name = module.App.Instance.name
network_ip = module.App.Instance.network_ip
project = module.App.Instance.project
zone = module.App.Instance.zone
}
}

output "PrivateVpcNetwork" {
value = {
mtu = module.Vpc.PrivateVpcNetwork.mtu
name = module.Vpc.PrivateVpcNetwork.name
}
}

output "PublicVpcNetwork" {
value = {
mtu = module.Vpc.PublicVpcNetwork.mtu
name = module.Vpc.PublicVpcNetwork.name
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Credentials = "~/gcp/credentials.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ProjectId = "example"
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ variable "AgentMachineType" {
description = "Designation for set of resources available to Agent VM"
type = string
validation {
condition = can(regex("c2-standard-16", var.AgentMachineType)) || can(regex("c2-standard-8", var.AgentMachineType)) || can(regex("c2-standard-4", var.AgentMachineType))
error_message = "AgentMachineType must be one of (c2-standard-16 | c2-standard-8 | c2-standard-4) types."
condition = contains([ "c2-standard-4", "c2-standard-8", "c2-standard-16" ], var.AgentMachineType)
error_message = <<EOF
AgentMachineType must be one of the following types:
c2-standard-4, c2-standard-8, c2-standard-16
EOF
}
}

Expand All @@ -18,10 +21,17 @@ variable "AppMachineType" {
}
}

variable "Credentials" {
description = "Path to (or contents of) a service account key file in JSON format"
sensitive = true
type = string
variable "PrivateVpcNetworkMtu" {
default = 1460
description = "Maxium Transmission Unit associated with the first private vpc network"
type = number
validation {
condition = contains([1460, 1500, 8896], var.PrivateVpcNetworkMtu)
error_message = <<EOF
PrivateVpcNetworkMtu must be one of the following values:
1460, 1500, 8896
EOF
}
}

variable "ProjectId" {
Expand Down Expand Up @@ -71,4 +81,4 @@ variable "ZoneName" {
default = "us-central1-a"
description = "Deployment area within a region"
type = string
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.12.0"
version = ">= 7.18.0"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module "Vpc" {
source = "git::https://github.com/armdupre/terraform-google-module-2-vpcs-1-public-subnet-1-private-subnet?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-2-vpcs-1-public-subnet-1-private-subnet.git?ref=26.0.0"
PrivateVpcNetworkMtu = local.PrivateVpcNetworkMtu
PublicFirewallRuleSourceIpRanges = local.PublicFirewallRuleSourceIpRanges
RegionName = data.google_client_config.current.region
Tag = local.AppTag
UserLoginTag = local.UserLoginTag
UserProjectTag = local.UserProjectTag
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
SHELL := /bin/bash

all: init apply output

clean: state destroy

version:
time terraform version

init:
time terraform init

validate:
time terraform validate

update:
time terraform get -update

plan:
time terraform plan

apply:
time terraform apply -auto-approve

destroy:
time terraform destroy -auto-approve

output:
time terraform output

state:
time terraform state list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IxVM-on-GCP-2-Agents-2-VPCs-1-Public-Subnet-1-Private-Subnet
# IxLoad-on-GCP-1-App-2-VTAs-2-VPCs-1-Public-Subnet-1-Private-Subnet

## Description
This deployment creates a topology with two virtual private clouds, one having a single public facing subnet and the other having a single private subnet.
Expand All @@ -12,9 +12,10 @@ Otherwise, Terraform will prompt the user to supply input arguents via cli.

## Optional Variables
```
terraform.gcp.auto.tfvars
terraform.optional.auto.tfvars
```
You **MAY** uncomment one or more lines as needed in this file and replace values to match your particular environment.
You **MAY** uncomment one or more lines as needed in these files and replace values to match your particular environment.

## Required Usage
```
Expand All @@ -29,4 +30,4 @@ terraform validate
terraform plan
terraform state list
terraform output
```
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
data "google_client_config" "current" {}

data "google_compute_machine_types" "Agent" {
filter = "name = ${local.AgentMachineType}"
zone = data.google_client_config.current.zone
}

data "google_compute_machine_types" "App" {
filter = "name = ${local.AppMachineType}"
zone = data.google_client_config.current.zone
}

data "http" "ip" {
url = "https://ifconfig.me/ip"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variable "Credentials" {
default = null
description = "Path to (or contents of) a service account key file in JSON format"
sensitive = true
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ locals {
AppMachineType = var.AppMachineType
AppTag = "ixload"
Preamble = replace("${local.UserLoginTag}-${local.UserProjectTag}-${local.AppTag}-${local.Agent2InstanceId}", "_", "-")
PrivateVpcNetworkMtu = var.PrivateVpcNetworkMtu
PublicFirewallRuleSourceIpRanges = var.PublicFirewallRuleSourceIpRanges == null ? [ "${data.http.ip.response_body}/32" ] : var.PublicFirewallRuleSourceIpRanges
UserEmailTag = var.UserEmailTag == null ? data.google_client_openid_userinfo.current.email : var.UserEmailTag
UserEmailTag = var.UserEmailTag == null ? "terraform@example.com" : var.UserEmailTag
UserLoginTag = var.UserLoginTag == null ? "terraform" : var.UserLoginTag
UserProjectTag = var.UserProjectTag == null ? lower(random_id.RandomId.id) : var.UserProjectTag
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "App" {
source = "git::https://github.com/armdupre/terraform-google-module-ixload-app.git?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-ixload-app.git?ref=26.0.0"
Eth0SubnetName = module.Vpc.PublicSubnet.name
Eth0VpcNetworkName = module.Vpc.PublicVpcNetwork.name
MachineType = local.AppMachineType
Expand All @@ -15,7 +15,7 @@ module "App" {
}

module "Agent1" {
source = "git::https://github.com/armdupre/terraform-google-module-ixload-agent.git?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-ixload-agent.git?ref=26.0.0"
Eth0SubnetName = module.Vpc.PublicSubnet.name
Eth0VpcNetworkName = module.Vpc.PublicVpcNetwork.name
Eth1SubnetName = module.Vpc.PrivateSubnet.name
Expand All @@ -34,7 +34,7 @@ module "Agent1" {
}

module "Agent2" {
source = "git::https://github.com/armdupre/terraform-google-module-ixload-agent.git?ref=11.0.0"
source = "git::https://github.com/Keysight/terraform-google-module-ixload-agent.git?ref=26.0.0"
Eth0PrivateIpAddress = local.Agent2Eth0PrivateIpAddress
Eth0SubnetName = module.Vpc.PublicSubnet.name
Eth0VpcNetworkName = module.Vpc.PublicVpcNetwork.name
Expand All @@ -57,4 +57,4 @@ module "Agent2" {

resource "random_id" "RandomId" {
byte_length = 4
}
}
Loading