{"id":24020930,"url":"https://github.com/akashdip2001/opentofu","last_synced_at":"2026-02-28T20:36:04.093Z","repository":{"id":270836659,"uuid":"911601575","full_name":"akashdip2001/OpenTofu","owner":"akashdip2001","description":"OpenTofu","archived":false,"fork":false,"pushed_at":"2025-01-03T13:16:39.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T23:32:50.393Z","etag":null,"topics":["devops","opentofu"],"latest_commit_sha":null,"homepage":"https://akashdip2001.github.io/OpenTofu/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akashdip2001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-03T12:00:49.000Z","updated_at":"2025-01-03T13:16:42.000Z","dependencies_parsed_at":"2025-01-03T13:30:37.395Z","dependency_job_id":null,"html_url":"https://github.com/akashdip2001/OpenTofu","commit_stats":null,"previous_names":["akashdip2001/opentofu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akashdip2001/OpenTofu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2FOpenTofu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2FOpenTofu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2FOpenTofu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2FOpenTofu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akashdip2001","download_url":"https://codeload.github.com/akashdip2001/OpenTofu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2FOpenTofu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29951659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","opentofu"],"created_at":"2025-01-08T12:19:07.225Z","updated_at":"2026-02-28T20:36:04.050Z","avatar_url":"https://github.com/akashdip2001.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenTofu\n\n[\u003cimg align=\"right\" alt=\"lfel1009-getting-started-with-opentofu\" width=\"300\" src=\"https://github.com/user-attachments/assets/76e667e7-1207-4c55-ac22-39954c148ea0\"\u003e](https://www.credly.com/badges/f8f23f57-70f5-4193-a939-1f9bd6622b4d/public_url) \n\n\n### Brief Notes on OpenTofu \u003c/br\u003e\n\n| [my Profile](https://openprofile.dev/profile/akashdip2001) |\n| --- |\n\n#### **Lab 1: Installing OpenTofu**  \n1. **Update System \u0026 Install Tools**:  \n   ```bash\n   sudo apt-get update  \n   sudo apt-get install -y apt-transport-https ca-certificates curl gnupg  \n   ```  \n\n2. **Download \u0026 Execute Installation Script**:  \n   ```bash\n   curl -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh  \n   chmod +x install-opentofu.sh  \n   sudo ./install-opentofu.sh --install-method snap  \n   ```  \n\n3. **Verify Installation**:  \n   ```bash\n   tofu -h  \n   ```  \n\n4. **Enable Auto-completion**:  \n   ```bash\n   tofu install-autocomplete  \n   ```  \n\n#### **Lab 2: Basics of OpenTofu**  \n1. **Create a Resource File**:  \n   - Create `main.tf`:  \n     ```hcl\n     resource \"local_file\" \"hello_world\" {  \n       filename = \"${path.module}/demo.txt\"  \n       content  = \u003c\u003c-EOF  \n       Hello World!!!  \n       Welcome to the fascinating world of OpenTofu!  \n       EOF  \n     }  \n     ```  \n\n2. **Format Code**:  \n   ```bash\n   tofu fmt main.tf  \n   ```  \n\n3. **Initialize Directory**:  \n   ```bash\n   mkdir demo \u0026\u0026 mv main.tf demo/ \u0026\u0026 cd demo  \n   tofu init  \n   ```  \n\n4. **Validate and Plan**:  \n   ```bash\n   tofu validate  \n   tofu plan  \n   ```  \n\n5. **Apply Changes**:  \n   ```bash\n   tofu apply  \n   ```  \n\n6. **Verify Output**:  \n   ```bash\n   cat demo.txt  \n   ```  \n\n7. **Cleanup Resources**:  \n   ```bash\n   tofu destroy  \n   ```  \n\n#### **Lab 3: Creating a Virtual Machine**  \n1. **Setup AWS Credentials**:  \n   - Example `main.tf`:  \n     ```hcl\n     provider \"aws\" {  \n       region     = \"us-east-1\"  \n       access_key = \"your_access_key\"  \n       secret_key = \"your_secret_key\"  \n     }  \n\n     resource \"aws_instance\" \"firstvm\" {  \n       ami           = \"ami-053b0d53c279acc90\"  \n       instance_type = \"t2.micro\"  \n       subnet_id     = \"your_subnet_id\"  \n     }  \n     ```  \n\n2. **Initialize, Plan \u0026 Apply**:  \n   ```bash\n   tofu init  \n   tofu plan  \n   tofu apply  \n   ```  \n\n3. **Destroy Resources**:  \n   ```bash\n   tofu destroy  \n   ```  \n\n#### **Key Commands**  \n- **Initialize Directory**: `tofu init`  \n- **Validate Config**: `tofu validate`  \n- **Generate Plan**: `tofu plan`  \n- **Apply Plan**: `tofu apply`  \n- **Destroy Resources**: `tofu destroy`  \n\n---\n\n### **OpenTofu: Theoretical Knowledge and Practical Guide**\n\n#### **What is OpenTofu?**  \nOpenTofu is an open-source infrastructure as code (IaC) tool used for provisioning and managing infrastructure resources in a declarative manner. It enables developers and DevOps engineers to define infrastructure configurations in human-readable files, which can then be applied consistently across different environments.\n\n---\n\n#### **Key Features of OpenTofu**  \n1. **Declarative Configuration**:  \n   Write infrastructure configurations in a simple and structured format.\n   \n2. **Provider Support**:  \n   Supports multiple cloud providers (AWS, Azure, GCP) and on-premise solutions.\n\n3. **State Management**:  \n   Tracks the state of your infrastructure to identify changes and apply only necessary updates.\n\n4. **Automation**:  \n   Automates the creation, updating, and destruction of infrastructure.\n\n5. **Version Control Friendly**:  \n   Configuration files can be stored in version control systems like Git for collaboration and history tracking.\n\n---\n\n#### **Core Concepts**  \n\n1. **Providers**:  \n   Plugins that interact with cloud services or APIs (e.g., AWS, Azure).  \n\n   Example:  \n   ```hcl\n   provider \"aws\" {\n       region = \"us-east-1\"\n   }\n   ```\n\n2. **Resources**:  \n   Describes infrastructure components like servers, databases, or storage.  \n\n   Example:  \n   ```hcl\n   resource \"aws_instance\" \"my_instance\" {\n       ami           = \"ami-053b0d53c279acc90\"\n       instance_type = \"t2.micro\"\n   }\n   ```\n\n3. **State**:  \n   A file that records the current state of your managed resources, ensuring consistency.\n\n4. **Modules**:  \n   Reusable blocks of configuration, similar to functions in programming.\n\n---\n\n#### **Workflow**  \n1. **Write Configuration**:  \n   Define resources and their attributes in `.tf` files.  \n\n2. **Initialize Directory**:  \n   Use `tofu init` to download necessary plugins and set up the working directory.  \n\n3. **Plan Changes**:  \n   Use `tofu plan` to preview the changes that will be made.  \n\n4. **Apply Configuration**:  \n   Use `tofu apply` to implement the changes in your infrastructure.  \n\n5. **Destroy Resources**:  \n   Use `tofu destroy` to clean up resources when no longer needed.\n\n---\n\n#### **Advantages of OpenTofu**  \n- **Consistency**: Ensures infrastructure remains consistent across different environments.  \n- **Collaboration**: Teams can collaborate using version-controlled configuration files.  \n- **Scalability**: Easily manage and scale infrastructure.  \n- **Efficiency**: Automates repetitive tasks, saving time and reducing human error.\n\n---\n\n#### **Practical Steps (Lab Examples)**\n\n**Lab 1: Local File Resource**  \n- **Goal**: Create a local file using OpenTofu.  \n- **Steps**:  \n  1. Define a `local_file` resource in `main.tf`.  \n  2. Initialize, plan, and apply the configuration.  \n  3. Verify the created file.\n\n**Lab 2: Virtual Machine Creation**  \n- **Goal**: Launch an AWS EC2 instance.  \n- **Steps**:  \n  1. Define AWS credentials and an EC2 resource in `main.tf`.  \n  2. Initialize, plan, and apply the configuration.  \n  3. Destroy resources after use.\n\n---\n\n#### **Best Practices**  \n1. **Use Modules**: For reusable and organized configurations.  \n2. **Manage State Securely**: Use remote storage (e.g., S3) for team collaboration.  \n3. **Version Locking**: Lock provider versions to avoid unexpected changes.  \n4. **Review Plans**: Always review `tofu plan` before applying.  \n5. **Backup State Files**: Prevent accidental state loss.\n\n---\n\n#### **Common Commands**  \n- `tofu init`: Initializes the directory and downloads provider plugins.  \n- `tofu validate`: Validates the configuration for syntax errors.  \n- `tofu plan`: Previews the changes to be applied.  \n- `tofu apply`: Implements the changes.  \n- `tofu destroy`: Deletes the resources defined in the configuration.  \n\n---\n\nBy combining theoretical knowledge with hands-on practice and the [Exam](https://www.linkedin.com/posts/the-linux-foundation-training-%26-certification_iac-opentofu-devops-activity-7280661407161860096-SSSJ?utm_source=share\u0026utm_medium=member_desktop), OpenTofu empowers you to efficiently manage and automate infrastructure, making it an essential tool for modern cloud and DevOps workflows.\n\n\u003c/br\u003e\n\u003c/br\u003e\n\n[![akashdip-mahapatra-5971be11-a39d-4c4a-a81f-a251043206ae-certificate_page-0001](https://github.com/user-attachments/assets/52cf30f7-e0af-4ea1-a398-7ea1d54995e6)](https://www.linkedin.com/posts/akashdip2001_devops-opentofu-iac-activity-7280700253522051074-TcAb)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashdip2001%2Fopentofu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakashdip2001%2Fopentofu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashdip2001%2Fopentofu/lists"}