Skip to content

Instantly share code, notes, and snippets.

@pb8226
Last active April 30, 2018 21:09
Show Gist options
  • Save pb8226/9fd4319f807b84bca49a08c3283ee32f to your computer and use it in GitHub Desktop.
Save pb8226/9fd4319f807b84bca49a08c3283ee32f to your computer and use it in GitHub Desktop.
JHipster Blog
<%_ if (databaseType == 'sql') { _%>
compile "org.hibernate:hibernate-core:${hibernate_entitymanager_version}"
compile("com.zaxxer:HikariCP") {
exclude(module: 'tools')
}
<%_ } _%>
resource "aws_autoscaling_group" "<%= dasherizedBaseName %>" {
launch_configuration = "${aws_launch_configuration.<%= dasherizedBaseName %>.id}"
availability_zones = ["${data.aws_availability_zones.all.names}"]
min_size = "${var.min_size}"
max_size = "${var.max_size}"
load_balancers = ["${aws_elb.<%= dasherizedBaseName %>.name}"]
health_check_type = "ELB"
tag {
key = "Name"
value = "terraform-asg-<%= dasherizedBaseName %>"
propagate_at_launch = true
}
}
writing: {
cleanupOldServerFiles: function() {
cleanup.cleanupOldServerFiles(this, this.javaDir, this.testDir);
},
writeGlobalFiles: function () {
this.template('_README.md', 'README.md', this, {});
this.copy('gitignore', '.gitignore');
this.copy('gitattributes', '.gitattributes');
this.copy('editorconfig', '.editorconfig');
this.template('_travis.yml', '.travis.yml', this, {});
this.template('_Jenkinsfile', 'Jenkinsfile', this, {});
},
writeTerraformFiles: function () {
switch (this.terraform) {
case 'yes':
// Create Terraform module files
this.template(TERRAFORM_DIR + 'modules/backend-app/_main.tf', TERRAFORM_DIR + 'modules/backend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/backend-app/_vars.tf', TERRAFORM_DIR + 'modules/backend-app/vars.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/backend-app/_outputs.tf', TERRAFORM_DIR + 'modules/backend-app/outputs.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/frontend-app/_main.tf', TERRAFORM_DIR + 'modules/frontend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/frontend-app/_vars.tf', TERRAFORM_DIR + 'modules/frontend-app/vars.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/frontend-app/_outputs.tf', TERRAFORM_DIR + 'modules/frontend-app/outputs.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/postgres/_main.tf', TERRAFORM_DIR + 'modules/postgres/main.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/postgres/_vars.tf', TERRAFORM_DIR + 'modules/postgres/vars.tf', this, {});
this.template(TERRAFORM_DIR + 'modules/postgres/_outputs.tf', TERRAFORM_DIR + 'modules/postgres/outputs.tf', this, {});
// Create Terraform prod files
this.template(TERRAFORM_DIR + 'prod/services/backend-app/_main.tf', TERRAFORM_DIR + 'prod/services/backend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'prod/services/frontend-app/_main.tf', TERRAFORM_DIR + 'prod/services/frontend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'prod/data-storage/postgresql/_main.tf', TERRAFORM_DIR + 'prod/data-storage/postgresql/main.tf', this, {});
// Create Terraform stage files
this.template(TERRAFORM_DIR + 'stage/services/backend-app/_main.tf', TERRAFORM_DIR + 'stage/services/backend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'stage/services/frontend-app/_main.tf', TERRAFORM_DIR + 'stage/services/frontend-app/main.tf', this, {});
this.template(TERRAFORM_DIR + 'stage/data-storage/postgresql/_main.tf', TERRAFORM_DIR + 'stage/data-storage/postgresql/main.tf', this, {});
break;
case 'no':
default :
}
},
{
type: 'list',
name: 'terraform',
message: function (response) {
return getNumberedQuestion('Would you like to generate Terraform files?', true);
},
choices: [
{
value: 'yes',
name: 'Yes'
},
{
value: 'no',
name: 'No'
}
],
default: 'no'
}
? (12/15) Would you like to generate Terraform files? (Use arrow keys)
Yes
❯ No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment