-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from stavxyz/mongo-example
Mongo example
- Loading branch information
Showing
7 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Policyfile.lock.json | ||
|
||
.ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name 'mongodb' | ||
default_source :supermarket | ||
cookbook 'sc-mongodb', '~> 4.1.0', :supermarket | ||
run_list 'sc-mongodb::default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## sc-mongodb example | ||
|
||
In this example, we will provision a digitalocean | ||
droplet as a chef managed node by installing and configuring mongodb | ||
|
||
https://supermarket.chef.io/cookbooks/sc-mongodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
resource "tls_private_key" "default" { | ||
algorithm = "RSA" | ||
} | ||
|
||
resource "local_file" "private_key" { | ||
filename = "${path.cwd}/.ssh/${format("%s.pem", tls_private_key.default.public_key_fingerprint_md5)}" | ||
sensitive_content = tls_private_key.default.private_key_pem | ||
file_permission = "0600" | ||
directory_permission = "0700" | ||
} | ||
|
||
|
||
resource "digitalocean_ssh_key" "default" { | ||
name = "default" | ||
public_key = tls_private_key.default.public_key_openssh | ||
} | ||
|
||
resource "digitalocean_droplet" "mongo" { | ||
image = "ubuntu-18-04-x64" | ||
name = "chef-mongo" | ||
region = "nyc2" | ||
size = "s-1vcpu-1gb" | ||
ssh_keys = [digitalocean_ssh_key.default.fingerprint] | ||
} | ||
|
||
module "provision" { | ||
source = "../.." | ||
connection = { | ||
host = digitalocean_droplet.mongo.ipv4_address | ||
private_key = tls_private_key.default.private_key_pem | ||
} | ||
} | ||
|
||
output "droplet_ip" { | ||
value = digitalocean_droplet.mongo.ipv4_address | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
terraform { | ||
required_version = ">= 0.13" | ||
required_providers { | ||
digitalocean = { | ||
source = "digitalocean/digitalocean" | ||
} | ||
local = { | ||
source = "hashicorp/local" | ||
} | ||
tls = { | ||
source = "hashicorp/tls" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters