Lesson1 – Hands-on – Code Review
In this lesson, we will review the key Terraform files that define our Oracle Kubernetes Engine (OKE) Basic Cluster deployment and ensure proper authentication with Oracle Cloud Infrastructure (OCI) before applying our configuration using OpenTofu. We start with variables.tf, where we declare input variables such as tenancy OCID, user OCID, private key path, fingerprint, region, and compartment OCID to keep our configuration secure and reusable.
To populate these variables, we use terraform.tfvars, which contains actual authentication values required for OCI. The provider.tf file then defines Oracle Cloud Infrastructure as the provider, linking it with our authentication credentials so Terraform can create and manage resources. We also review outputs.tf, which captures key details after deployment, such as KubeConfig for authentication, cluster name, ID, and Node Pool information.
The core configuration is in oke.tf, which uses a Terraform module to provision the OKE Basic Cluster. This module simplifies deployment by automating networking and resource creation while following OCI best practices. We configure VM.Standard.A1.Flex instances from OCI’s free tier, ensuring cost-efficient deployment.
Key networking settings include:
✅ use_existing_vcn = false → Creating a new VCN.
✅ is_api_endpoint_subnet_public = true → Publicly accessible OKE API endpoint.
✅ is_lb_subnet_public = true → Public Load Balancer for external traffic.
✅ is_nodepool_subnet_public = true → Worker nodes with public access.
This Terraform module, designed specifically for this course, is available on GitHub and the Terraform Registry. With all files properly configured, we are now ready to execute Terraform using OpenTofu and deploy our OKE Basic Cluster. Let’s move forward with the deployment!

