Skip to content

Instantly share code, notes, and snippets.

@omry-hay
Created July 16, 2020 20:09
Show Gist options
  • Save omry-hay/0d39ee91d6e2432f5d7d2f0f8e1c124c to your computer and use it in GitHub Desktop.
Save omry-hay/0d39ee91d6e2432f5d7d2f0f8e1c124c to your computer and use it in GitHub Desktop.
resource "kubernetes_deployment" "nginx" {
metadata {
name = "scalable-nginx-example"
labels = {
App = "ScalableNginxExample"
}
namespace = random_string.namespace_name.result
}
spec {
replicas = 1
selector {
match_labels = {
App = "ScalableNginxExample"
}
}
template {
metadata {
labels = {
App = "ScalableNginxExample"
}
}
spec {
container {
image = "nginx:1.7.8"
name = "example"
port {
container_port = 80
}
resources {
limits {
cpu = "0.5"
memory = "512Mi"
}
requests {
cpu = "250m"
memory = "50Mi"
}
}
}
}
}
}
}
provider "aws" {
version = "~> 2.0"
region = var.region
}
data "aws_eks_cluster" "eks_cluster" {
name = var.cluster_name
}
data "aws_eks_cluster_auth" "eks_cluster_auth" {
name = var.cluster_name
}
provider "kubernetes" {
host = data.aws_eks_cluster.eks_cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks_cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.eks_cluster_auth.token
load_config_file = false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment