Skip to content

Remove generated user data from module (breaking change) #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Included features:
* Automatically create a Security Group
* Option to switch EIP attachment
* CloudWatch monitoring and automatic reboot if instance hangs
* [Github Authorized Keys](https://github.com/cloudposse/terraform-template-user-data-github-authorized-keys)
* Assume Role capability

## Usage
Expand Down Expand Up @@ -37,9 +36,6 @@ module "instance" {
module "kafka_instance" {
source = "git::https://github.com/cloudposse/terraform-aws-ec2-instance.git?ref=master"
ssh_key_pair = "${var.ssh_key_pair}"
github_api_token = "${var.github_api_token}"
github_organization = "${var.github_organization}"
github_team = "${var.github_team}"
vpc_id = "${var.vpc_id}"
security_groups = ["${var.security_groups}"]
subnet = "${var.subnet}"
Expand All @@ -56,7 +52,6 @@ module "kafka_instance" {
This module depends on these modules:

* [terraform-null-label](https://github.com/cloudposse/terraform-null-label)
* [terraform-template-user-data-github-authorized-keys](https://github.com/cloudposse/terraform-template-user-data-github-authorized-keys)

It is necessary to run `terraform get` to download those modules.

Expand All @@ -81,9 +76,6 @@ resource "aws_ami_from_instance" "example" {
| `instance_enabled` | `true` | Flag for creating an instance. Set to false if it is necessary to skip instance creation | No |
| `create_default_security_group` | `true` | Flag for creation default Security Group with Egress traffic allowed only | No |
| `ssh_key_pair` | `` | SSH key pair to be provisioned on instance | Yes |
| `github_api_token` | `` | GitHub API token | No |
| `github_organization` | `` | GitHub organization name | No |
| `github_team` | `` | GitHub team | No |
| `instance_type` | `t2.micro` | The type of the creating instance (e.g. `t2.micro`) | No |
| `vpc_id` | `` | The ID of the VPC that the creating instance security group belongs to | Yes |
| `security_groups` | `[]` | List of Security Group IDs allowed to connect to creating instance | Yes |
Expand Down
10 changes: 1 addition & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,14 @@ resource "aws_iam_role" "default" {
assume_role_policy = "${data.aws_iam_policy_document.default.json}"
}

# Apply the tf_github_authorized_keys module for this resource
module "github_authorized_keys" {
source = "git::https://github.com/cloudposse/terraform-template-user-data-github-authorized-keys.git?ref=tags/0.1.2"
github_api_token = "${var.github_api_token}"
github_organization = "${var.github_organization}"
github_team = "${var.github_team}"
}

resource "aws_instance" "default" {
count = "${local.instance_count}"
ami = "${local.ami}"
availability_zone = "${local.availability_zone}"
instance_type = "${var.instance_type}"
ebs_optimized = "${var.ebs_optimized}"
disable_api_termination = "${var.disable_api_termination}"
user_data = "${data.template_file.user_data.rendered}"
user_data = "${var.user_data}"
iam_instance_profile = "${aws_iam_instance_profile.default.name}"
associate_public_ip_address = "${var.associate_public_ip_address}"
key_name = "${var.ssh_key_pair}"
Expand Down
8 changes: 0 additions & 8 deletions user_data.tf

This file was deleted.

26 changes: 5 additions & 21 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ variable "ssh_key_pair" {
description = "SSH key pair to be provisioned on instance"
}

variable "github_api_token" {
description = "GitHub API token"
default = ""
}

variable "github_organization" {
description = "GitHub organization name"
default = ""
}

variable "github_team" {
description = "GitHub team"
default = ""
}

variable "associate_public_ip_address" {
description = "Associate a public ip address with the creating instance"
default = "true"
}

variable "user_data" {
description = "The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument"
default = ""
}

variable "instance_type" {
description = "The type of the creating instance"
default = "t2.micro"
Expand Down Expand Up @@ -104,12 +94,6 @@ variable "monitoring" {
default = "true"
}

variable "user_data" {
description = "User data to provide when launching the instance"
type = "list"
default = []
}

variable "private_ip" {
description = "Private IP address to associate with the instance in a VPC"
default = ""
Expand Down