Skip to content
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

Options to disable the bastoin SG + optional aws profile config for aws provider #27

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
fmt:
@terraform fmt -recursive .

init:
@terraform init

Expand Down
5 changes: 2 additions & 3 deletions bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,18 @@ resource "aws_key_pair" "bastion_host" {
}

resource "aws_security_group" "bastion_host" {
count = var.private ? 1 : 0
count = var.private && !var.use_sshuttle ? 1 : 0

description = "Security group for Bastion access"
name = "${var.cluster_name}-bastion"
vpc_id = module.network.vpc_id

# TODO: we technically should not need this if we are using sshuttle
ingress {
description = "Bastion SSH Ingress"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
cidr_blocks = var.bastion_cidr_blocks
}

egress {
Expand Down
3 changes: 2 additions & 1 deletion provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ provider "rhcs" {
}

provider "aws" {
region = var.region
region = var.region
profile = var.aws_profile
}
22 changes: 20 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "private" {
default = false
}

variable "aws_profile" {
description = "The AWS profile to use for provisioning resources."
type = string
default = "default"
}

variable "bastion_public_ssh_key" {
description = <<EOF
Location to an SSH public key file on the local system which is used to provide connectivity to the bastion host
Expand All @@ -15,8 +21,20 @@ variable "bastion_public_ssh_key" {

variable "bastion_public_ip" {
description = "Should the Bastion have a public ip?"
type = bool
default = false
type = bool
default = false
}

variable "bastion_cidr_blocks" {
description = "CIDR blocks for Bastion SSH Ingress"
type = list(string)
default = ["0.0.0.0/0"]
}

variable "use_sshuttle" {
description = "Set to true to use sshuttle and skip creating security group for SSH access."
type = bool
default = true
}

variable "aws_billing_account_id" {
Expand Down