-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds support for base GCP resources in fresh accounts * adds support for EKS also: _BEEFIER INSTANCES_
- Loading branch information
Showing
25 changed files
with
392 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Workspace `EKS` | ||
|
||
> This directory contains [AWS](https://registry.terraform.io/providers/hashicorp/aws) Resources. | ||
## Requirements | ||
|
||
* Terraform CLI `1.0.8` or newer | ||
* an AWS [account](https://aws.amazon.com) | ||
|
||
## Downstream Consumption | ||
|
||
The Kubernetes Cluster can be consumed via the [aws_eks_cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) data source: | ||
|
||
```hcl | ||
# see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster | ||
data "aws_eks_cluster" "cluster" { | ||
name = "multi-cloud-k8s" | ||
} | ||
``` | ||
|
||
The above example uses the default values for the `name` property. This may need to be changed for your situation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
# see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet | ||
data "aws_subnet" "default" { | ||
for_each = toset(var.subnet_az) | ||
|
||
availability_zone = "${var.aws_region}${each.key}" | ||
default_for_az = true | ||
vpc_id = data.aws_vpc.default.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# see https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest | ||
module "eks" { | ||
source = "terraform-aws-modules/eks/aws" | ||
version = "17.20.0" | ||
|
||
cluster_name = var.tfe_workspaces_prefix | ||
cluster_version = "1.20" | ||
manage_aws_auth = false | ||
|
||
subnets = [ | ||
data.aws_subnet.default["a"].id, | ||
data.aws_subnet.default["c"].id, | ||
] | ||
|
||
worker_groups = [{ | ||
name = "worker-group-1" | ||
instance_type = "t2.large" | ||
asg_desired_capacity = 3 | ||
} | ||
] | ||
|
||
workers_group_defaults = { | ||
root_volume_type = "gp2" | ||
} | ||
|
||
write_kubeconfig = false | ||
vpc_id = data.aws_vpc.default.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_id" { | ||
description = "EKS Cluster ID." | ||
value = module.eks.cluster_arn | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_name" { | ||
description = "EKS Cluster Name." | ||
value = var.tfe_workspaces_prefix | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_region" { | ||
description = "EKS Cluster Region." | ||
value = var.aws_region | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "console_url" { | ||
description = "AWS Console URL." | ||
value = "https://${var.aws_region}.console.aws.amazon.com/ecs/home?region=${var.aws_region}#/clusters" | ||
} | ||
|
||
# this variable is used for testing purposes and has no bearing on the demo | ||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "workspace_url" { | ||
value = "https://app.terraform.io/app/a-demo-organization/workspaces/${var.tfe_workspaces_prefix}-eks" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# see https://registry.terraform.io/providers/digitalocean/digitalocean/latest | ||
provider "aws" { | ||
region = var.aws_region | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
# see https://www.terraform.io/docs/language/settings/backends/remote.html | ||
backend "remote" { | ||
hostname = "app.terraform.io" | ||
organization = "a-demo-organization" | ||
|
||
workspaces { | ||
name = "multi-cloud-k8s-eks" | ||
} | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/settings/index.html#specifying-provider-requirements | ||
required_providers { | ||
# see https://registry.terraform.io/providers/hashicorp/aws/3.62.0/docs | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "3.62.0" | ||
} | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/settings/index.html#specifying-a-required-terraform-version | ||
required_version = "1.0.8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
aws_access_key = "..." | ||
aws_secret_key = "..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
variable "tfe_workspaces_prefix" { | ||
type = string | ||
description = "Prefix for TFE Workspaces." | ||
default = "multi-cloud-k8s" | ||
} | ||
|
||
variable "aws_region" { | ||
type = string | ||
description = "This is the AWS region." | ||
default = "us-west-1" # N. California, US | ||
} | ||
|
||
variable "subnet_az" { | ||
type = list(string) | ||
description = "List of strings of Availability Zone suffixes." | ||
|
||
default = [ | ||
"a", | ||
"c", | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.