Skip to content

AmpereComputing/terraform-gcp-ampere-t2a

Repository files navigation

Ampere Computing

terraform-gcp-ampere-t2a

License

Requirements

What exactly is Terraform doing

The goal of this code is to supply the minimal ammount of information to quickly have working Ampere Tau2a instances on Google Cloud.

Addtional tasks performed by this code:

  • Dynamically creating sshkeys to use when logging into the instance.
  • Dynamically getting region, availability zone and image id..
  • Creating necessary core networking configurations for the tenancy
  • Rendering metadata to pass into the Ampere A1 instance.
  • Launch multiple Ampere taut2a instances with metadata and ssh keys.
  • Output IP information to connect to the instance.

To get started clone this repository from GitHub locally.

Configuration with terraform.tfvars

The easiest way to configure is to use a terraform.tfvars in the project directory. Please note that Compartment OCID are the same as Tenancy OCID for Root Compartment. The following is an example of what terraform.tfvars should look like:

project_id = "myterraform-123456"
location = "US"

Using as a Module

This can also be used as a terraform module. The examples directory contains example code for module usage showing different operating systems booting with a custom cloud-init templates. Doing a clone of this repository and changing directory to one of the examples, placing a terraform.tfvars into that directory, and running a typical terrafornm workflow will produce a working virtual machine in the os that was specified in the main.tf that is located within the chosen example directory.

Running Terraform

terraform init && terraform plan && terraform apply -auto-approve

Running OpenTofu

tofu init && tofu plan && tofu apply -auto-approve

Logging in

Once everthing as executed, properly you'll need to login. Currently I successfully login via my google cloud email account in the following format. Where the "@" symbal and "." are replaces with underscores.

for example:

ssh -i

OS Images

Reference for OS images https://cloud.google.com/compute/docs/images/os-details

Providers

Name Version
cloudinit n/a
google n/a
local n/a
random n/a
tls n/a

Resources

Name Type
google_compute_address.static_ip resource
google_compute_firewall.ssh resource
google_compute_instance.default resource
google_compute_network.vnet resource
google_compute_subnetwork.vnet resource
google_os_login_ssh_public_key.cache resource
local_file.gcp-ssh-privkey resource
local_file.gcp-ssh-pubkey resource
random_uuid.random_id resource
tls_private_key.gcp resource
cloudinit_config.cloud_config data source
google_client_openid_userinfo.me data source
google_compute_image.fedora_coreos_next data source
google_compute_image.fedora_coreos_stable data source
google_compute_image.fedora_coreos_testing data source

Inputs

Name Description Type Default Required
cloud_init_template_file Optional path for a cloud-init file string null no
gcp_os_image Default OS Image From the Local Vars string "ubuntu2404" no
gcp_vcn_cidr_block CIDR Address range for GCE Networks string "10.2.0.0/16" no
gcp_vcn_cidr_subnet CIDR Address range for GCE Networks string "10.2.1.0/24" no
gcp_vm_count GCE Virtual Machine Count number 1 no
instance_prefix Name prefix for vm instances string "ampere-taut2a" no
location Google Location string "US" no
project_id Google Project ID any n/a yes
region Google Region string "us-central1" no
startup_script_template_file Optional path for a startup script file string null no
virtual_network_name virtual_network_name string "terraform-ampere-taut2a" no
zone Google Region string "us-central1-a" no

Outputs

Name Description
ampere_t2a_metadata Output rendered instance Metadata
ampere_t2a_private_ips Output GCE Ampere Instance Private IP(s)
ampere_t2a_public_ips Output GCE Ampere Instance Public IP(s)
cloud_config n/a
gcp_ssh_private_key Output GCE SSH private key
gcp_ssh_pubic_key Output GCE SSH public key
my-email Output email address
random_uuid Output a randomly generated uuid

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published