Container image for cloud infra development
1.2K
Ensuring I don't have to be installing Terraform environments all the time.
I decided to build a container, based on Ubuntu that I will always use for my cloud platform builds.
Uses ubuntu:latest as the base image. curl, unzip, gnupg, and other essential dependencies. Terraform. Terragrunt. tf-switcher (TFSwitch). TFlint. checkov. AWS CLI. Azure CLI. Python and boto3. Sets /workspace as the working directory. Sets the default command to /bin/bash.
build image from Dockerfile
$ podman build -t cloud-infra-dev-env .
run container from the image. $ ~/developer/tools/container-start.sh docker.io/254in61/cloud-infra-dev-env cloud-infra-dev-env
Explanation: podman run: Starts a new container. -i: Interactive mode (keeps STDIN open). -t: Allocates a TTY (for Bash). --name my-container: Assigns a custom name (my-container). --restart=always: Ensures the container restarts automatically after a reboot or crash. bash: Launches a Bash shell inside the container.
Verify the Azure cli installation: $ az --version
Log into Azure: $ az login To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ****** to authenticate.
The browser will confirm your sign in and then your CLI will grt through
Random az cli cmds : a) List all resources in a subscription : $ az resource list --output table
b)If you want them in a JSON format : $ az resource list --output json
c) listing resources in a specific resource group: $ az resource list --resource-group --output table $ az resource list --resource-group alpha-resource-group --output table
d) list vms : $ az vm list --output table
Terraform needs an 'Azure Service Principal' to authenticate. Run: az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/"
$ az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/-*****--*****"
This will return:
{ "appId": "", "displayName": "", "password": "", "tenant": "" }
Save these securely, as they are needed in Terraform.
It will be added in your provider.tf file :
provider "azurerm" { features {}
subscription_id = "<your-subscription-id>"
client_id = "<your-client-id>"
client_secret = "<your-client-secret>"
tenant_id = "<your-tenant-id>"
}
Create terraform files in your repo and run as terraform from there.
Content type
Image
Digest
sha256:52a4f76b9…
Size
801.9 MB
Last updated
over 1 year ago
docker pull 254in61/cloud-infra-dev-env