Skip to content

Commit e36ee9b

Browse files
committed
Fleshed out README.md, removed backend.tf, removed commented parts of main.tf, and added comment for netbox.sh
1 parent a3d785b commit e36ee9b

File tree

4 files changed

+32
-41
lines changed

4 files changed

+32
-41
lines changed

README.md

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
# netbox-aws
2-
This repository is intended to allow for installing the popular netbox DCIM/IPAM on an AWS EC2 instance
2+
## This repository is intended to facilitate installation of the popular NetBox DCIM/IPAM on an AWS EC2 instance using Terraform.
33

4-
You should be able to instantiate netbox with this repo. Nice!
4+
5+
This repo is pinned to Ubuntu 18.04-amd64-server-20201211.1 and verified to work with Terraform 0.14.3. The [netbox-docker](https://github.com/netbox-community/netbox-docker) image is pinned to [1.0.2](https://github.com/netbox-community/netbox-docker/releases/tag/1.0.2) which was the latest release as of this writing.
6+
7+
To summarize, this instantiates the Ubuntu EC2 instance, installs all the Docker dependencies (which all are pinned), pulls the [netbox-docker](https://github.com/netbox-community/netbox-docker) release via git, creates a `docker-compose.override.yml` file which exposes the Docker internal port `8080` on the worker container to port `80` to the internet, and then execute `docker-compose` resulting in a functioning NetBox IPAM after several minutes of fetching the depends and setting up the various images called by `docker-compose`.
8+
9+
10+
Variables to define in your Terraform workspace are:
11+
12+
```hcl
13+
variable "access_key" {}
14+
variable "secret_key" {}
15+
variable "management_cidr_block" {}
16+
variable "key_name" {
17+
default = "terraform"
18+
}
19+
20+
variable "aws_region" {
21+
default = "us-west-2"
22+
}
23+
```
24+
The `management_cidr_block` is just an IP address range to allow SSH connections from either your premise location, bastion host, VPC subnet, etc. Obviously you would want to be utilizing SSL and have a Security Group and/or NACL and probably have it behind an ALB or CloudFront deployment to provide more limited access, however, that is beyond the scope of this project.
25+
26+
The default login is `admin/admin`, and the default API key is:
27+
28+
`0123456789abcdef0123456789abcdef01234567`
29+
30+
Please, dear God, don't just run this public on the internet without SSL/firewall and change these defaults!
31+
32+
Pull requests are welcome, shoot me a message with any questions, complaints, or thanks!

backend.tf

-10
This file was deleted.

main.tf

+1-28
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,4 @@ resource "aws_instance" "netbox_dev" {
3535
tags = {
3636
Name = "netbox-dev"
3737
}
38-
}
39-
40-
#resource "null_resource" "netbox_config" {
41-
# triggers = {
42-
# public_ip = aws_instance.netbox_dev.public_ip
43-
# }
44-
# depends_on = [aws_instance.netbox_dev]
45-
# connection {
46-
# type = "ssh"
47-
# private_key = var.terraform_ssh_key
48-
# host = aws_instance.netbox_dev.public_ip
49-
# user = "ubuntu"
50-
# timeout = "4m"
51-
# }
52-
# provisioner "file" {
53-
# source = "netbox.sh"
54-
# destination = "/tmp/netbox.sh"
55-
#
56-
# }
57-
# provisioner "remote-exec" {
58-
# inline = [
59-
# "chmod +x /tmp/netbox.sh",
60-
# "/tmp/netbox.sh",
61-
# ]
62-
#
63-
# }
64-
65-
#}
38+
}

netbox.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
# This shell script is just for reference to ensure it works outside of the cloud-init process and so it can be formatted into the cloudinit.yml
33
sudo apt update
44
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
55
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

0 commit comments

Comments
 (0)