Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// main.tf
resource "aws_s3_bucket" "kops_state" {
bucket = "${var.environment}-kops-s3"
acl = "private"
versioning {
enabled = true
}
tags = {
Environment = var.environment
Application = "kops"
Description = "S3 Bucket for KOPS state"
}
}
resource "aws_security_group" "k8s_api_http" {
name = "${var.environment}-k8s-api-http"
vpc_id = var.vpc_id
tags = {
environment = var.environment
terraform = true
}
ingress {
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = var.ingress_ips
}
ingress {
protocol = "tcp"
from_port = 443
to_port = 443
cidr_blocks = var.ingress_ips
}
}
// variables.tf
variable "ingress_ips" {
type = list
description = "List of Ingress IPs"
}
variable "environment" {
type = string
default = "krypton"
description = "Name prefix"
}
variable "vpc_id" {
type = string
description = "the shared vpc id"
}
// outputs.tf
output "k8s_api_http_security_group_id" {
value = aws_security_group.k8s_api_http.id
}
output "kops_s3_bucket_name" {
value = aws_s3_bucket.kops_state.bucket
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment