Skip to content

RhubarbSin/terraform-oci-free-compute-maximal-example

Repository files navigation

terraform-oci-free-compute-maximal-example

What it is

A Terraform configuration for compute resources on the Free Tier of Oracle Cloud Infrastructure.

What it does

Deploys a maximal set of resources to run compute instances on the OCI Free Tier.

How to use it

For simplicity—to avoid the need to install and configure Terraform and the OCI CLI—this configuration is designed for deployment as a stack in the OCI Resource Manager.

  1. Download the repository as a ZIP file: on the repository’s GitHub page, select Download ZIP from the Code menu on the upper right.
  2. Log into the Oracle Cloud Infrastructure Console.
  3. Go to the Resource Manager: from the hamburger menu on the upper left, find Developer ServicesResource Manager and select Stacks.
  4. Click on the Create Stack button, select .zip file under Stack Configuration and select the file via the Browse link.
  5. Click on the Next button and provide an SSH public key.
  6. Click Next again and then Create.
  7. Click on the Plan button and start the plan job by clicking Plan again.
  8. After the plan job completes, from the Resource Manager » Stacks » Stack Details » Job Details page go to Resource Manager » Stacks » Stack Details.
  9. Click on the Apply button and start the apply job by clicking Apply again.
  10. After the apply job completes, from the hamburger menu find ComputeCompute and select Instances. Select the newly created compartment (named OCI-Free-Compute-Maximal by default) from the Compartment menu.
  11. Information for connecting to the instances with SSH can be found by selecting an instance and viewing the details under Instance access on the Instance information tab.
  12. To destroy the resources, navigate back to Resource Manager » Stacks » Stack Details and click on the Destroy button and click Destroy again.
  13. To delete the stack, after the destroy job completes, from the Resource Manager » Stacks » Stack Details » Job Details page go to Resource Manager » Stacks » Stack Details. From the More Actions menu choose Delete Stack and then Delete.

Details

  • The resources deployed include the following:
    • One (1) Compartment
    • One (1) Virtual Cloud Network
    • One (1) Internet Gateway
    • One (1) Subnet
    • One (1) Network Security Group
    • Two (2) AMD Micro instances running the latest available Ubuntu distribution with the following specifications:
      • 1 OCPU
      • 1 GiB of memory
      • 50 GiB of storage
      • 1 ephemeral public IP address
    • One (1) AMD Flex instance running the latest Oracle Linux distribution with the following specifications:
      • 4 OCPUs
      • 24 GiB of memory
      • 100 GiB of storage
      • 1 reserved public IP address
    • Three (3) volume backup policies that will create a backup of each boot volume on a daily basis and retain the backup for one day (due to the limitation of five volume backups)
  • On the Ubuntu instances, Apparmor is removed by cloud-init.
  • On the Oracle Linux instance, a kernel boot argument is added to disable loading of SELinux, but because cloud-init is configured not to execute its power-state-change module, that instance must be rebooted for the change to take effect.
  • The default security list that is explicitly associated with the subnet allows inbound traffic to ports 22, 80, and 443 from any origin and all outbound traffic to any destination.
  • The network security group associated with the instances’ VNICs allows inbound ICMP echo (i.e. ping) traffic from any origin and all outbound traffic to any destination.