Git Product home page Git Product logo

learn-terraform-v2's Introduction

Learn terraform docker provider v2.0

An improved version of the project learn-terraform. In project learn-terraform, there are still several manual steps, which I hope to reduce with terraform in v2.0:

  1. [done] Generate ssh key pair for mylinux
  2. [done] Use multipas blueprint docker to create mylinux2 so that I don't need to
    • install docker engine
    • configure non-root user to run docker
  3. Add mylinux's public ssh key to mylinux2

My environment

In this project, I'll create 2 Ubuntu virtual machines on my Windows 11 Pro laptop to practice terraform.

  • mylinux
    • Ubuntu 22.04
    • runs terraform
  • mylinux2
    • Ubuntu 22.04
    • docker 20.10.24
    • target machine, to be provisioned by terraform

Create virtual machines

Install multipass

Follow the instruction on https://multipass.run/ to install multipass on Windows 11 Pro. Or just do below in Windows Terminal.

> winget Canonical.Multipass

Create Ubuntu virtual machines

Issue below commands in Windows Terminal

> multipass launch -n mylinux
> multipass launch docker -n mylinux2

Let's run the code to genreate ssh key pair on mylinux

On mylinux

$ git clone https://github.com/zhongzhu/learn-terraform.git
$ cd learn-terraform/infra
$ terraform init
$ terraform plan
$ terraform apply

Add mylinux's ssh key to mylinux2

Append the content of mylinux's ~/.ssh/id_ed25519.pub to mylinux2's ~/.ssh/authorized_keys.

Let's run the code to spin up our website

On mylinux

$ cd learn-terraform
$ terraform init
$ terraform plan
$ terraform apply

Below is the execution output.

learn-terraform-v2's People

Contributors

zhongzhu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.