Created
January 5, 2019 13:33
-
-
Save mlabouardy/a496ff0e389b3d38e73985ade0e38991 to your computer and use it in GitHub Desktop.
Deploy Nexus repository on GCP with Terraform
This file contains hidden or 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
| provider "google" { | |
| credentials = "${file("${var.credentials}")}" | |
| project = "${var.project}" | |
| region = "${var.region}" | |
| } | |
| resource "google_compute_firewall" "nexus" { | |
| name = "nexus-firewall" | |
| network = "${google_compute_network.nexus.name}" | |
| allow { | |
| protocol = "tcp" | |
| ports = ["22", "8081"] | |
| } | |
| source_ranges = ["0.0.0.0/0"] | |
| } | |
| resource "google_compute_network" "nexus" { | |
| name = "nexus-network" | |
| } | |
| resource "google_compute_instance" "nexus" { | |
| name = "nexus" | |
| machine_type = "${var.instance_type}" | |
| zone = "${var.zone}" | |
| boot_disk { | |
| initialize_params { | |
| image = "${var.image_name}" | |
| size = 100 | |
| } | |
| } | |
| metadata { | |
| sshKeys = "${var.ssh_user}:${file(var.ssh_pub_key_file)}" | |
| } | |
| network_interface { | |
| network = "${google_compute_network.nexus.name}" | |
| access_config = {} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment