<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Male Michael on Medium]]></title>
        <description><![CDATA[Stories by Male Michael on Medium]]></description>
        <link>https://medium.com/@malmike21?source=rss-1b48fbad4f14------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PvZ0p3t7AnwzF7Kz.</url>
            <title>Stories by Male Michael on Medium</title>
            <link>https://medium.com/@malmike21?source=rss-1b48fbad4f14------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:06:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malmike21/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Provisioning and Configuring a Virtual Machine on Digital Ocean with Terraform and Ansible]]></title>
            <link>https://medium.com/@malmike21/provisioning-and-configuring-a-virtual-machine-on-digital-ocean-with-terraform-and-ansible-eff261950778?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/eff261950778</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[digital-ocean-droplet]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 13:35:29 GMT</pubDate>
            <atom:updated>2025-01-30T17:47:36.209Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is divided into two parts: Part 1 focuses on deploying a DigitalOcean virtual machine using Terraform and performing initial updates with Ansible, and Part 2 (yet to be published) details the configuration of the deployed VM using Ansible playbooks.</p><h3>Introduction</h3><p>Setting up and managing infrastructure can be error-prone, time-consuming, and inconsistent, especially in complex environments. Infrastructure as Code (IaC) offers a solution by treating infrastructure as software, enabling automation, version control, and testing. In this article, we’ll explore how to provision and configure a virtual machine using two widely used IaC tools: Terraform and Ansible.</p><p>Terraform automates infrastructure creation and management using a declarative configuration language. This means you define the desired state of your infrastructure (the “what”), and Terraform handles the implementation (the “how”). With Terraform, you define infrastructure such as servers, networks, and storage in code, which is then translated into actionable plans to provision or update resources. Terraform relies on two essential components to achieve this: providers and provisioners.</p><p><strong>Providers</strong></p><p>Providers are plugins that connect Terraform to various infrastructure platforms. These include cloud providers like AWS, Azure, and Google Cloud Platform (GCP), on-premises solutions such as VMware, and other services. They define the available resources and their management methods</p><p><strong>Provisioners</strong></p><p>Provisioners execute specific tasks on a resource after it has been created. These tasks can include installing software, configuring system settings, or copying files to a virtual machine. By using provisioners, Terraform ensures that resources are not only created but also prepared for their intended use.</p><p>While Terraform excels at provisioning infrastructure, Ansible specializes in configuration management and task automation, ensuring that the infrastructure provisioned by Terraform is configured correctly and ready for use. Like Terraform, Ansible also employs a declarative approach allowing you to define configuration tasks in simple YAML playbooks. These playbooks specify the desired state of your systems, and Ansible handles the steps to achieve that state. This enables consistent and repeatable configurations across your infrastructure, managing system settings, software installations, and application deployments efficiently.</p><p>In the following sections, we will delve deeper into how Terraform and Ansible complement each other in automating infrastructure setup and configuration.</p><h3>Prerequisites</h3><ul><li>Interest in cloud infrastructure configuration tools (Terraform and Ansible)</li><li>Installed tools: <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli">Terraform</a>, <a href="https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html">Ansible</a>, and any dependencies (e.g., Python for Ansible).</li><li><a href="https://cloud.digitalocean.com/registrations/new">Digital ocean account</a></li><li><a href="https://docs.digitalocean.com/reference/api/create-personal-access-token/">Digital ocean personal access token</a></li><li><a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">Create a password-less SSH key</a> (NOTE: Ensure to add the SSH private key to the ssh-agent using ssh-add — apple-use-keychain ~/.ssh/id_ed25519 where id_ed25519 is the key name)</li><li><a href="https://docs.digitalocean.com/platform/teams/upload-ssh-keys/">Add the SSH key to your Digital Ocean account</a>(NOTE: Note the name of the key when adding it to Digital Ocean)</li></ul><h3>Project Overview</h3><p>The project structure below demonstrates a modular approach to provisioning a DigitalOcean virtual machine (VM) using Terraform.</p><pre>.<br>  |-DigitalOceanVM<br>  |  |-config.sh<br>  |  |-unset_config.sh<br>  |  |-inventory<br>  |  |-modules (folder containing terraform modules)<br>  |  |  |-vm-my-rides<br>  |  |  |  |-outputs.tf<br>  |  |  |  |-main.tf<br>  |  |  |  |-providers.tf<br>  |  |  |  |-variables.tf<br>  |  |-main.tf</pre><p>Here’s an overview of the key components:</p><p><strong>Root Directory</strong></p><ul><li><strong>DigitalOceanVM (Main Directory)</strong>: This is the root directory for the project containing all configuration files and subdirectories.</li></ul><p><strong>Environment Configurations</strong></p><ul><li><strong>config.sh</strong>: A shell script to initialize the Terraform and Ansible setup by exporting necessary environment variables or configurations.</li><li><strong>unset_config.sh</strong>: A complementary script to clean up or unset previously configured environment variables, ensuring a tidy working environment.</li></ul><p><strong>Terraform Configuration:</strong></p><blockquote><em>Terraform modules are reusable, self-contained packages or directories of terraform configurations, that allow one to encapsulate and share infrastructure code. This project uses local terraform modules.</em></blockquote><ul><li><strong>main.tf</strong>: The primary Terraform configuration file for defining resources and invoking modules.</li><li><strong>modules (folder):</strong> This directory contains Terraform modules for defining reusable infrastructure components.</li><li><strong>modules/vm-my-rides (folder):</strong> This module defines the infrastructure for the digital ocean virtual machine. It includes:</li><li><strong>modules/vm-my-rides/outputs.tf</strong>: Defines outputs from the module such as the droplet’s IP address, which can be consumed by other configurations or tools (e.g., Ansible).</li><li><strong>modules/vm-my-rides/main.tf</strong>: Main terraform configuration file for the VM module. It specifies the resources for provisioning the droplet, including size, region, and SSH keys.</li><li><strong>modules/vm-my-rides/providers.tf</strong>: Defines the terraform providers and it’s required credentials used within the module, which for this project is the Digital Ocean provider.</li><li><strong>modules/vm-my-rides/variables.tf</strong>: Defines variables used throughout the module such as VM size, region etc.</li><li><strong>Inventory: </strong>Defines the hosts/ groups of hosts that Ansible manages, specifying their connection details and variables associated with them. For this project, it will be auto-generated by Terraform based on the output for the IPv4 address</li></ul><h3><strong>Terraform Provisioning work overview</strong></h3><p>The typical terraform provisioning workflow consists of three key commands, terraform init, terraform plan and terraform apply</p><p><strong>1. </strong><strong>terraform init (Initialization)</strong></p><p>This command initializes the Terraform working directory. It performs the following actions:</p><ul><li><strong>Downloads providers:</strong> Retrieves the necessary provider plugins (e.g., the DigitalOcean provider) required by your configuration.</li><li><strong>Initializes backend:</strong> Configures the state backend if you’re using remote state storage.</li><li><strong>Initializes modules:</strong> Downloads and initializes any modules used in your configuration.</li></ul><p><strong>2. </strong><strong>terraform plan (Planning)</strong></p><p>This command generates an execution plan, showing the changes Terraform will make to your infrastructure. It works by:</p><ul><li><strong>Reading configuration:</strong> Parsing your .tf files to determine the desired state.</li><li><strong>Reading state:</strong> Loading the current state of your infrastructure from the state file.</li><li><strong>Comparing states:</strong> Comparing the desired and current states to identify necessary actions (create, update, or destroy).</li><li><strong>Outputting the plan:</strong> Displaying a human-readable summary of the planned changes.</li></ul><p><strong>3. </strong><strong>terraform apply (Applying)</strong></p><p>This command applies the changes described in the execution plan, creating or updating your infrastructure. It performs these steps:</p><ul><li><strong>Reading configuration:</strong> Parses your .tf files.</li><li><strong>Creating execution plan:</strong> Generates a plan (or uses a pre-generated plan if one was saved with terraform plan -out).</li><li><strong>Prompting for confirmation:</strong> Asks for confirmation before applying the changes (unless the -auto-approve flag is used).</li><li><strong>Applying changes:</strong> Executes the actions in the execution plan, provisioning or updating your infrastructure.</li></ul><h3>Step-by-Step Implementation</h3><h4>Step 1: Setting Up Terraform</h4><p><strong><em>Action 1: Adding DigitalOcean Access Token to local environment<br></em></strong>Terraform uses the DigitalOcean Personal Access Token you created in the prerequisites to communicate with the Digital Ocean API and manage resources in your account. Export your token to the environment variable called DO_PAT by running</p><pre>export DO_PAT=”your_actual_digitalocean_token”</pre><p><strong><em>Action 2: Define the digital ocean provider within the terraform root module </em></strong><strong><em>main.tf:</em></strong></p><p>We let Terraform know which cloud provider to use. Terraform supports a variety of service providers each with its specification that maps to the API of the specific service provider. You can find the list of providers with their installation instructions <a href="https://registry.terraform.io/browse/providers">here</a>. For this project we will use the digital ocean provider and will connect to it as shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0202e58988bace20fd3949997e57b1e8/href">https://medium.com/media/0202e58988bace20fd3949997e57b1e8/href</a></iframe><p><strong><em>Required provides</em></strong><br>We specify the required providers and their versions using terraform{required_providers{...}} . It’s good practice to constrain the version to prevent unexpected behaviour from provider updates.</p><p><strong><em>Terraform variables</em></strong><br>Terraform variables allow you to dynamically configure values within your Terraform configuration without directly modifying the code. For variables declared in the root module’smain.tf, their values can be set using CLI options or environment variables. When the sensitive = true argument is assigned to a variable, it marks the variable as sensitive, ensuring its value is hidden in logs and not stored in plain text within the state file. Here we defined two variables:</p><ul><li><strong>variable “do_token” { … }:</strong> Holds my digital ocean personnel access token.</li><li><strong>variable “pvt_key” { … }:</strong> Holds the path to the private SSH key created in the prerequisites. Will be used when Terraform is logging into the droplet.</li></ul><p><strong><em>Configure provider</em></strong></p><p>To configure the provider, we use the provider &quot;digitalocean&quot; { ... } block. Within this block, we specify the credentials for the DigitalOcean account by setting the token argument to the variable var.do_token with token = var.do_token.</p><p><strong>Action 3: Initialize the terraform project</strong></p><pre>terraform init</pre><p>This command initializes the Terraform environment, including downloading necessary provider plugins. The output will resemble:</p><pre>Initializing the backend...<br>Initializing provider plugins...<br>- Finding digitalocean/digitalocean versions matching &quot;~&gt; 2.0&quot;...<br>- Installing digitalocean/digitalocean v2.46.1...<br>- Installed digitalocean/digitalocean v2.46.1 (signed by a HashiCorp partner, key ID F82037E524B9C0E8)<br>Partner and community providers are signed by their developers.<br>If you&#39;d like to know more about provider signing, you can read about it here:<br>https://www.terraform.io/docs/cli/plugins/signing.html<br>Terraform has created a lock file .terraform.lock.hcl to record the provider<br>selections it made above. Include this file in your version control repository<br>so that Terraform can guarantee to make the same selections by default when<br>you run &quot;terraform init&quot; in the future.<br><br>Terraform has been successfully initialized!<br><br>You may now begin working with Terraform. Try running &quot;terraform plan&quot; to see<br>any changes that are required for your infrastructure. All Terraform commands<br>should now work.<br><br>If you ever set or change modules or backend configuration for Terraform,<br>rerun this command to reinitialize your working directory. If you forget, other<br>commands will detect it and remind you to do so if necessary.</pre><p><strong>Action 4: Provisioning of the virtual machine within a terraform module.</strong></p><p>The modules folder will contain the terraform modules for this project. The folder vm-my-rides will house the module that provisions the virtual machine on Digital Ocean.</p><p><strong><em>Sub_action 1: Terraform module provider and data source ( </em></strong><strong><em>modules/vm-my-rides/providers.tf )</em></strong></p><ol><li><strong><em>Terraform module provider</em></strong></li></ol><p>Like the root module, each module must know which provider is responsible for provisioning its resources. For HashiCorp-maintained providers (<a href="https://registry.terraform.io/browse/providers?tier=official">available in the Terraform Registry and published by HashiCorp</a>), Terraform automatically passes the provider context to its child modules. However, the DigitalOcean provider is a community provider and is not maintained by HashiCorp. As a result, the required_providers block must be explicitly defined in any child modules that use the DigitalOcean provider. Otherwise, you will encounter a &quot;Provider type mismatch&quot; error similar to that below:</p><pre>│ Error: Provider type mismatch<br>│ <br>│   on main.tf line 18, in module &quot;run_vm_my_rides&quot;:<br>│   18:     digitalocean = digitalocean.digitalocean<br>│ <br>│ The local name &quot;digitalocean.digitalocean&quot; in the root module represents provider &quot;digitalocean/digitalocean&quot;, but &quot;digitalocean&quot; in<br>│ module.run_vm_my_rides represents &quot;hashicorp/digitalocean&quot;.<br>│ <br>│ Each provider has its own distinct configuration schema and provider types, so this module&#39;s &quot;digitalocean&quot; can be assigned only a<br>│ configuration for hashicorp/digitalocean, which is not required by module.run_vm_my_rides.</pre><p>When working with multiple modules or troubleshooting provider-related issues, the terraform providers command can be helpful. This command lists the providers required by the root module and any modules it directly calls, showing their source and any version constraints. This allows you to verify that you’ve correctly specified provider requirements in your configuration. Expect an output similar to:</p><pre>Providers required by configuration:<br>.<br>├── provider[registry.terraform.io/hashicorp/local]<br>├── provider[registry.terraform.io/hashicorp/null]<br>├── provider[registry.terraform.io/digitalocean/digitalocean] ~&gt; 2.0<br>└── module.run_vm_my_rides<br>    └── provider[registry.terraform.io/digitalocean/digitalocean] ~&gt; 2.0</pre><p><em>Code snippet for the provider and data source( </em><em>modules/vm-my-rides/providers.tf )</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f777e8671fe363be481de03f537a316/href">https://medium.com/media/6f777e8671fe363be481de03f537a316/href</a></iframe><p><strong><em>2. Terraform data source</em></strong></p><p>The above code snippet includes a data source declaration for Terraform.</p><blockquote>Data sources in Terraform are used to fetch information from the provider’s API which can then be referenced and used in other parts of your configuration.</blockquote><p>The declaration data &quot;digitalocean_ssh_key&quot; &quot;set_ssh_key&quot; {...} retrieves information about the existing SSH key in DigitalOcean by its name. The key is identified by its name, specified through the name = var.do_ssh_key_name argument. Notice that we are using a terraform variable to assign the name.</p><p><strong><em>Sub_action 2: Terraform module variables and locals ( </em></strong><strong><em>modules/vm-my-rides/variables.tf )</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0360851c177ca958d8cc999b50c3e4e8/href">https://medium.com/media/0360851c177ca958d8cc999b50c3e4e8/href</a></iframe><p>The above code snippet defines local values and variables used within the vm-my-rides module.</p><blockquote>Terraform locals define named, immutable values within a module. Unlike externally set variables, locals are either directly assigned or derived from expressions within the configuration. They are useful for creating derived values that are used multiple times within the configuration.</blockquote><p>The locals { ... } block is used to define local values. The line connection_user = &quot;root&quot; defines a local value named connection_user and sets it to &quot;root,&quot; which will serve as the username for SSH connections to the provisioned server.</p><p>The terraform module variables are passed into the module from the root module. Breakdown of the variables:</p><ul><li>variable “do_token” { … } : Holds the DigitalOcean API token</li><li>variable “pvt_key” { … } : Stores the private key used for SSH authentication.</li><li>variable “pub_key” { … } : Stores the public key used for SSH access.</li><li>variable “do_ssh_key_name” { … } : Specifies the name of an existing SSH key in DigitalOcean.</li><li>variable “ubuntu_image” { … } : Defines the image or operating system to use for the DigitalOcean Droplet, such as ubuntu-20-04-x64.</li><li>variable “deployment_region” { … } : Specifies the region where the resources should be deployed, e.g., nyc3, sfo3</li><li>variable “droplet_size” { … } : Defines the size of the DigitalOcean Droplet, such as s-1vcpu-1gb.</li><li>variable “droplet_name” { … } : Assigns a name to the DigitalOcean Droplet for identification purposes.</li></ul><p><strong><em>Sub_action 3: Defining the virtual machine using a terraform resource ( </em></strong><strong><em>modules/vm-my-rides/main.tf )</em></strong></p><blockquote>A Terraform resource represents an infrastructure component like a server, database, or network that a provider can manage. They define the desired state of these components, specifying what should be created, managed, or modified within the target system.</blockquote><p>Digital ocean terraform resource</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2ca6992a15ff66b39da0f5f5a940ab1/href">https://medium.com/media/b2ca6992a15ff66b39da0f5f5a940ab1/href</a></iframe><p><strong><em>Resource Definition:</em></strong></p><p>The block resource &quot;digitalocean_droplet&quot; &quot;vm-my-rides&quot; { ... } represents a Terraform resource that defines a DigitalOcean virtual machine. The resource type digitalocean_dropletspecifies that the resource is a DigitalOcean Droplet, while vm-my-rides is the local identifier used to reference this specific resource within the Terraform configuration.</p><p><strong><em>Configuration Arguments:</em></strong></p><p>The { ... } section contains arguments that define the resource’s properties. These arguments are specific to the resource type and are documented by the provider. For this resource, the following arguments are included:</p><ul><li><strong>image</strong>: Specifies the OS image for the Droplet (e.g., ubuntu-20-04-x64). The value is provided via the variable var.ubuntu_image.</li><li><strong>name</strong>: Sets the name of the Droplet, passed in through the variable var.droplet_name.</li><li><strong>region</strong>: Specifies the deployment region for the Droplet (e.g., nyc3, sfo3), sourced from var.deployment_region.</li><li><strong>size</strong>: Defines the Droplet size (e.g., s-1vcpu-1gb), taken from var.droplet_size.</li><li><strong>ssh_keys</strong>: Configures the Droplet with an existing SSH key/ keys. Uses the ID of an SSH key fetched from a DigitalOcean data source data.digitalocean_ssh_key.set_ssh_key.id.</li></ul><p><strong><em>Provisioner for post-deployment actions:</em></strong></p><p>The provisioner “remote-exec” { … } block defines a provisioner that executes commands or actions on the droplet after it is created. The type remote-exec indicates that the commands will be executed remotely on the server.</p><p><strong><em>Inline Provisioner Commands:</em></strong></p><p>The inline = [ … ] block specifies that the commands to be executed are written directly within the configuration. These commands include:</p><ul><li>export PATH=$PATH:/usr/bin: Adds /usr/bin to the system&#39;s PATH.</li><li>sudo apt update: Updates the package list on the Droplet using apt</li><li>echo DONE!: Prints &quot;DONE!&quot; to confirm the completion of the commands.</li></ul><p><strong><em>Connection Details for Provisioner:</em></strong></p><p>The connection { … } block defines the details needed to establish an SSH connection to the droplet for executing the provisioner commands. Key arguments include:</p><ul><li><strong>host</strong>: Specifies the IPv4 address of the Droplet, referenced by self.ipv4_address.</li><li><strong>user</strong>: Defines the SSH user, sourced from local.connection_user.</li><li><strong>type</strong>: Sets the connection type, which is ssh.</li><li><strong>private_key</strong>: Provides the private SSH key, loaded from the file defined by var.pvt_key.</li><li><strong>timeout</strong>: Specifies a timeout of 2 minutes for the connection.</li><li><strong>agent</strong>: Disables the use of the SSH agent by setting it to false.</li></ul><p><strong><em>Sub_action 4: Terraform output</em></strong></p><blockquote>Terraform output values are used to expose information about the infrastructure once it has been provisioned. Defined within <em>output</em> blocks, these values can be displayed on the command line after running <em>terraform apply</em> or accessed programmatically by tools like Ansible or other configurations.</blockquote><p><strong><em>Defining the module outputs ( </em></strong><strong><em>modules/vm-my-rides/outputs.tf )</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29020cec93422b3cfb3476c775eb57c5/href">https://medium.com/media/29020cec93422b3cfb3476c775eb57c5/href</a></iframe><p>The output &quot;droplet_ip_address&quot; { ... } block defines an output named droplet_ip_address to expose the public IPv4 address of the provisioned DigitalOcean Droplet. value = digitalocean_droplet.vm-my-rides.ipv4_address sets the output&#39;s value. sensitive = false indicates the value is not considered sensitive.</p><p><strong><em>Action 5: Calling the child module in the root module</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/faefe7a6300fa60191501588e5c541b4/href">https://medium.com/media/faefe7a6300fa60191501588e5c541b4/href</a></iframe><p>This block of code defines a module call along with the variables it uses. The module run_vm_my_rides is responsible for provisioning a virtual machine (VM) in DigitalOcean using the configurations stored in the ./modules/vm-my-rides directory. Here&#39;s a detailed breakdown:</p><p><strong><em>Module Call:</em></strong></p><ul><li>The module block creates an instance of a Terraform module and passes parameters to it.</li><li>module &quot;run_vm_my_rides&quot; { ... }: Declares the module with the local name run_vm_my_rides. This name is used to reference the module&#39;s outputs within the root configuration.</li><li>source = &quot;./modules/vm-my-rides&quot;: Specifies the directory where the module’s source files are located.</li><li>providers = { digitalocean = digitalocean.digitalocean }: Links the digitalocean provider required by the module to the provider configuration in the root module. This explicit mapping is necessary for community providers like DigitalOcean, as Terraform does not automatically pass these to child modules. Without it, a &quot;Provider type mismatch&quot; error may occur.</li><li>Variables are passed to the child module using syntax like do_token = var.do_token. This connects a variable from the root module to the corresponding input variable in the child module, for instance, do_token = var.do_token links the root module’s var.do_token to the child module’s do_token input variable.</li></ul><p><strong><em>Variable Definitions</em></strong>:</p><p>The variables specify the module’s configuration options along with their default values or properties:</p><ul><li><strong>do_token and </strong><strong>pvt_key</strong>: These variables are marked as sensitive = true because they store sensitive information, namely the DigitalOcean token and the private SSH key.</li><li><strong>do_token, </strong><strong>pvt_key, </strong><strong>pub_key, and </strong><strong>do_ssh_key_name</strong>: These variables do not have default values, meaning they must be explicitly provided during a terraform apply exection.</li><li><strong>ubuntu_image, </strong><strong>droplet_name, </strong><strong>deployment_region, and </strong><strong>droplet_size</strong>: These variables are assigned default values, making them optional. If no external values are provided, Terraform will use the defaults specified in the configuration.</li></ul><p><strong><em>Root module terraform output:</em></strong></p><p>The child module’s terraform output &quot;droplet_ip_address&quot; { ... } is only accessible within the root module. To access this value externally, you must create an output in the root module that re-exports the child module&#39;s output.</p><p><strong><em>Action 6: Creating an ansible inventory using the IPv4 address exposed in the module outputs</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3e8363611f1506b1369487e3370821b/href">https://medium.com/media/e3e8363611f1506b1369487e3370821b/href</a></iframe><p>The local_file resource is used to create or manage a file on the local machine where Terraform is executed. In the provided code snippet, the local_file resource, named droplet_ip_address, generates a file called &quot;inventory&quot;. The content argument, set to module.run_vm_my_rides.droplet_ip_address, specifies the file&#39;s content as the public IPv4 address of the provisioned Droplet, retrieved from the droplet_ip_address output of the run_vm_my_rides module. This inventory file, containing the Droplet&#39;s IP address, can then be utilized with Ansible to configure the newly provisioned Droplet.</p><p><strong><em>Action 7: Running ansible</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c78b6b9ed91812f729a615d4138912bc/href">https://medium.com/media/c78b6b9ed91812f729a615d4138912bc/href</a></iframe><p>The code snippet features a null_resource, a type of Terraform resource that doesn&#39;t manage actual infrastructure but serves as a placeholder or trigger for provisioners or other actions within the Terraform configuration. In this case, it is used to trigger a local-exec provisioner.</p><p>Unlike the remote-exec provisioner, which runs commands on a provisioned resource (like the created Droplet), the local-exec provisioner executes commands on the local machine where Terraform is running. The command argument specifies the command to be executed, which, in this instance, instructs the local machine to run Ansible to upgrade the system packages on the provisioned Droplet. Command breakdown:</p><ul><li><strong>ANSIBLE_HOST_KEY_CHECKING=False</strong>: This sets an environment variable that disables SSH host key checking key checking for Ansible. By doing so, ansible skips the step of verifying the identity of the remote host based on the host’s public key.</li><li><strong>ansible all</strong>: Specifies that the ansible command applies to all hosts defined in the inventory.</li><li><strong>-i inventory</strong>: Points to the inventory file created earlier, which contains the Droplet’s IP address.</li><li><strong>-u root</strong>: Specifies the username for the SSH connection to the Droplet as root</li><li><strong>-m apt</strong>: Specifies the Ansible module to use, which is the apt module (for managing packages on Debian/Ubuntu systems).</li><li><strong>-a &#39;upgrade=yes update_cache=yes cache_valid_time=86400&#39;</strong>: Specifies the arguments for the apt module whereby upgrade=yes upgrades all upgradable packages, update_cache=yes updates the local package cache and cache_valid_time=86400 sets the APT cache validity time to 24 hours (86400 seconds).</li><li><strong>--private-key ${var.pvt_key}</strong>: This specifies the private SSH key to use for authentication, dynamically referencing the pvt_key Terraform variable.</li><li><strong>--become</strong>: Tells Ansible to use privilege escalation (like sudo) to execute commands with root privileges on the remote host.</li></ul><p><strong><em>Action 8: The resultant </em></strong><strong><em>main.tf in the root module should look like:</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/928cf3dec12bd9d8c83e9570eedee0e9/href">https://medium.com/media/928cf3dec12bd9d8c83e9570eedee0e9/href</a></iframe><h4>Step 2: Applying Terraform Configuration</h4><p><strong><em>Action 1: </em></strong><strong><em>terraform init<br></em></strong>Since we’ve created a local child module, running terraform init is required to prepare the module for use. Among other initialization tasks (such as downloading provider plugins and configuring the backend), terraform init copies the local module into the .terraform directory, making it available for use by Terraform.</p><p><strong><em>Action 2: </em></strong><strong><em>terraform plan</em></strong></p><p>Before applying changes, it’s crucial to review Terraform’s planned actions using terraform plan. This command shows what Terraform intends to do with your infrastructure based on the configuration. To manage multiple variables efficiently, this example utilizes a Bash script to export them as environment variables, making them readily accessible to Terraform during execution.</p><p>This script demonstrates setting up the required environment variables:</p><pre>#! /bin/bash<br>export DROPLET_SIZE=${DROPLET_SIZE:-&quot;s-1vcpu-512mb-10gb&quot;} # You can select a droplet size from https://slugs.do-api.dev/<br>export PVT_KEY=&quot;$HOME/.ssh/{pvt_key_name}&quot;<br>export PUB_KEY=&quot;$HOME/.ssh/{pub_key_name}&quot;<br>export DIGITALOCEAN_SSH_KEY=&quot;{name_of_ssh_key_used_in_digital_ocean}&quot;<br>export DO_PAT=&quot;{your_personal_access_token}&quot;<br>export TF_LOG=&quot;INFO&quot;</pre><p>As you can see, the script uses placeholders for sensitive data like access tokens and private key paths. After exporting these variables, the terraform plan command is executed with the following syntax to reference the environment variables:</p><pre>terraform plan \<br>  -var &quot;do_token=${DO_PAT}&quot; \<br>  -var &quot;pvt_key=${PVT_KEY}&quot; \<br>  -var &quot;pub_key=${PUB_KEY}&quot; \<br>  -var &quot;do_ssh_key_name=${DIGITALOCEAN_SSH_KEY}&quot; \<br>  -var &quot;droplet_size=${DROPLET_SIZE}&quot;</pre><p>Sample output:</p><pre>2024-12-27T12:40:32.526+0100 [INFO]  backend/local: plan operation completed<br><br>Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:<br>  + create<br><br>Terraform will perform the following actions:<br><br>  # local_file.droplet_ip_address will be created<br>  + resource &quot;local_file&quot; &quot;droplet_ip_address&quot; {<br>      + content              = (known after apply)<br>      + content_base64sha256 = (known after apply)<br>      + content_base64sha512 = (known after apply)<br>      + content_md5          = (known after apply)<br>      + content_sha1         = (known after apply)<br>      + content_sha256       = (known after apply)<br>      + content_sha512       = (known after apply)<br>      + directory_permission = &quot;0777&quot;<br>      + file_permission      = &quot;0777&quot;<br>      + filename             = &quot;inventory&quot;<br>      + id                   = (known after apply)<br>    }<br><br>  # null_resource.run_ansible will be created<br>  + resource &quot;null_resource&quot; &quot;run_ansible&quot; {<br>      + id = (known after apply)<br>    }<br><br>  # module.run_vm_my_rides.digitalocean_droplet.vm-my-rides will be created<br>  + resource &quot;digitalocean_droplet&quot; &quot;vm-my-rides&quot; {<br>      + backups              = false<br>      + created_at           = (known after apply)<br>      + disk                 = (known after apply)<br>      + graceful_shutdown    = false<br>      + id                   = (known after apply)<br>      + image                = &quot;ubuntu-24-10-x64&quot;<br>      + ipv4_address         = (known after apply)<br>      + ipv4_address_private = (known after apply)<br>      + ipv6                 = false<br>      + ipv6_address         = (known after apply)<br>      + locked               = (known after apply)<br>      + memory               = (known after apply)<br>      + monitoring           = false<br>      + name                 = &quot;vm-my-rides&quot;<br>      + price_hourly         = (known after apply)<br>      + price_monthly        = (known after apply)<br>      + private_networking   = (known after apply)<br>      + region               = &quot;fra1&quot;<br>      + resize_disk          = true<br>      + size                 = &quot;s-1vcpu-512mb-10gb&quot;<br>      + ssh_keys             = [<br>          + &quot;44475965&quot;,<br>        ]<br>      + status               = (known after apply)<br>      + urn                  = (known after apply)<br>      + vcpus                = (known after apply)<br>      + volume_ids           = (known after apply)<br>      + vpc_uuid             = (known after apply)<br>    }<br><br>Plan: 3 to add, 0 to change, 0 to destroy.<br><br>Changes to Outputs:<br>  + droplet_ip_address = (known after apply)</pre><p><strong><em>Action 3: </em></strong><strong><em>terraform apply</em></strong></p><p>To provision the virtual machine, execute the following terraform apply command, passing in the required variables:</p><pre>terraform apply \<br>  -var &quot;do_token=${DO_PAT}&quot; \<br>  -var &quot;pvt_key=${PVT_KEY}&quot; \<br>  -var &quot;pub_key=${PUB_KEY}&quot; \<br>  -var &quot;do_ssh_key_name=${DIGITALOCEAN_SSH_KEY}&quot; \<br>  -var &quot;droplet_size=${DROPLET_SIZE}&quot;</pre><p>You’ll get the same output as before, but this time, Terraform will ask you if you want to proceed:</p><pre>...<br>Plan: 3 to add, 0 to change, 0 to destroy.<br><br>Changes to Outputs:<br>  + droplet_ip_address = (known after apply)<br><br>Do you want to perform these actions?<br>  Terraform will perform the actions described above.<br>  Only &#39;yes&#39; will be accepted to approve.<br><br>  Enter a value: yes</pre><p>Typing yes and pressing Enter confirms the plan and provisions the droplet.</p><p>Sample output:</p><pre>2024-12-27T18:10:16.667+0100 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/null/3.2.3/darwin_arm64/terraform-provider-null_v3.2.3_x5 id=32989<br><br>Apply complete! Resources: 3 added, 0 changed, 0 destroyed.<br><br>Outputs:<br><br>droplet_ip_address = &quot;161.35.213.23&quot;</pre><p><strong><em>Action 4: </em></strong><strong><em>terraform destroy</em></strong></p><p>terraform destroy is the command used to destroy infrastructure managed by Terraform. It&#39;s crucial for cleaning up resources when they are no longer needed, preventing <strong>unnecessary costs</strong> and <strong>maintaining a clean infrastructure environment</strong>. This command relies on the Terraform state file to know which resources to destroy<strong>.</strong> Terraform reads the state file, generates a destruction plan showing theorder of deletion, and prompts for confirmation before proceeding. <strong>Destruction is an irreversible action.</strong> If you are certain you want to remove the provisioned virtual machine, type yes and press Enter at the prompt. For automated destruction (e.g., in CI/CD pipelines), use the -auto-approve flag. You can also destroy individual resources using the -target flag e.g. terraform destroy -target digitalocean_droplet.my_droplet</p><h3>Test that the virtual machine has been properly provisioned</h3><p>To test that the virtual machine was created successfully, we will connect to it via SSH. Because the Droplet’s public IPv4 address is defined as an output in the root module, it is displayed to the console after a successful terraform apply. If you need to retrieve it later, you can use the terraform output command, which lists all outputs defined in the root module. To get the Droplet’s IP address specifically, run terraform output droplet_ip_address The output will resemble:</p><pre>2024-12-28T08:06:16.464+0100 [INFO]  CLI command args: []string{&quot;output&quot;, &quot;droplet_ip_address&quot;}<br>&quot;142.93.99.88&quot;</pre><p>You can then securely SSH into your virtual machine as the root user using the following command:</p><pre>ssh -i &quot;$PVT_KEY&quot; root@142.93.99.88</pre><p>Here, $PVT_KEY is an environment variable pointing to the SSH private key exported earlier. This key corresponds to the public key added to the virtual machine during its creation.</p><h3>Conclusion</h3><p>This article demonstrated how to provision a DigitalOcean virtual machine using Terraform, covering essential components such as providers, resources, and outputs, as well as core Terraform commands like init, plan, and apply. In Part 2, we will explore how to further configure the provisioned VM using Ansible playbooks. You can find the complete project code here:</p><p><a href="https://github.com/MalmikeFunProjects/DigitalOceanVm">GitHub - MalmikeFunProjects/DigitalOceanVm: Creating a Virtual Machine with digital ocean, terraform and ansible</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eff261950778" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My challenges and adaptations during the Andela Boot-camp]]></title>
            <link>https://medium.com/@malmike21/my-challenges-and-adaptations-during-the-andela-boot-camp-246cfcbed0a1?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/246cfcbed0a1</guid>
            <category><![CDATA[andela-bootcamp]]></category>
            <category><![CDATA[andela]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Mon, 24 Apr 2017 12:32:09 GMT</pubDate>
            <atom:updated>2017-04-24T12:32:09.941Z</atom:updated>
            <content:encoded><![CDATA[<p>Well, we are starting the second week of the Andela boot camp. Excitement and relief is what am experiencing. At least week 1 is finally over, where we were doing a self learning clinic. In short we were not required to be at the location the boot camp is being held. Just had to do the tasked assigned and hand them in online. This is an arrangement that is relatively good, because you have the option of doing the tasks from anywhere. The problem comes in when UMEME (the electricity distributor in Uganda) or your data provider decide that you are not a worth customer, so they decide to cut your resources off. You then have to start applying electricity knowledge that you last did in high school, to connect a UPS to your laptop and hope it does not blow and buy expensive data plans from other service providers. Well week done and problems averted.</p><p>With the assignments, you get various while creating the solutions, or take a long time interpreting what is required of you. I decided not to die with generating the solutions on my own. I commuted to a friends place such that we can go through the assignments together and if we are both stuck ask on the online Slack channels from any if the other people that have done the tasks. The other source of information was the internet, luckily what we were researching about was properly documented with examples of how we can accomplish it</p><p>In short have contingencies for the tasks you are to carryout, even for those minor resources that you do not notice but are vital to the creation of you project. Also do not fear to reach out for help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=246cfcbed0a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self Introduction]]></title>
            <link>https://medium.com/@malmike21/self-introduction-13fff0f5805f?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/13fff0f5805f</guid>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Fri, 21 Apr 2017 11:52:24 GMT</pubDate>
            <atom:updated>2017-04-21T11:52:24.250Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, am Male Michael. “Yes Male, but when reading it pronounce the vowels”. Anyway, am a freelance software developer, with hopes of changing the world with which ever application I build or will build. I have been in that industry for the past year as it is the one I studied for at university for the previous four years, luckily not years wasted since I am still working in the same field.</p><p>My love of computing started at an early age as a result of the environment around me, that is my father being an engineer and my elder brother always tinkering with electrical appliances and the computer at home. This push me to try and understand technology. Also with the drastic changes that were occurring in the technology sector that were also affecting my motherland, that is Uganda for example in the type of devices showing up on the market in the recreation category like portable music which was transitioning cassette tapes, to Cd&#39;s to devices that had appalling amounts of storage at that point in time. This was a clear indicator that it would be a field that can impact the masses for generations. And was dying to be one of the people that build applications for such devices or to create such devices or better ones. “That is still a dream at this point”.</p><p>So with every thing set out I took to learning how to program as the main field in computing that I concentrated on and that brings me to up towards this day. Initially from all the movies and series I had watched that involved technology, I thought it would involve me and my computer as my only companion, but that is a false stereotype. The field I landed in involved me having to increase my interaction with people in order to quickly boost my knowledge and collaborate on projects. It involved going to a multitude of events and coding <a href="https://en.wikipedia.org/wiki/Hackathon">hackathons</a> where they brought up topics that would impact communities and a field that pushes you to understand the other field and industries out there and collaborate with people from those fields in order to build meaningful applications.</p><p>“You do not build applications for yourself, you build them for others to use, so know what they what, understand how they are to use them and build exactly what they need.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13fff0f5805f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experiencing day 4 of Andela boot camp]]></title>
            <link>https://medium.com/@malmike21/experiencing-day-4-of-andela-boot-camp-b5aef85bbec0?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5aef85bbec0</guid>
            <category><![CDATA[andela-bootcamp]]></category>
            <category><![CDATA[andela]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Thu, 20 Apr 2017 13:15:30 GMT</pubDate>
            <atom:updated>2017-04-20T13:15:30.214Z</atom:updated>
            <content:encoded><![CDATA[<p>I start day 4 with having to do all the exercises since the day before the electricity and internet providers were not on my side. Anyway, I started out with finishing the first two exercises, and for that to easily be accomplished I traveled to a friends place so that we can collaborate and quickly accomplish those tasks.</p><p>We went into the first exercise of the binary search and tried to quickly resolve it. That was not the case, we were fulfilling most of the tests but two continued to fail. After two hours of tweaking with the code we were greeted with most of our group mates having similar issues. We uploaded the changes we had made to the online GitHub repository and decided to put it aside for later on and concentrate on the other tasks since we would not have any excuse for not accomplishing all the tasks. We then went of to the second exercise which was easier to solve as compared to the binary search number. We quickly resolved that and started on the last programming task of the day. This was to create a copy of the google home page using CSS and html. For all those that regularly use it, you must be thinking that it is an easy task since the page has like three section, but for me who had settled for using frameworks to help in the design process it was not an easy task. I took around five hours making changes in CSS while searching online for how certain html elements can be designed. At the end of the task I was really happy with what I had accomplished since the page looked pretty good and had done it in raw CSS.</p><p>In conclusion you should understand the basic principles before starting to use frameworks in programming. This would improve your understanding of those very frameworks and not limit you to what was implemented in them. Also you should properly set plans on how you are to accomplish certain tasks not just for the project you are doing, but also external environment changes that can affect it, taking the issue of my luck of electricity and internet as an example.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5aef85bbec0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My learning experience on day 3 boot camp]]></title>
            <link>https://medium.com/@malmike21/my-learning-experience-on-day-3-boot-camp-408871878324?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/408871878324</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Wed, 19 Apr 2017 11:58:24 GMT</pubDate>
            <atom:updated>2017-04-19T12:01:22.400Z</atom:updated>
            <content:encoded><![CDATA[<p>As day 2 for the boot camp concluded, I was relieved that I had finished submitting the solutions to the exercises that were provided. But I had to do a rush job on them since I was short of time for both the final submissions of day 1 and those of day 2. At that point I was of the view that I should relax after finishing all the exercises and only be left with polishing up my work. Since I was at a friend’s home and discussing through the solutions I was able to quickly close the first two exercises before realizing that it was late in the night. At this point I would be over intruding so I packed up and headed home.</p><p>On arriving home, I planned to continue the exercises with the hope of finishing all of day 3 exercises, but as I settled into my reading chair and powered up the laptop, the first thing that greeted my eyes was Day 2 solutions to the assignments. I started refactoring those and making minor changes and that went way into the night, I had to put off the programming exercise which was consuming data from a public web API to the next day. Since I was used to creating client applications for web API’s in JavaScript and nodeJS, I was sure it would not be difficult to apply similar logic in python.</p><p>As I set off with the task on the morning of day 3, I decided to apply tests to check the logic of the application consuming the web API. This I had not done in my other applications but it’s good practice. So since I have limited knowledge of TDD in python especially on the area of HTTP responses and calls, I decided to scour the web for probable solutions. This led me to an interesting library called mock, that helps create mock objects enables <a href="https://blog.fugue.co/2016-02-11-python-mocking-101.html">Mocking in python</a> which is the replacement of one or more function calls or objects with mock calls or objects. This would enable me change the calls made to the web server to an file stored on my local environment that contains test data. With the basic understanding of the mock module and how to apply, I went ahead to view examples of how where it was applied and what kind of test people run.</p><p>With the research done I went ahead to prepare for writing the application. I started writing the tests using similar structures to those I had seen. At the end of it all those tests were failing, concluding that there was no problem with my test logic. As I went ahead to build the application, some of the tests that I was expecting to start passing were not. This made me have to go through the test logic trying to figure out what went wrong and comparing it to the online examples. This went on for sometime before realizing that I had changed the name of one of the functions which I think was overriding an existing function causing it not to retrieve the mock variables. At that point I was glad I had done the rest of the exercises the day before and could put my whole attention to the task at hand and had at least realized what I did wrong rather than giving up on the tests entirely. After that I finished the logic for the client of the web API and was jumping for joy when it passed all the tests. I was only left with one task, and that was to create a function that will be run in the python interpreter, that will call the function consuming the web API. I was done with that in a short amount of time and concluded on that assignment.</p><p>So what I can say is ‘there are no short cuts to learning’, try to properly understand something before trying it out. That will save you a large amount of time and you can also find better ways of doing it. Also do not just give up half way the journey or go for the easier and less educative option. At that point you will be relieved but later on you will regret not having toiled the rest of the way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=408871878324" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My experience at the Andela boot camp]]></title>
            <link>https://medium.com/@malmike21/my-experience-at-the-andela-boot-camp-5075acc0bb54?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/5075acc0bb54</guid>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Tue, 18 Apr 2017 13:28:42 GMT</pubDate>
            <atom:updated>2017-04-21T02:57:36.680Z</atom:updated>
            <content:encoded><![CDATA[<p>It has been two day since the start of the boot camp. I joined it thinking that my knowledge in programming would give me an easy pass. That was not the case. At every point or turn something new comes up that either I did not know or had not taken priority. For starters I had since the assignments for day one were due at lunch time of day 2, I had entered day 2 with back load of tasks, I had covered part of them the previous day but was still left with creating tests for the prime number generator and writing the function to generate prime numbers that is meant to pass those tests.</p><p>To ease the task at hand I changed the venue in which I was working, to a friends place that was also doing the same task, such that we can discuss through the probable solutions, brain storm ideas on how to create the prime number generator and plan out proper execution of the task at hand. We established the testing criteria for the prime number generator that we thought was appropriate and went ahead to create our individual tests based on it. The task was requiring five tests, which when I was working alone looked like a stretch for me but as we discussed and worked on the tests, turned out to be less than the tests we could create.</p><p>When we were done with the tests we were left with creating the function. Since we had the tests worked on, we were build the application while tracking the changes made to the application using <a href="https://en.wikipedia.org/wiki/Git">git</a>. We worked on the function and as it passed each test, we committed that as a change to git. At the end of it we had created a proper working function and done with day ones tasks.</p><p>Only problem was that we had done this during the morning hours of day 2 and was only left with a few hours to work on the tasks of day 2. We went to the <a href="https://trello.com/">Trello board</a> and checked for what assignments we were expected to work on. For starters we were to use an Andela resource called andelabs for the day 2 assignments. My friend quickly gained access to it, but I was stuck since my account was being rejected. The main question that was running through my mind was why I had not cross checked that on day 1. I had to ask my group Learning Facilitator from Andela (LFA) to help give me access but that was also taking the little remaining time left for me to finish day 2 tasks. Luckily my friend had accessed the questions, so I went about solving them while waiting to get access. The LFA later on advised in the <a href="https://slack.com/">Slack </a>group that we create <a href="https://github.com/">GitHub </a>repositories for the solutions to the tasks. This was advantageous to me since I had started on the tasks and had been trucking them with git. Only thing left was to create the GitHub repository and push those changes to it. This enabled me cover most of the programming tests and was only left with the <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">Object Oriented Programming</a> (OOP) task.</p><p>The OOP task required us to create a solution to a real-world problem modeled using OOP while taking advantage of <a href="https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)">inheritance</a>, <a href="https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)">encapsulation</a>, <a href="https://en.wikipedia.org/wiki/Object-oriented_programming#Polymorphism">polymorphism </a>and the other OOP concepts. This was open ended so I went with a scenario of a how an employer employs and tracks the number of employees he has and also assigns them tasks. This allowed me to plan out the structure of my classes such that for one, we have a class called person, which is inherited by employee and the employee class inherited by employer and when an employer employs someone as an employee, then they are add to a list generated in the employer class. On finishing the plan, we were left with limited time to implement the task, so we quickly went about creating the classes and how they would show the stated OOP concepts. We accomplished showing the OOP concepts within the application, but had not built the application with all the functionality we had planned to implement. We quickly uploaded those changes to GitHub to show we has accomplished the task assigned. Since we still had access to the solution we would still add extra functionality it.</p><p>As I conclude I would advise that to pass through any exercise you can not cover it alone, that gives you a limited view of probable solutions, you have to collaborate with your group mates if not the results may turn out to be disastrous. You may think that your programming knowledge is vast but there are those small tests or structures that you may not consider that your colleague may notice. So when doing a project or programming, consult with others, do not die on the problem alone. Also do not just dive into a problem, plan how you will go about solving it. Make a proper analysis of the solution and structure it out before you start implementing it. This helped me when creating the solution for the OOP task as earlier stated. Since I had already established the structure of the minimum viable product to build for the solution that could represent what was asked for I quickly accomplished that task. Lastly properly plan the time you have to accomplish the tasks given to you and prioritize on the important things to do before carrying out other tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5075acc0bb54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My learning experience of developing for android]]></title>
            <link>https://medium.com/@malmike21/my-learning-experience-of-developing-for-android-5081441b6841?source=rss-1b48fbad4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/5081441b6841</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Male Michael]]></dc:creator>
            <pubDate>Mon, 17 Apr 2017 13:30:10 GMT</pubDate>
            <atom:updated>2017-04-17T14:32:53.798Z</atom:updated>
            <content:encoded><![CDATA[<p>A few months back I joined a project whose goal is to make services within Uganda accessible within an online platform and also as mobile applications. I had joined it as a back-end developer and was to implement it as a web API in <a href="https://nodejs.org/en/">NodeJs</a>. I was developing it with another developer who was assigned the task of developing the android application. On finishing the beta version for the web API, I decided to shift my attention to the android application since my colleague was still struggling with it. I was new to android development but I was conversant with Java and had wanted to further apply that knowledge on a platform such as android in addition to having to interact with some one that is conversant with it and applying it in a project which in turn would shorten my learning curve and fortify that knowledge by applying it within a project. I asked him for which concepts I should put emphasis on and which resources I should use while learning. I accessed the resources he had specified and also went a head to watch introductory tutorials of android while trying out the various exercises from within my local development environment within android studio. When I was done with that I asked him to do pair programming with me such that I can clearly understand the concepts, plus how and where to utilize them. Surprisingly I was also offering important programming concepts to add to the android application like where we can use certain design patterns to solve some of the issues he was facing while building the application. As we progressed with the application he showed me which 3rd party libraries and packages I should use that in his opinion would apply better than the default libraries like the <a href="http://square.github.io/retrofit/">Retrofit</a> for rest calls.</p><p>At the end of it I had learned how to develop android application, with a bit of insight of the more advanced concepts used in android.</p><p>In conclusion, anyone that plans to learn anything (not just programming), you are not the first person on that journey. Look for people that are more knowledgeable on the topic that can help advance your knowledge in that field. Also do not only receive that knowledge, understand it and if possible offer your opinion in certain areas. You never know that it might also impact positively on your facilitator or mentor. Also that feed back can help the facilitator or mentor know whether to have a clear understanding of the topic.</p><p><strong>“NO PERSON IS AN ISLAND”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5081441b6841" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>