Export existing Google Cloud Platform resources to HashiCorp Configuration Language (HCL , Terraform)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Tested with python 3.6.7 Check your python version with :
python3 --version
from source
git clone --recursive https://github.com/romaric1/gcp2Terraform.git
cd gcp2Terraform
pip install -r requirements.txt
from pypi
to complete
python ./src/import_instances.py romaric-gcp-training
python ./src/import_instances.py google-cloud-platform-project-id
resource "google_compute_instance" "instance-1" {
name = "instance-1"
machine_type = "n1-standard-2"
zone = "europe-west1-b"
tags = ["http-server", "https-server", "web-server"]
boot_disk {
auto_delete = "True"
initialize_params {
image = "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-9-stretch-v20190116"
size = "10"
}
}
attached_disk {
source = "https://www.googleapis.com/compute/v1/projects/romaric-gcp-training/zones/europe-west1-b/disks/disk-2"
mode = "READ_WRITE"
}
labels {
env = "staging"
}
network_interface {
network = "default"
access_config {
nat_ip = "35.233.58.78"
}
}
service_account {
email = "661701253715-compute@developer.gserviceaccount.com"
scopes = ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append"]
}
}
to complete
to complete
Give an example
to complete
Give an example
to complete
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
to complete
- *TAVENARD Romaric - Initial work - romaric1
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details