Skip to content

Commit

Permalink
Merge tag '2.1.0' into main
Browse files Browse the repository at this point in the history
v2.1.0 - 2021-01-13
===

 * Add `startup_script` input variable to specify a bash startup-script to
   execute after routing is initialized.  ([#40][issue40])

* tag '2.1.0':
  Update CHANGELOG for 2.1.0
  (#40) Add startup_script_user input variable
  Add variable project_id for endpoints
  Add variable project_id for examples
  • Loading branch information
jeffmccune committed Jan 14, 2021
2 parents 8c1a506 + 65223f1 commit f925a9e
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 13 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v3.4.0 - 2021-01-13
===

* Add `startup_script` input variable to specify a bash startup-script to
execute after routing is initialized. ([#40][issue40])

v3.3.0 - 2020-12-28
===

Expand Down Expand Up @@ -40,6 +46,12 @@ v3.0.0 - 2020-09-30
* Follow the process described in [UPGRADE.md](./docs/UPGRADE.md) when
upgrading to this major version.

v2.1.0 - 2021-01-13
===

* Add `startup_script` input variable to specify a bash startup-script to
execute after routing is initialized. ([#40][issue40])

v2.0.1 - 2020-12-23
===

Expand Down
17 changes: 12 additions & 5 deletions examples/compute/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

variable "project_id" {
description = "Project ID containing managed resources"
type = string
}

variable "num_instances" {
description = "Set to 0 to reduce costs when not actively developing."
type = number
Expand All @@ -31,9 +36,10 @@ variable "preemptible" {
default = true
}

variable "project_id" {
description = "Project ID containing managed resources"
variable "startup_script" {
description = "Startup script executed after the initilization of multinic routing. Must be a bash script."
type = string
default = ""
}

locals {
Expand All @@ -55,9 +61,10 @@ locals {
module "multinic" {
source = "../../modules/50_compute"

num_instances = var.num_instances
preemptible = var.preemptible
autoscale = var.num_instances == 0 ? false : true
num_instances = var.num_instances
preemptible = var.preemptible
autoscale = var.num_instances == 0 ? false : true
startup_script = var.startup_script

project_id = local.project_id
name_prefix = "multinic"
Expand Down
7 changes: 6 additions & 1 deletion examples/endpoints/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

variable "project_id" {
description = "Project ID containing managed resources"
type = string
}

# Instances in the same region as the multinic VMs.
variable "num_instances" {
description = "Set to 0 to reduce costs when not actively developing."
Expand Down Expand Up @@ -51,7 +56,7 @@ variable "iperf_client" {
}

locals {
project_id = "multinic-networks-534d"
project_id = var.project_id
}

# Manage the regional MIG formation
Expand Down
21 changes: 14 additions & 7 deletions examples/multiregion/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

variable "project_id" {
description = "Project ID containing managed resources"
type = string
}

variable "num_instances" {
description = "Set to 0 to reduce costs when not actively developing."
type = number
Expand All @@ -23,10 +28,10 @@ variable "preemptible" {
type = bool
default = true
}

variable "project_id" {
description = "Project ID containing managed resources"
variable "startup_script" {
description = "Startup script executed after the initilization of multinic routing. Must be a bash script."
type = string
default = ""
}

locals {
Expand Down Expand Up @@ -57,8 +62,9 @@ module "multinic-us-west1-v3" {
name_prefix = "multinic-v3"
priority = 901

num_instances = var.num_instances
preemptible = var.preemptible
num_instances = var.num_instances
preemptible = var.preemptible
startup_script = var.startup_script

project_id = local.project_id
region = "us-west1"
Expand Down Expand Up @@ -87,8 +93,9 @@ module "multinic-us-west2-v3" {
name_prefix = "multinic-v3"
priority = 901

num_instances = var.num_instances
preemptible = var.preemptible
num_instances = var.num_instances
preemptible = var.preemptible
startup_script = var.startup_script

project_id = local.project_id
region = "us-west2"
Expand Down
3 changes: 3 additions & 0 deletions modules/50_compute/files/startup-multinic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,7 @@ fi

main "$@"

# Execute an user-defined startup script if present, otherwise do nothing.
curl -H "Metadata-Flavor: Google" --silent --fail http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script-user | bash

# vim:sw=2
1 change: 1 addition & 0 deletions modules/50_compute/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ resource google_compute_instance_template "multinic" {
startup-script-config = data.template_file.startup-script-config.rendered
# Configure Linux Policy Routing
startup-script-custom = file("${path.module}/files/startup-multinic.sh")
startup-script-user = var.startup_script
# Deletes the route resources
shutdown-script = file("${path.module}/files/shutdown-multinic.sh")
}
Expand Down
6 changes: 6 additions & 0 deletions modules/50_compute/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,9 @@ variable "labels" {
role = "multinic-router"
}
}

variable "startup_script" {
description = "Startup script executed after the initilization of multinic routing. Must be a bash script."
type = string
default = ""
}
2 changes: 2 additions & 0 deletions modules/52_regional_multinic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module "multinic" {
num_instances = var.num_instances
preemptible = var.preemptible

startup_script = var.startup_script

project_id = var.project_id
name_prefix = var.name_prefix
region = var.region
Expand Down
6 changes: 6 additions & 0 deletions modules/52_regional_multinic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,9 @@ variable "labels" {
role = "multinic-router"
}
}

variable "startup_script" {
description = "Startup script executed after the initilization of multinic routing. Must be a bash script."
type = string
default = ""
}

0 comments on commit f925a9e

Please sign in to comment.