Day 59 Update
This commit is contained in:
parent
33a4540d8d
commit
378234b80b
31
Days/IaC/Virtualbox/virtualbox.tf
Normal file
31
Days/IaC/Virtualbox/virtualbox.tf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
virtualbox = {
|
||||||
|
source = "terra-farm/virtualbox"
|
||||||
|
version = "0.2.2-alpha.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# There are currently no configuration options for the provider itself.
|
||||||
|
|
||||||
|
resource "virtualbox_vm" "node" {
|
||||||
|
count = 2
|
||||||
|
name = format("node-%02d", count.index + 1)
|
||||||
|
image = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
|
||||||
|
cpus = 2
|
||||||
|
memory = "512 mib"
|
||||||
|
|
||||||
|
network_adapter {
|
||||||
|
type = "hostonly"
|
||||||
|
host_interface = "vboxnet1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output "IPAddr" {
|
||||||
|
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
output "IPAddr_2" {
|
||||||
|
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
|
||||||
|
}
|
BIN
Days/Images/Day59_IAC2.png
Normal file
BIN
Days/Images/Day59_IAC2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 KiB |
BIN
Days/Images/Day59_IAC3.png
Normal file
BIN
Days/Images/Day59_IAC3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 KiB |
BIN
Days/Images/Day59_IAC4.png
Normal file
BIN
Days/Images/Day59_IAC4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 540 KiB |
BIN
Days/Images/Day59_IAC5.png
Normal file
BIN
Days/Images/Day59_IAC5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1018 KiB |
BIN
Days/Images/Day59_IAC6.png
Normal file
BIN
Days/Images/Day59_IAC6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 508 KiB |
@ -6,28 +6,69 @@ Purely demo purpose but the concept is the same we are going to have our desired
|
|||||||
|
|
||||||
### Create virtual machine in VirtualBox
|
### Create virtual machine in VirtualBox
|
||||||
|
|
||||||
The first thing we are going to do is create a new folder called virtualbox, we can then create a virtualbox.tf file and this is going to be where we define our resources.
|
The first thing we are going to do is create a new folder called virtualbox, we can then create a virtualbox.tf file and this is going to be where we define our resources. The code below which can be found in the VirtualBox folder as virtualbox.tf this is going to create 2 VMs in Virtualbox.
|
||||||
|
|
||||||
|
```
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
virtualbox = {
|
||||||
|
source = "terra-farm/virtualbox"
|
||||||
|
version = "0.2.2-alpha.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<code>
|
# There are currently no configuration options for the provider itself.
|
||||||
|
|
||||||
|
resource "virtualbox_vm" "node" {
|
||||||
|
count = 2
|
||||||
|
name = format("node-%02d", count.index + 1)
|
||||||
|
image = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
|
||||||
|
cpus = 2
|
||||||
|
memory = "512 mib"
|
||||||
|
|
||||||
|
network_adapter {
|
||||||
|
type = "hostonly"
|
||||||
|
host_interface = "vboxnet1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output "IPAddr" {
|
||||||
|
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
output "IPAddr_2" {
|
||||||
|
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
Now that we have our code defined we can now perform the `terraform init` on our folder to download the provider for virtualbox.
|
Now that we have our code defined we can now perform the `terraform init` on our folder to download the provider for virtualbox.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
Obviously you will also need to have virtualbox installed on your system as well. We can then next run `terraform plan` to see what our code will create for us. Followed by `terraform apply`
|
Obviously you will also need to have virtualbox installed on your system as well. We can then next run `terraform plan` to see what our code will create for us. Followed by `terraform apply` the below image shows your completed process.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
In Virtualbox you will now see your 2 virtual machines.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Change configuration so that it then becomes a web server
|
### Change configuration
|
||||||
|
|
||||||
|
Lets add another node to our deployment. We can simply change the count line to show our newly desired number of nodes. When we run our `terraform apply` it will look something like below.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Add additional virtual machine to change our desired state
|
Once complete in virtualbox you can see we now have 3 nodes up and running.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
When we are finished we can clear this up using the `terraform destroy` and our machines will be removed.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Variables & Outputs
|
### Variables & Outputs
|
||||||
|
|
||||||
@ -60,19 +101,6 @@ variable "some resource" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Variables and Outputs
|
|
||||||
Additional Language Features
|
|
||||||
Project Organization + Modules
|
|
||||||
Managing Multiple Environments
|
|
||||||
Testing Terraform Code
|
|
||||||
Developer Workflows and Automation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
I have listed a lot of resources down below and I think this topic has been covered so many times out there, If you have additional resources be sure to raise a PR with your resources and I will be happy to review and add them to the list.
|
I have listed a lot of resources down below and I think this topic has been covered so many times out there, If you have additional resources be sure to raise a PR with your resources and I will be happy to review and add them to the list.
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
## Docker Containers, Provisioners & Modules
|
## Docker Containers, Provisioners & Modules
|
||||||
|
|
||||||
|
On [Day 59](day59.md) we provisioned a virtual machine using Terraform to our local FREE virtualbox environment. In this section we are going to be deploy a Docker container with some configuration to our local Docker environment.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Docker demo
|
Docker demo
|
||||||
|
|
||||||
`terraform init`
|
`terraform init`
|
||||||
|
@ -1,8 +1,38 @@
|
|||||||
##
|
## Testing, Tools & Alternatives
|
||||||
|
|
||||||
|
### Code Rot
|
||||||
|
|
||||||
|
- Out of band changes
|
||||||
|
- Unpinned versions
|
||||||
|
- Deprecated dependancies
|
||||||
|
- Unapplied changes
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Built in
|
||||||
|
|
||||||
|
- terraform fmt
|
||||||
|
- terraform validate
|
||||||
|
- terraform plan
|
||||||
|
- custom validation rules
|
||||||
|
|
||||||
|
External tools
|
||||||
|
- tflint
|
||||||
|
- Scanning tools - checkov, tfsec, terrascan, terraform-compliance, snyk
|
||||||
|
- Managed Cloud offering - terraform sentinal
|
||||||
|
|
||||||
|
Automated testing - Terratest / Shell Scripts
|
||||||
|
|
||||||
|
Terraform Cloud
|
||||||
|
|
||||||
Terragrunt
|
Terragrunt
|
||||||
|
|
||||||
Terraform Cloud
|
runatlantis.io
|
||||||
|
|
||||||
|
### Alternatives
|
||||||
|
|
||||||
|
Pulumi
|
||||||
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
I have listed a lot of resources down below and I think this topic has been covered so many times out there, If you have additional resources be sure to raise a PR with your resources and I will be happy to review and add them to the list.
|
I have listed a lot of resources down below and I think this topic has been covered so many times out there, If you have additional resources be sure to raise a PR with your resources and I will be happy to review and add them to the list.
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
## GitHub Actions Overview
|
||||||
|
|
||||||
|
Ideas and it might be an overview and then additional day on demo ideas.
|
||||||
|
|
||||||
|
https://github.blog/2022-02-02-build-ci-cd-pipeline-github-actions-four-steps/
|
||||||
|
|
||||||
|
GitHub Actions - Send tweet when a git push is performed - https://www.daveabrock.com/2020/04/19/posting-to-twitter-from-gh-actions/
|
||||||
|
|
||||||
|
GitHub Actions - Publish posts to dev.to - https://github.com/marketplace/actions/publish-to-dev-to
|
@ -98,12 +98,12 @@ This will not cover all things DevOps but it will cover the areas that I feel wi
|
|||||||
- [✔️] 🤖 59 > [Create a VM with Terraform & Variables](Days/day59.md)
|
- [✔️] 🤖 59 > [Create a VM with Terraform & Variables](Days/day59.md)
|
||||||
- [✔️] 🤖 60 > [Docker Containers, Provisioners & Modules](Days/day60.md)
|
- [✔️] 🤖 60 > [Docker Containers, Provisioners & Modules](Days/day60.md)
|
||||||
- [✔️] 🤖 61 > [Kubernetes & Multiple Environments](Days/day61.md)
|
- [✔️] 🤖 61 > [Kubernetes & Multiple Environments](Days/day61.md)
|
||||||
- [🚧] 🤖 62 > [](Days/day62.md)
|
- [✔️] 🤖 62 > [Testing, Tools & Alternatives](Days/day62.md)
|
||||||
|
|
||||||
### Automate Configuration Management
|
### Automate Configuration Management
|
||||||
|
|
||||||
- [] 📜 63 > [The Big Picture: Configuration Management](Days/day63.md)
|
- [🚧] 📜 63 > [The Big Picture: Configuration Management](Days/day63.md)
|
||||||
- [] 📜 64 > [](Days/day64.md)
|
- [] 📜 64 > [Ansible: Getting Started](Days/day64.md)
|
||||||
- [] 📜 65 > [](Days/day65.md)
|
- [] 📜 65 > [](Days/day65.md)
|
||||||
- [] 📜 66 > [](Days/day66.md)
|
- [] 📜 66 > [](Days/day66.md)
|
||||||
- [] 📜 67 > [](Days/day67.md)
|
- [] 📜 67 > [](Days/day67.md)
|
||||||
@ -113,7 +113,7 @@ This will not cover all things DevOps but it will cover the areas that I feel wi
|
|||||||
### Create CI/CD Pipelines
|
### Create CI/CD Pipelines
|
||||||
|
|
||||||
- [] 🔄 70 > [The Big Picture: CI/CD Pipelines](Days/day70.md)
|
- [] 🔄 70 > [The Big Picture: CI/CD Pipelines](Days/day70.md)
|
||||||
- [] 🔄 71 > [](Days/day71.md)
|
- [] 🔄 71 > [GitHub Actions Overview](Days/day71.md)
|
||||||
- [] 🔄 72 > [](Days/day72.md)
|
- [] 🔄 72 > [](Days/day72.md)
|
||||||
- [] 🔄 73 > [](Days/day73.md)
|
- [] 🔄 73 > [](Days/day73.md)
|
||||||
- [] 🔄 74 > [](Days/day74.md)
|
- [] 🔄 74 > [](Days/day74.md)
|
||||||
|
Loading…
Reference in New Issue
Block a user