Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
TER-263: Update basic example using all parameters and more examples …
Browse files Browse the repository at this point in the history
…(2 features examples)
  • Loading branch information
Jordan Caussat committed Apr 10, 2018
1 parent 54a305c commit b71b695
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 94 deletions.
123 changes: 77 additions & 46 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,87 +11,118 @@ resource "ghost_app" "test" {

region = "eu-west-1"
instance_type = "t2.micro"
vpc_id = "vpc-3f1eb65a"
vpc_id = "vpc-1234567"

log_notifications = [
"[email protected]",
]

build_infos = {
subnet_id = "subnet-a7e849fe"
subnet_id = "subnet-1234567"
ssh_username = "admin"
source_ami = "ami-03ce4474"
source_ami = "ami-1234567"
}

environment_infos = {
instance_profile = "iam.ec2.demo"
key_name = "ghost-demo"
instance_profile = "iam.ec2.demo"
key_name = "ghost-demo"
public_ip_address = true

root_block_device = {
name = "testblockdevice"
size = 20
}

optional_volumes = [{
device_name = "/dev/xvdd"
volume_type = "gp2"
volume_size = 20
}]
optional_volumes = [
{
device_name = "/dev/xvdd"
volume_type = "gp2"
volume_size = 20
iops = 0
},
]

subnet_ids = ["subnet-a7e849fe"]
security_groups = ["sg-6814f60c", "sg-2414f60c"]
subnet_ids = ["subnet-1234567"]
security_groups = ["sg-1234567", "sg-1234567"]

instance_tags = [{
tag_name = "Name"
tag_value = "wordpress"
},
instance_tags = [
{
tag_name = "Type"
tag_value = "front"
tag_name = "Name"
tag_value = "wordpress"
},
]
}

autoscale = {
name = "autoscale"
min = 1
max = 3
name = "autoscale"
min = 1
max = 3
enable_metrics = true
}

modules = [{
name = "wordpress"
pre_deploy = ""
path = "/var/www"
scope = "code"
git_repo = "https://github.com/KnpLabs/KnpIpsum.git"
},
modules = [
{
name = "wordpress2"
pre_deploy = "ZXhpdCAx"
post_deploy = "ZXhpdCAx"
path = "/var/www"
scope = "code"
git_repo = "https://github.com/KnpLabs/KnpIpsum.git"
name = "wordpress"
path = "/var/www"
scope = "code"
git_repo = "https://github.com/KnpLabs/KnpIpsum.git"
uid = 0
gid = 0
build_pack = ""
pre_deploy = ""
post_deploy = ""
after_all_deploy = ""
},
]

features = [{
version = "5.4"
name = "php5"
},
features = [
{
version = "2.2"
name = "apache2"
name = "php5"
version = "5.4"
provisioner = "salt"
},
{
name = "package"
provisioner = "ansible"

parameters = <<-JSON
{
"package_name" : [
"nano",
"cowsay",
"ffmpeg",
"curl"
]
}
JSON
},
]

lifecycle_hooks = {
pre_buildimage = "#!/usr/bin/env bash"
post_buildimage = "#!/usr/bin/env bash"
pre_buildimage = "echo PRE_BUILD >> /var/www/html/wp-config.php"

post_buildimage = <<-SCRIPT
#!/bin/bash
echo "EXAMPLE_CONFIG" >> /var/www/html/wp-config.php
SCRIPT

pre_bootstrap = ""
post_bootstrap = ""
}

environment_variables = [{
key = "myvar"
value = "myvalue"
}]
environment_variables = [
{
key = "myvar"
value = "myvalue"
},
]

safe_deployment = {
load_balancer_type = "elb"
wait_before_deploy = 10
wait_after_deploy = 10
api_port = 5001
app_tag_value = ""
ha_backend = ""
}
}
67 changes: 19 additions & 48 deletions examples/shared_modules_features/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,22 @@ resource "ghost_app" "test" {

region = "eu-west-1"
instance_type = "t2.micro"
vpc_id = "vpc-3f1eb65a"

log_notifications = [
"[email protected]",
]
vpc_id = "vpc-1234567"

build_infos = {
subnet_id = "subnet-a7e849fe"
subnet_id = "subnet-1234567"
ssh_username = "admin"
source_ami = "ami-03ce4474"
source_ami = "ami-1234567"
}

environment_infos = {
instance_profile = "iam.ec2.demo"
key_name = "ghost-demo"

root_block_device = {
name = "testblockdevice"
size = 20
}

optional_volumes = [{
device_name = "/dev/xvdd"
volume_type = "gp2"
volume_size = 20
}]

subnet_ids = ["subnet-a7e849fe"]
security_groups = ["sg-6814f60c", "sg-2414f60c"]

instance_tags = [{
tag_name = "Name"
tag_value = "wordpress"
},
{
tag_name = "Type"
tag_value = "front"
},
]
subnet_ids = ["subnet-1234567"]
security_groups = ["sg-1234567"]
}

autoscale = {
name = "autoscale"
min = 1
max = 3
}

lifecycle_hooks = {
pre_buildimage = "#!/usr/bin/env bash"
post_buildimage = "#!/usr/bin/env bash"
}

environment_variables = [{
key = "myvar"
value = "myvalue"
}]

// Several modules and/or lists of modules can be merged together.
modules = "${concat(list(local.custom_module_1, local.custom_module_2), local.basic_modules)}"

Expand Down Expand Up @@ -119,7 +78,19 @@ locals {

locals {
custom_feature = {
name = "feature_1"
version = "1"
name = "feature_1"
version = "1"
provisioner = "ansible"

parameters = <<-JSON
{
"package_name" : [
"nano",
"cowsay",
"ffmpeg",
"curl"
]
}
JSON
}
}

0 comments on commit b71b695

Please sign in to comment.