correction README.md

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

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

@ -79,35 +79,35 @@ resource "google_compute_instance" "default" {
### COPY DES FICHIERS
provisioner "file" {
source = "app/"
destination = "./"
connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh"
user = var.gcp_ssh_user
timeout = "500s"
private_key = "${file(var.gcp_ssh_priv_key_file)}"
}
source = "app/"
destination = "./"
connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh"
user = var.gcp_ssh_user
timeout = "500s"
private_key = file(var.gcp_ssh_priv_key_file)
}
}
### START DEPLOY.SH
provisioner "remote-exec" {
inline = [
"chmod +x ~/deploy.sh",
"cd ~",
"./deploy.sh"
]
connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh"
user = var.gcp_ssh_user
timeout = "500s"
private_key = "${file(var.gcp_ssh_priv_key_file)}"
}
inline = [
"chmod +x ~/deploy.sh",
"cd ~",
"./deploy.sh"
]
connection {
host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
type = "ssh"
user = var.gcp_ssh_user
timeout = "500s"
private_key = file(var.gcp_ssh_priv_key_file)
}
}
}
## GET VM PUBLIC IP
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_project_id = "terraform-demo-381114" # A MODIFIER
gcp_region = "europe-west9"
gcp_zone = "europe-west9-a"
gcp_auth_file = "./auth/terraform-demo-381114-158cfce10778.json" # A MODIFIER
gcp_ssh_user = "devops" # A MODIFIER OU PAS
gcp_ssh_pub_key_file = "~/.ssh/terraform.pub"
gcp_project_id = "terraform-demo-381114" # A MODIFIER
gcp_region = "europe-west9"
gcp_zone = "europe-west9-a"
gcp_auth_file = "./auth/terraform-demo-381114-158cfce10778.json" # A MODIFIER
gcp_ssh_user = "devops" # A MODIFIER OU PAS
gcp_ssh_pub_key_file = "~/.ssh/terraform.pub"
gcp_ssh_priv_key_file = "~/.ssh/terraform"

@ -24,15 +24,15 @@ variable "gcp_zone" {
variable "gcp_ssh_user" {
type = string
description = "SSH user"
description = "SSH user"
}
variable "gcp_ssh_pub_key_file" {
type = string
description = "SSH public key file path"
description = "SSH public key file path"
}
variable "gcp_ssh_priv_key_file" {
type = string
description = "SSH private key file path"
description = "SSH private key file path"
}
Loading…
Cancel
Save