Skip to content

Commit 09c8f66

Browse files
Skip user data if the module is disabled (#43)
* Skip user data if module is disabled * Updated README.md Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>
1 parent 8e92c7b commit 09c8f66

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- markdownlint-disable -->
12
# terraform-aws-ec2-bastion-server [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-ec2-bastion-server.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-ec2-bastion-server) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ec2-bastion-server.svg)](https://github.com/cloudposse/terraform-aws-ec2-bastion-server/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
3+
<!-- markdownlint-restore -->
24

35
[![README Header][readme_header_img]][readme_header_link]
46

@@ -290,8 +292,10 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
290292

291293
### Contributors
292294

295+
<!-- markdownlint-disable -->
293296
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Bobby Larson][karma0_avatar]][karma0_homepage]<br/>[Bobby Larson][karma0_homepage] |
294297
|---|---|---|---|
298+
<!-- markdownlint-restore -->
295299

296300
[osterman_homepage]: https://github.com/osterman
297301
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ data "aws_route53_zone" "domain" {
6565
}
6666

6767
data "template_file" "user_data" {
68+
count = module.this.enabled ? 1 : 0
6869
template = file("${path.module}/user_data.sh")
6970

7071
vars = {
@@ -81,7 +82,7 @@ resource "aws_instance" "default" {
8182
ami = var.ami
8283
instance_type = var.instance_type
8384

84-
user_data = data.template_file.user_data.rendered
85+
user_data = data.template_file.user_data[0].rendered
8586

8687
vpc_security_group_ids = compact(concat(aws_security_group.default.*.id, var.security_groups))
8788

0 commit comments

Comments
 (0)