Skip to content

Commit

Permalink
fix: ami of kubctl server instance not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
kfc-manager committed Apr 3, 2024
1 parent 0aeb897 commit 713d29c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 12 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ resource "aws_vpc_security_group_egress_rule" "internet_access" {
# Kubectl Server #
################################

data "aws_ami" "amazon_linux" {
most_recent = true

owners = ["amazon"]

filter {
name = "image-id"
values = ["ami-03484a09b43a06725"]
}
}

resource "aws_key_pair" "kubectl" {
key_name = "${var.identifier}-kubectl"
public_key = var.public_key
Expand All @@ -147,6 +158,7 @@ resource "aws_key_pair" "kubectl" {
}

resource "aws_instance" "kubectl" {
ami = data.aws_ami.amazon_linux.id
key_name = aws_key_pair.kubectl.id
instance_type = "t2.micro"
associate_public_ip_address = true
Expand Down
14 changes: 7 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "kubectl_subnet" {
description = "The ID of the subnet for the instance which acts as kubectl server."
type = string
validation {
condition = startswith(var.kubectl_subnet, "subnet-")
condition = startswith(var.kubectl_subnet, "subnet-")
error_message = "Kubectl subnet must be a valid subnet ID"
}
}
Expand Down Expand Up @@ -57,20 +57,20 @@ variable "instance_types" {

variable "desired_size" {
description = "Desired amount of nodes in the node group."
type= number
default = 1
type = number
default = 1
}

variable "min_size" {
description = "Minimum amount of nodes in the node group."
type= number
default = 1
type = number
default = 1
}

variable "max_size" {
description = "Maximum amount of nodes in the node group."
type= number
default = 1
type = number
default = 1
}

variable "tags" {
Expand Down

0 comments on commit 713d29c

Please sign in to comment.