Terraform Provider (Beta)
We provide a Terraform plugin to interact with the GPCORE API.
You can find our Terraform provider on Github or directly on the Terraform registry here.
Beta
Please keep in mind our Terraform provider is currently in beta. We are working hard to make it stable and provide a great experience for our users. If you find any bugs or have any suggestions, please let us know by creating an issue on our Github page.
Documentation
You can find our full Terraform provider documentation here.
Usage Example
terraform {
required_providers {
gpcore = {
source = "G-PORTAL/gpcore"
version = "0.2.2"
}
}
}
# How many nodes should be created
variable "node_count" {
default = "1"
}
# Define credentials for the API, please contact sales
# to get your credentials.
provider "gpcore" {
client_id = "<example-client-id>"
client_secret = "<example-client-secret>"
username = "<example-user-email>"
password = "<example-user-password>"
}
# Create a new project
# If you like to use an existing project, please use the
# the following command "terraform import gpcore_project.project <id>"
resource "gpcore_project" "project" {
name = "example-project"
description = "my example project"
environment = "PROJECT_ENVIRONMENT_DEVELOPMENT"
}
# Create a new SSH key
resource "gpcore_sshkey" "sshkey" {
name = "my-public-key"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC9S52MGGlI+JyJ+2szNXJA70j9C1O1vuICAW5RZRdLrss1H7dCsItQiUbopvrsN8GkRE9WMbcu4moUfm+wsXmc4cBbNQu5xQKzBYbYLraBwn6Ptaww5lSpUTUxLKYCy+64YPooLb4leiboZSkHj/fA9maeONU6bT7WZXA7itqCD5QvwuGEO+E5zgzEDQATg5Tp2eq2RDM3AvgZVdE5STR6xMwXpD0FGK62AvSahCzSmeuDhwV5Csb8/ESBdrfBgL+IeAiU+CBlYTmofHFfSSmn0/jfc4uz7dVTmwBkKDAJD59Fb8SI+v8S7q+MXY6przQxZdo86s9srpNDRE53BbOYuH7aHK3PvnaMJTxjP3b3tFVtv/Rr89Bblm5/k5yGaBLGDb0OyAGtMn4yAn+vxhaMd5HEdKmGGiBoSL7GA3BT7b/5Q5tKF72pKkY+dzuiywbEyn0uKUV7mfpqZWwVcxxDeStCgi3ov0Vs3c/Eq2mF5bq3SJv5sWP/UMf8CLCh3NYD68tuTKhzz1nGYvw0ppO/GGsbtOjKipHwX+d3/BvgGfQq8e1sZ0ttdUsXFoMEu0a7rLwLeTmM6I/UHivDDt5PiBZeGXw3IoNr7h3Y1pzZySkjE63bpqeSdFOnW8rpUbeWAwcgfrHX4+kCewQsjIuuZjuYBObhP8A7xPakB/oekQ=="
}
# Define the datacenter.
data "gpcore_datacenter" "fra01" {
short = "fra01"
}
# Define the flavour and image.
data "gpcore_flavour" "e2288g" {
name = "xeon.e2288g.128"
project_id = gpcore_project.project.id
datacenter_id = data.gpcore_datacenter.fra01.id
}
# Define which image you want to use.
data "gpcore_image" "ubuntu" {
name = "Ubuntu 20.04 LTS"
flavour_id = data.gpcore_flavour.e2288g.id
}
# Create the nodes
resource "gpcore_node" "node" {
count = var.node_count
project_id = gpcore_project.project.id
fqdn = "tf-instance-${count.index + 1}"
image_id = data.gpcore_image.ubuntu.id
ssh_key_ids = [gpcore_sshkey.sshkey.id]
flavour_id = data.gpcore_flavour.e2288g.id
datacenter_id = data.gpcore_datacenter.fra01.id
billing_period = "BILLING_PERIOD_HOURLY"
tags = {
"key" = "value"
}
}