***ALL IMP Command related to Cloud*** - TanveeKhanDB/OCI GitHub Wiki
-
Go, also called Golang, is an open-source, statically typed, compiled programming language developed by Google in 2009.
-
It was designed to build fast, reliable, scalable, and concurrent software.
-
Go is a programming language designed to create high-performance applications that efficiently utilize modern multi-core processors.
terraform init
Downloads the OCI provider plugin and initializes the working directory. Always run this first, and again whenever you add a new provider or module.
terraform version
Checks installed Terraform version — useful for compatibility checks with the OCI provider.
terraform providers
Lists all providers required by your configuration (e.g. registry.terraform.io/hashicorp/oci).
terraform validate
- Checks your .tf files for syntax errors and internal consistency — catches mistakes before you even plan.
terraform fmt
Auto-formats your .tf files into Terraform's standard style (indentation, spacing). Good practice before every commit.
terraform fmt -recursive
- Formats all .tf files in subdirectories too — useful in larger module-based projects.
terraform plan
- Generates an execution plan — shows exactly what will be created, changed, or destroyed on OCI without making any real changes. Always run before apply.
terraform plan -out=tfplan
- Saves the plan to a file so the exact same plan can be applied later — prevents drift between plan and apply.
terraform plan -var="region=ap-mumbai-1"
- Passes a variable value directly via command line, overriding variables.tf defaults.
terraform apply
- Executes the plan and actually provisions resources on OCI — creates VCNs, compute, databases, etc. Prompts for confirmation (yes) before proceeding.
terraform apply -auto-approve
- Same as above but skips the manual confirmation prompt — used heavily in CI/CD pipelines.
terraform apply tfplan
- Applies a previously saved plan file exactly as reviewed — best practice for production deployments.
terraform apply -target=oci_core_vcn.my_vcn
- Applies only a specific resource instead of the entire configuration — useful for targeted fixes or staged rollouts.
terraform state list
- Lists all resources currently tracked in the state file — quick way to see what Terraform manages.
terraform state show oci_core_instance.my_vm
- Shows detailed attributes of a specific resource from the state — IP address, OCID, shape, etc.
terraform state rm oci_core_instance.my_vm
- Removes a resource from state tracking without deleting it from OCI — useful when you want Terraform to "forget" something.
terraform import oci_core_vcn.<VCN_Name>_<ocid of my alrady created VCN>
terraform import oci_core_vcn.my_vcn ocid1.vcn.oc1...
- Brings an existing OCI resource (created manually) under Terraform management by importing its OCID into state.
terraform refresh
- Updates the state file to match the real-world current status of resources on OCI — detects manual changes (drift).
terraform destroy
- Deletes all resources defined in the configuration from OCI — full teardown. Prompts for confirmation.
terraform destroy -auto-approve
- Same as above but skips confirmation — used in automated cleanup pipelines (e.g. tearing down temporary test environments).
terraform destroy -target=oci_core_instance.my_vm
- Destroys only a specific resource instead of the entire stack.
terraform output
Displays all output values defined in outputs.tf — e.g. public IP, VCN OCID, load balancer endpoint.
terraform output -json
Returns outputs in JSON format — useful for piping into scripts or other automation tools.
terraform show
- Displays the full current state in human-readable format — every resource and its attributes.
terraform graph
- Generates a visual dependency graph of all resources — shows what depends on what (can be piped into Graphviz).
terraform workspace new dev
- Creates a new isolated workspace (e.g. Dev, UAT, Prod) — each with its own state file, using the same .tf code.
terraform workspace select prod
- Switches to a different workspace before running plan/apply.
terraform workspace list
- Shows all available workspaces in the current project.
Initialize a new Git repository
git init
Download an existing repository
git clone <repo>
** View file and repository status**
git status
Stage changes
git add <file> / git add
** Save a snapshot of staged changes**
git commit -m "message
View commit history
git log --oneline
List branches
git branch
Create and switch to a new branch
git checkout -b feature-x
Switch branches
git switch main
Merge a branch into the current branch
git merge feature-x
Fetch and merge the latest changes
git pull origin main
Upload local commits to GitHub
git push origin main
Show configured remote repositories
git remote -v
Download remote changes without merging
git fetch
Show code differences
git diff
Discard unstaged changes to a file
git restore <file>