filippolmt / terraform-oci-free-tier

Terraform configurations for deploying and managing resources on Oracle Cloud Infrastructure (OCI) Free Tier. Ideal for learning, development, and small-scale projects. Features include automated deployment, cost-effectiveness, modularity, and integrated security practices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform OCI Free Tier

This repository provides Terraform configurations for deploying resources in Oracle Cloud Infrastructure (OCI) Free Tier.

Table of Contents

Prerequisites

  • Terraform installed on your local machine.
  • Oracle Cloud Infrastructure (OCI) account.
  • OCI CLI configured with your credentials.

Setup

  1. Clone the repository:

    git clone https://github.com/filippolmt/terraform-oci-free-tier.git
    cd terraform-oci-free-tier
  2. Configure your variables: Copy the terraform.tfvars.template to terraform.tfvars and fill in the required variables.

    cp terraform.tfvars.template terraform.tfvars
  3. Initialize Terraform:

    terraform init

Usage

  1. Plan the deployment:

    terraform plan
  2. Apply the deployment:

    terraform apply
  3. Destroy the deployment:

    terraform destroy

Files

  • main.tf: Main Terraform configuration file.
  • outputs.tf: Defines the outputs of the Terraform configuration.
  • variables.tf: Defines the variables used in the Terraform configuration.
  • versions.tf: Specifies the required Terraform version and provider versions.
  • terraform.tfvars.template: Template for user-specific variables.
  • .github/workflows/: Contains GitHub Actions workflows for CI/CD.
    • documentation.yml: Workflow for generating documentation.
    • tfsec.yml: Workflow for running TFsec security scans.
  • scripts/startup.sh: Script for initial setup and configuration.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Requirements

Name Version
terraform >=1.3
oci 5.45.0

Providers

Name Version
oci 5.45.0

Modules

No modules.

Resources

Name Type
oci_core_default_route_table.default_route_table resource
oci_core_instance.instance resource
oci_core_internet_gateway.internet_gateway resource
oci_core_public_ip.public_ip resource
oci_core_security_list.security_list resource
oci_core_subnet.subnet resource
oci_core_vcn.vcn resource
oci_core_volume.docker_volume resource
oci_core_volume_attachment.docker_volume_attachment resource
oci_core_volume_backup_policy.docker_volume_backup_policy resource
oci_core_volume_backup_policy_assignment.docker_volume_backup_policy_assignment resource
oci_core_private_ips.instance_private_ip data source
oci_core_vnic.instance_vnic data source
oci_core_vnic_attachments.instance_vnics data source
oci_identity_availability_domain.ad data source

Inputs

Name Description Type Default Required
additional_ssh_public_key Additional public key to use for SSH access example: < /home/ubuntu/.ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAA EOF string "" no
availability_domain_number The availability domain number number 1 no
compartment_ocid The OCID of the compartment string n/a yes
fault_domain The fault domain to deploy to string "FAULT-DOMAIN-2" no
instance_display_name The display name of the instance string "DockerHost" no
instance_image_ocid The OCID of the image to use for the instance map(any)
{
"af-johannesburg-1": "ocid1.image.oc1.af-johannesburg-1.aaaaaaaayatt2q3wf65wyaey7soibfye7ilnguxfw2m37xspz2dvnk66avha",
"ap-chuncheon-1": "ocid1.image.oc1.ap-chuncheon-1.aaaaaaaatrfzu3rtfs4clvu3d3lcx3w47dhfwley334h2e4kibgkguof2jbq",
"ap-hyderabad-1": "ocid1.image.oc1.ap-hyderabad-1.aaaaaaaazws25hclevz2gawql32qjxy47t3qm267pki6a7dovu5s5zec5cuq",
"ap-melbourne-1": "ocid1.image.oc1.ap-melbourne-1.aaaaaaaaxdac5qbdmi7kjgurknuoxnw6gopfcf63liqljjh5tt24fpd4j7aa",
"ap-mumbai-1": "ocid1.image.oc1.ap-mumbai-1.aaaaaaaavldnviyso3bjs4ppc6vnvkxhm6cwrd25qxioxvlgfdvuhiolqn3q",
"ap-osaka-1": "ocid1.image.oc1.ap-osaka-1.aaaaaaaanafsjeu6sgbgtcs2unflym5b3ayetwyig3fjav5ld44qkosv4yxq",
"ap-seoul-1": "ocid1.image.oc1.ap-seoul-1.aaaaaaaaaogjhvie4g6lnuaqnedzrnqsyoejaisp2ri4pkifofw3gbfx2fsq",
"ap-singapore-1": "ocid1.image.oc1.ap-singapore-1.aaaaaaaamxlszcgvwvzrknu5b6ajifilcz2g5rdnxzunpqm2tuy5pu5iqf5q",
"ap-sydney-1": "ocid1.image.oc1.ap-sydney-1.aaaaaaaaifa7kduccxfitcylxubkht7cdhl63obna2bkduk6zkvhymbfnxka",
"ap-tokyo-1": "ocid1.image.oc1.ap-tokyo-1.aaaaaaaat7tma2qo5x5ceupmsak7w3qj5pq73ir67b45l7su7y3xltym3eoq",
"ca-montreal-1": "ocid1.image.oc1.ca-montreal-1.aaaaaaaapk2rls5h5v3mtyvtglhq2zglh4a3yyrufz2rdxtspihe6pq4j6va",
"ca-toronto-1": "ocid1.image.oc1.ca-toronto-1.aaaaaaaa24sdg3g3jhzk4xbbzq66lfkw65iuuhsg4rg5vmi5oq6tx2pw2pja",
"eu-amsterdam-1": "ocid1.image.oc1.eu-amsterdam-1.aaaaaaaa2thbdtvsvy477jexghizqta2ncgjpb63yc32cir7ecjo4o2qcf5q",
"eu-frankfurt-1": "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaauowdt3masemltfslfv7rp67e6i4ple7t4u6ygyt5k6ub3vduusiq",
"eu-madrid-1": "ocid1.image.oc1.eu-madrid-1.aaaaaaaaopqz7l22adkrh32xle75d367u5le4cbcalenqssee7kpzek2zera",
"eu-marseille-1": "ocid1.image.oc1.eu-marseille-1.aaaaaaaat6vsgurqc3yqmc6frh3v3fkgos6ftjsdvzbewxz33sd22fnnucca",
"eu-milan-1": "ocid1.image.oc1.eu-milan-1.aaaaaaaayqlb7nqz3gdno4paz3h2qqxkyf4zzfttjnoh4ij2kpcg4467y2ea",
"eu-paris-1": "ocid1.image.oc1.eu-paris-1.aaaaaaaaxvkt7p62m5gwoeffjeocdy26mxdosapdhtld7nxfogc4spooa2sq",
"eu-stockholm-1": "ocid1.image.oc1.eu-stockholm-1.aaaaaaaalifousimc5zr4ypepp6b6bzjqhx5afuulxaqmujuc2voqs5fsn5a",
"eu-zurich-1": "ocid1.image.oc1.eu-zurich-1.aaaaaaaaxluw6jh3jmpyg5dkpsnpg63wzphzac4cdhgfte2fss7g5gcwihca",
"il-jerusalem-1": "ocid1.image.oc1.il-jerusalem-1.aaaaaaaapuniww6o33se3sfty6feri6ktxl6brlwwvsegukjcxoinzwi5wvq",
"me-abudhabi-1": "ocid1.image.oc1.me-abudhabi-1.aaaaaaaa6b2qwjnh7rpzj3meotg55salzwi563hhbmbyks5hf2dezjoyiecq",
"me-dubai-1": "ocid1.image.oc1.me-dubai-1.aaaaaaaag3hbb5cvalx747wg6dplm2cxjc4fq5uux2xbticnc3vjrqzwhxgq",
"me-jeddah-1": "ocid1.image.oc1.me-jeddah-1.aaaaaaaamk2h7ilswb472holpkykgtlyqcsgucr7j7o3k6x2em5pbisywjsq",
"mx-queretaro-1": "ocid1.image.oc1.mx-queretaro-1.aaaaaaaa5ng35ewch32nilgapabou4olvtqxgabpq762p3qx56qy2dwmctaq",
"sa-santiago-1": "ocid1.image.oc1.sa-santiago-1.aaaaaaaal6gxoyh4gfm2vxaua2464ieilwfth77msu7uemfpkadkkt6mjfka",
"sa-saopaulo-1": "ocid1.image.oc1.sa-saopaulo-1.aaaaaaaaqghurigdiwlf726pmgzlzmbqkgo5inn7k7bx5q4lpqhfjsr6apcq",
"sa-vinhedo-1": "ocid1.image.oc1.sa-vinhedo-1.aaaaaaaa3b3p5xmkvam7h2km5irockkgrjl7acnntzbi73u6lcdlmdvwob3a",
"uk-cardiff-1": "ocid1.image.oc1.uk-cardiff-1.aaaaaaaagy2eilwxcrz7y5vyehraeoisdxpg4ub2txsap4q2tn7h3x2uyznq",
"uk-london-1": "ocid1.image.oc1.uk-london-1.aaaaaaaanqwfiejnlcawmwoa2ku73qghuiumgaiffldgfk5ig7xx4tlfcjua",
"us-ashburn-1": "ocid1.image.oc1.iad.aaaaaaaaf4tcgubjzoxwaa4xteropz4zidxitlbjcwogcglzxwtspwiv74ha",
"us-chicago-1": "ocid1.image.oc1.us-chicago-1.aaaaaaaajrmkhokn3hqdlqtevwvcyxh67fknrp5ljo33kp25nci34viblkxq",
"us-phoenix-1": "ocid1.image.oc1.phx.aaaaaaaafpqctvbk7lcxfztmjxhyfd5pyhixs4h23uzjiddjlxfs6eva57xa",
"us-sanjose-1": "ocid1.image.oc1.us-sanjose-1.aaaaaaaa54zxwb6ujfbrycebkkmy4tdc7szox3l76l6un7wfjgln4drzcvda"
}
no
instance_shape The shape of the instance string "VM.Standard.A1.Flex" no
instance_shape_boot_volume_size_in_gbs The size of the boot volume in GBs string "50" no
instance_shape_config_memory_in_gbs The amount of memory in GBs for the instance string "24" no
instance_shape_config_ocpus The number of OCPUs for the instance string "4" no
instance_shape_docker_volume_size_in_gbs The size of the docker volume in GBs string "150" no
oracle_api_key_fingerprint The fingerprint of the public key string n/a yes
oracle_api_private_key_path The path to the private key string "~/.oci/oci_api_key.pem" no
region The region to deploy to string "eu-milan-1" no
ssh_public_key The public key to use for SSH access string n/a yes
tenancy_ocid The OCID of the tenancy string n/a yes
user_ocid The OCID of the user to use for authentication string n/a yes
vcn_cidr_block The CIDR block for the VCN string "10.1.0.0/16" no

Outputs

Name Description
instance_id The OCID of the instance
private_ip The private IP of the instance
public_ip The public IP of the instance

About

Terraform configurations for deploying and managing resources on Oracle Cloud Infrastructure (OCI) Free Tier. Ideal for learning, development, and small-scale projects. Features include automated deployment, cost-effectiveness, modularity, and integrated security practices.

License:GNU General Public License v3.0


Languages

Language:HCL 89.7%Language:Shell 10.3%