Skip to content

Commit

Permalink
testing prs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael DAmato authored and Michael DAmato committed Dec 14, 2022
1 parent 4450955 commit d99c99a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Crash log files
crash.log

examples/test
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@ module "servers" {
instance_type = var.instance_type
block_device_mappings = var.block_device_mappings
extra_block_device_mappings = var.extra_block_device_mappings
vpc_security_group_ids = concat([aws_security_group.server.id, aws_security_group.cluster.id], var.extra_security_group_ids)
vpc_security_group_ids = concat([aws_security_group.server.id, aws_security_group.cluster.id, module.cp_lb.security_group], var.extra_security_group_ids)
spot = var.spot
load_balancers = [module.cp_lb.name]
wait_for_capacity_timeout = var.wait_for_capacity_timeout
metadata_options = var.metadata_options
associate_public_ip_address = var.associate_public_ip_address

# Overrideable variables
userdata = data.cloudinit_config.this.rendered
Expand Down
2 changes: 1 addition & 1 deletion modules/common/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ do_download() {
get_installer

case $ID in
centos)
centos | rocky)
yum install -y unzip
install_awscli

Expand Down
7 changes: 6 additions & 1 deletion modules/nodepool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ resource "aws_launch_template" "this" {
image_id = var.ami
instance_type = var.instance_type
user_data = var.userdata
vpc_security_group_ids = concat([aws_security_group.this.id], var.vpc_security_group_ids)

metadata_options {
http_endpoint = var.metadata_options["http_endpoint"]
Expand All @@ -24,6 +23,12 @@ resource "aws_launch_template" "this" {
instance_metadata_tags = var.metadata_options["instance_metadata_tags"]
}

network_interfaces {
associate_public_ip_address = var.associate_public_ip_address
delete_on_termination = true
security_groups = var.vpc_security_group_ids
}

block_device_mappings {
device_name = lookup(var.block_device_mappings, "device_name", "/dev/sda1")
ebs {
Expand Down
6 changes: 6 additions & 0 deletions modules/nodepool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ variable "spot" {
type = bool
}

variable "associate_public_ip_address" {
default = false
type = bool
}

variable "min_elb_capacity" {
type = number
default = null
Expand All @@ -97,3 +102,4 @@ variable "metadata_options" {
type = map
description = "Instance Metadata Options"
}

4 changes: 2 additions & 2 deletions modules/statestore/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "ssec" {
}
}

resource "aws_s3_bucket_object" "token" {
resource "aws_s3_object" "token" {
bucket = aws_s3_bucket.bucket.id
key = "token"
content_type = "text/plain"
Expand All @@ -33,7 +33,7 @@ data "aws_iam_policy_document" "getter" {
effect = "Allow"
actions = ["s3:GetObject"]
resources = [
"${aws_s3_bucket.bucket.arn}/${aws_s3_bucket_object.token.id}",
"${aws_s3_bucket.bucket.arn}/${aws_s3_object.token.id}",
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/statestore/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
output "bucket" {
value = aws_s3_bucket_object.token.bucket
value = aws_s3_object.token.bucket
}

output "token_object" {
value = aws_s3_bucket_object.token.id
value = aws_s3_object.token.id
}

output "kubeconfig_put_policy" {
Expand All @@ -12,8 +12,8 @@ output "kubeconfig_put_policy" {

output "token" {
value = {
bucket = aws_s3_bucket_object.token.bucket
object = aws_s3_bucket_object.token.id
bucket = aws_s3_object.token.bucket
object = aws_s3_object.token.id
policy_document = data.aws_iam_policy_document.getter.json
bucket_arn = aws_s3_bucket.bucket.arn
}
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,8 @@ variable "wait_for_capacity_timeout" {
type = string
default = "10m"
}

variable "associate_public_ip_address" {
default = false
type = bool
}

0 comments on commit d99c99a

Please sign in to comment.