correction README.md

master
greglebreton 2 years ago
parent 5aaf23e181
commit ad84c675f4
  1. 4
      README.md
  2. 44
      main.tf
  3. 12
      terraform.tfvars

@ -45,12 +45,12 @@ ssh-keygen -t rsa -b 4096
## UTILISATION ## UTILISATION
- Lançer Terraform: - Initialiser Terraform:
```bash ```bash
terraform init terraform init
``` ```
- Lançer Terraform: - Dry run:
```bash ```bash
terraform plan terraform plan
``` ```

@ -79,35 +79,35 @@ resource "google_compute_instance" "default" {
### COPY DES FICHIERS ### COPY DES FICHIERS
provisioner "file" { provisioner "file" {
source = "app/" source = "app/"
destination = "./" destination = "./"
connection { connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh" type = "ssh"
user = var.gcp_ssh_user user = var.gcp_ssh_user
timeout = "500s" timeout = "500s"
private_key = "${file(var.gcp_ssh_priv_key_file)}" private_key = file(var.gcp_ssh_priv_key_file)
} }
} }
### START DEPLOY.SH ### START DEPLOY.SH
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"chmod +x ~/deploy.sh", "chmod +x ~/deploy.sh",
"cd ~", "cd ~",
"./deploy.sh" "./deploy.sh"
] ]
connection { connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh" type = "ssh"
user = var.gcp_ssh_user user = var.gcp_ssh_user
timeout = "500s" timeout = "500s"
private_key = "${file(var.gcp_ssh_priv_key_file)}" private_key = file(var.gcp_ssh_priv_key_file)
} }
} }
} }
## GET VM PUBLIC IP ## GET VM PUBLIC IP
output "Web-server-URL" { output "Web-server-URL" {
value = join("",["http://",google_compute_instance.default.network_interface.0.access_config.0.nat_ip,":5000"]) value = join("", ["http://", google_compute_instance.default.network_interface.0.access_config.0.nat_ip, ":5000"])
} }

@ -1,8 +1,8 @@
# GCP Settings # GCP Settings
gcp_project_id = "terraform-demo-381114" # A MODIFIER gcp_project_id = "terraform-demo-381114" # A MODIFIER
gcp_region = "europe-west9" gcp_region = "europe-west9"
gcp_zone = "europe-west9-a" gcp_zone = "europe-west9-a"
gcp_auth_file = "./auth/terraform-demo-381114-158cfce10778.json" # A MODIFIER gcp_auth_file = "./auth/terraform-demo-381114-158cfce10778.json" # A MODIFIER
gcp_ssh_user = "devops" # A MODIFIER OU PAS gcp_ssh_user = "devops" # A MODIFIER OU PAS
gcp_ssh_pub_key_file = "~/.ssh/terraform.pub" gcp_ssh_pub_key_file = "~/.ssh/terraform.pub"
gcp_ssh_priv_key_file = "~/.ssh/terraform" gcp_ssh_priv_key_file = "~/.ssh/terraform"
Loading…
Cancel
Save