Tag Archives: terraform

What I find interesting in cloud tech, May 2023

It’s long past time to write about IT stuff I’ve been working on. So much so I’ve too much material to provide, and rather than make an endless post, I’ll focus on cloud. I’ve mostly been doing work on IBM cloud, but I have some good stuff on AWS and Azure (Sorry GCP, no love for you this time.)

IBM Cloud: most of the work I’ve been doing on IBM cloud has been hands on, as you can tell from these links:

Other clouds: Not so much hands on, but interesting.

Advertisement

I asked ChatGPT to do my job and write some code to built out some cloud infrastructure. How did it go?

For fun I decide to see if I am ready to be replaced with AI via ChatGPT. Part of my work is building cloud based infrastructure using a language called HCL from Hashicorp using a tool called Terraform. You write one or more program files using HCL, run it through Terraform, and voila, you have the infrastructure you need.

For this exercise I entered the following prompt:

Create a terraform file for IBM cloud that will provision a VPC, set up networking for the VPC, and provision a virtual server for VPC. It will have 1 security group and a rule for this security group to allow SSH connection to your virtual server instance, 1 subnet to enable networking in your VPC, 1 VPC virtual server instance and 1 floating IP address that you use to access your VPC virtual server instance over the public network.

A good prompt, I thought. Nothing vague or conflicting. Practically a form of code itself.

I was shocked when in a few seconds I got this response:

To provision a VPC, networking, and a virtual server with a security group and a floating IP address on IBM Cloud, you can use the following Terraform configuration file:

# Configure the IBM provider
provider “ibm” {
generation = 2
region = “us-south”
}# Create a VPC
resource “ibm_is_vpc” “vpc” {
name = “my-vpc”
address_prefix_management = “auto”
}
# Create a subnet in the VPC
resource “ibm_is_subnet” “subnet” {
name = “my-subnet”
vpc = ibm_is_vpc.vpc.id
ipv4_cidr_block = “10.240.0.0/24”
}
# Create a security group
resource “ibm_is_security_group” “security_group” {
name = “my-security-group”
vpc = ibm_is_vpc.vpc.id
description = “Allow SSH inbound traffic”
}
# Add an SSH rule to the security group
resource “ibm_is_security_group_rule” “ssh_rule” {
security_group = ibm_is_security_group.security_group.id
direction = “inbound”
protocol = “tcp”
port_min = 22
port_max = 22
remote = “0.0.0.0/0”
}
# Create a virtual server instance in the subnet
resource “ibm_is_instance” “instance” {
name = “my-instance”
image = “ibm-centos-7-10-minimal-amd64-2”
profile = “bx2-2×8”
primary_network_interface {
subnet = ibm_is_subnet.subnet.id
}
vpc = ibm_is_vpc.vpc.id
security_groups = [ibm_is_security_group.security_group.id]
}
# Create a floating IP address
resource “ibm_is_floating_ip” “floating_ip” {
name = “my-floating-ip”
}
# Associate the floating IP address with the virtual server instance
resource “ibm_is_floating_ip_attachment” “attachment” {
floating_ip = ibm_is_floating_ip.floating_ip.address
instance = ibm_is_instance.instance.id
}

Before running the above code, replace with your IBM Cloud API key and and with the appropriate values for your IBM Cloud region and availability zone.
Once you have saved this configuration file, you can initialize Terraform by running terraform init, and then create the resources by running terraform apply. After a few minutes, Terraform will create the VPC, subnet, security group, virtual server, and floating IP address. You can then use the floating IP address to SSH into your virtual server instance over the public network.

Wow! What an amazing response, I thought!  It was quick, detailed, seemingly knowledgeable. Also…wrong.

There was so much fundamentally wrong with the code that the only way to get it to work was to rewrite much of it and also add a bunch of new code to make it work. I can’t even tell you how it came up with some of the statements: they are not defined that way for Terraform specs for IBM Cloud.

I even had the AI regenerate the code to see if it could get it right the second time. Instead the new code had 9 errors in it.

Fine. My manager provided me with a prompt of his own: see if it will work on AWS. (Good prompt, Ted!)

I did try it on AWS and Azure. With Azure the response was an incomplete script. (At least the IBM script was complete, though wrong.) With AWS the script was better. I could enter terraform plan and terraform thought it looked good. But once I entered terraform apply to build the resources, it failed.

I suspect the larger problem is lack of sufficient overlapping data for the AI tools to train on. So it sort of gets the code right, but sort of isn’t really good enough.

I see people on the Internet raving about how well AI is doing writing code. Some of the examples are interesting, but I think it has a way to go. I’ll stick to doing my day job. Without AI to help. 🙂

 

Kubernetes and Clouds and much more (What I find interesting in tech, July 2022)


Since April, here are a ton of links I found useful while doing my work. Lots of good stuff on Kubernetes and Cloud (both IBM’s and AWS’s); some cool hardware links; some worthwhile software links. Plus other things! Check it out.

Kubernetes: plenty of good things here to explore if you are doing things with Kubernetes like I was:

Terraform: Relatedly, I was doing work with Terraform and these were useful:

IBM Cloud: one of the two clouds I have been working with. Alot of the work was Kubernetes on IBM Cloud so you’ll see some overlap:

AWS: I work on alot of cloud providers. Mostly IBM Cloud but others like AWS

Software: some of these were work related, but some are more hobby oriented.

Hardware: the pickings are few here

Finally: here are an odd assortment of things worthwhile:

IBM Cloud, Terraform and DB2 (or some of what I find interesting in tech, nov 2021)

Wow! I haven’t done one of these posts on things I have found interesting in tech since July! So of course there is a lot here! I need to do these more often.

For this one it is mostly on the cloud and IBM cloud especially. Not so much Kubernetes this time, but lots on Terraform and DB2 in the cloud. A bit of IoT. Some software. I have a section on IT history which I like too.

Grab a coffee or tea or what have you and dig in. Take what you can use.

IBM Cloud: As usual, I’ve been doing work on cloud…mainly IBM Cloud. Here’s some IBM Cloud Docs on using their API. This on the IBM CLI is  a good reference. Here’s a good Alerts Overview on LOGDNA. This is massively helpful: the API Reference for  https : //sldn.softlayer.com/ … it’s very useful on how to use the API to work with IBM cloud. Here’s something on Alerts using sysdig. More on tracking:  IBM Cloud Monitoring Logging and Activity Tracker with Teams ( a good repo).

Other clouds: While I support IBM Cloud, if you are leaning otherwise, this could be helpful: Accelerating your Migration to AWS. Speaking of  AWS: Augmenting VMware Cloud on AWS Workloads with Native AWS services. Here are some pieces on Azure: Microsoft Azure cloud vulnerability is the worst you can imagine. I have no comment. Hey, maybe it’s time to get off Windows and SQL Server 2012 (or run them on Azure). If that’s you, read that.

On cloud in general, in case you were wondering, the answer to this question: Resiliency Is Automatic When I Move to the Cloud Right? is No. Here’s an interesting piece: The love/hate relationship the cloud has with Linux

Time flies! Happy 15th Birthday Amazon EC2. Lastly, here are the 5 Biggest Cloud Computing Trends In 2022 

Terraform: in working on cloud recently, I’ve been using Terraform and gathering links on using it. Lots of them. Here they are in somewhat random order. For example, discover best-practice VPC configuration for application deployment. Another piece on   IBM and Terraform.  Here’s more on it. Need a terraform Template for Monitoring with Sysdig Teams? If you need to plan create and update deployment environments using TF and IBM Cloud. This is a good blog post on Provisioning IBM Cloud Services With Terraform. If you need to deploy a n-Tier Web App in a Virtual Private Cloud using Terraform & Ansible. This piece is essential if you want to create services in IBM Cloud using Terraform IBM Cloud Services Info. Here’s how to give a .tf file as input in Terraform Apply command.  A page on data sources in Terraform resources explained with example. How about how to create Multiple Instances in a VPC Using Terraform. Or how to create reusable infrastructure with Terraform modules. Or a VPC. Or an n-Tier Web App in a Virtual Private Cloud using Terraform & Ansible .Here’s a piece on IBM Cloud Toolchain- Managed Devops for Schematics/Terraform. If you want to create Virtual servers in IBM cloud Terraform with for loop. A good intro: Getting started with IBM Terraform provider.

Still more on getting started with Terraform. Something harder: How to deploy high-availability web app using Terraform.

DB2: I have been doing lots of work on using DB2 on IBM Cloud. Here’s something on querying the IBM Cloud Databases API from the Command Line. Here’s something on using RESTful APIs and Microservices to Work With Db2. Here’s some examples of using the DB2 API: DB2 get about info,  and  Db2 get overall stuff, and Using the DB2 API.

Kubernetes: doing less stuff on Kubernetes this month, but I thought these were good: OpenShift vs. Kubernetes: What is the Difference? Helpful: Enable Rolling updates in Kubernetes with Zero downtime. Also helpful: Configure Liveness Readiness and Startup Probes.

Software (plus AI): for my DB2 work, I was calling the APIs using bash scripts. Here’s the answer to the question: What is the simplest way to dockerize a bash script? from Quora . Here’s something on executing a SHELL script in a docker container. Relatedly, here’s how to run a Bash script in an Alpine Docker container? 

Here’s some Unix pieces: Canonical extends Ubuntu 14.04 and 16.04 life cycle to 10 years. Good! Here’s how to do this on Debian 9:upgrade python 3.5 to python 3.7. Relatedly, here’s how to Install Python 3 on Mac – Brew Install Update Tutorial. Also related: Python on MacOS (Big Sur) . More related stuff on this:  How to fix “macOS: xcrun: error: invalid active developer path missing xcrun” error? 

I used to love the language APL. Here are two things on it: Is APL Dead? and Dyalog APL Tutor. I am curious to see how this plays out: Microsoft announces Windows 11 SE a new Chrome OS competitor.

Here’s two random AI links: The Secret Bias Hidden in Mortgage-Approval Algorithms (bad) and Motorist fined after CCTV confuses his number plate with woman’s T-shirt (funny bad).

IOT: Need to build front panels for your IOT projects? This is good for them. Relatedly the Ultratroninator3000.

Speaking of IOT projects, here’s some worth checking out: Top project ideas for the Raspberry Pi Zero. Then there is this: Simple Raspberry Pi Weather Station. Related: E-Ink Tide and Weather Tracker. This is a cool project for finance folks:  This tiny IoT ticker-meter turns your tabletop into a miniature stock forex and crypto market! Nice: Kobowriter transforms the Kobo Glo HD into an E Ink typewriter. I loved this: The Simpsons TV Made IRL with Raspberry Pi @Raspberry_Pi #PiDay #RaspberryPi.

IT History: here are a few good pieces on IT history. This was a great piece on how the iPod was developed: A Prototype Original iPod. Going back in time, here’s a good article on Sinclair’s amazing 1974 calculator hack. There was lots of talk about Sinclair computers after the great Home computing pioneer Sir Clive Sinclair dies aged recently at 81. Meanwhile in ancient history, IT wise: 50 years ago today the first UNIX Programmers Manual is released.

IBM History: I was reading this piece on  How IBM “lost the cloud” and it got me thinking. First, I don’t think IBM has lost the cloud business. I also think that IBM’s history is never straightforward and it is risky to count it out. For example, after e-business, IBM tried to promote the idea of autonomous computing. Here’s two pieces on it: Autonomic computing and Q&A: IBM sticks to autonomic computing agenda. It was a good idea, and it supported the work IBM was doing in the Tivoli space, but it was not as big a success as e-business IMHO. From there IBM did work on their Smarter Planet campaign and I believe it was more successful. I did some work in this area myself. From there IBM went into cloud. First there was a homegrown service, and then IBM bought Softlayer and went with that to compete with Amazon and then later Microsoft and Azure. For now the history is still being written. No one has won or lost until cloud is over or someone exits the field. Again, my opinion only.

Cool stuff: here’s something on a A LOST 1981 TRS-80 ADVENTURE GAME (SLIGHTLY REMASTERED FOR THIS CENTURY). Do you want to Turn your Android phone into a pocket Mac Plus? .Of course you do! Here’s a cool tool:  Doodle Ipsum. Check this out: This tiny Simpsons TV lets you watch tiny Simpsons TV. Very fun!

Here’s some cool Microsoft stuff:  Microsoft accounts to no longer need passwords and how to use a VBA procedure that deletes the current page in a Word document. Also this: Office Editing for Docs Sheets & Slides.

Here’s some cool Mac stuff: 12 Clever Apple TV 4K Settings Everyone Should Know About and macOS Terminal commands every Mac user should know

Very cool:  Need a new monitor for your computer? You can wear one on your face.

Generally:  here’s how to How to Mass Delete Emails in Gmail. Here’s a PrinCube Mobile Printer. I like it. Another cool device is this gloriously Fixable Laptop.

Speaking of laptops, here is the  Best cheap laptop of 2021. And here is something else cheap: The HP Chromebook 14 is just over $230 at Amazon right now. Relatedly, here’s 9 Reasons You Should Buy a Pixel 5a Over the iPhone SE.

These are some simple free fully responsive one-page sites for pretty much anything. And Elon Musk says Tesla is working on humanoid robots…sure…whatever edgelord.

Finally: document your code.  And remember, no matter how fast your networks get….

… never, never, never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway. 🙂

As always: thanks for reading this!

(Top photo from the story on the ipod. Bottom photo by Mostafa tarek on Unsplash)