Skip to content

Commit 680a424

Browse files
committed
Update doc
1 parent c3e55fb commit 680a424

File tree

2 files changed

+112
-2
lines changed
  • examples

2 files changed

+112
-2
lines changed

examples/existing-cluster-with-base-and-infra/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ terraform init
3838
To run this example, you need to provide your EKS cluster ID.
3939
If you don't have a cluster ready, visit [this example](../new-empty-eks-cluster) first to create a new one.
4040

41-
Add `eks_cluster_id=xxx` to your `terraform.tfvars` or use an
41+
Create a `terraform.tfvars` file and add `eks_cluster_id=xxx` to your `terraform.tfvars` or
4242
environment variable `export TF_VAR_eks_cluster_id=xxx`.
4343

4444
3. Amazon Managed Service for Prometheus workspace
@@ -75,7 +75,7 @@ If you don't specify anything a new workspace will be created for you.
7575
## Deploy
7676

7777
```sh
78-
terraform apply -var terraform.tfvars
78+
terraform apply -var-file=terraform.tfvars
7979
```
8080

8181
or if you had setup environment variables
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
provider "aws" {
2+
region = local.region
3+
}
4+
5+
provider "kubernetes" {
6+
host = module.eks_blueprints.eks_cluster_endpoint
7+
cluster_ca_certificate = base64decode(module.eks_blueprints.eks_cluster_certificate_authority_data)
8+
token = data.aws_eks_cluster_auth.this.token
9+
}
10+
11+
provider "helm" {
12+
kubernetes {
13+
host = module.eks_blueprints.eks_cluster_endpoint
14+
cluster_ca_certificate = base64decode(module.eks_blueprints.eks_cluster_certificate_authority_data)
15+
token = data.aws_eks_cluster_auth.this.token
16+
}
17+
}
18+
19+
module "vpc" {
20+
source = "terraform-aws-modules/vpc/aws"
21+
version = "~> 3.0"
22+
23+
name = local.name
24+
cidr = local.vpc_cidr
25+
26+
azs = local.azs
27+
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
28+
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 10)]
29+
30+
enable_nat_gateway = true
31+
single_nat_gateway = true
32+
enable_dns_hostnames = true
33+
34+
# Manage so we can name
35+
manage_default_network_acl = true
36+
default_network_acl_tags = { Name = "${local.name}-default" }
37+
manage_default_route_table = true
38+
default_route_table_tags = { Name = "${local.name}-default" }
39+
manage_default_security_group = true
40+
default_security_group_tags = { Name = "${local.name}-default" }
41+
42+
public_subnet_tags = {
43+
"kubernetes.io/cluster/${local.name}" = "shared"
44+
"kubernetes.io/role/elb" = 1
45+
}
46+
47+
private_subnet_tags = {
48+
"kubernetes.io/cluster/${local.name}" = "shared"
49+
"kubernetes.io/role/internal-elb" = 1
50+
}
51+
52+
tags = local.tags
53+
}
54+
55+
module "eks_blueprints" {
56+
source = "github.com/aws-ia/terraform-aws-eks-blueprints"
57+
58+
cluster_name = local.name
59+
cluster_version = "1.22"
60+
61+
vpc_id = module.vpc.vpc_id
62+
private_subnet_ids = module.vpc.private_subnets
63+
64+
managed_node_groups = {
65+
t3_l = {
66+
node_group_name = "managed-ondemand"
67+
instance_types = ["t3.large"]
68+
min_size = 2
69+
subnet_ids = module.vpc.private_subnets
70+
}
71+
}
72+
73+
tags = local.tags
74+
}
75+
76+
77+
module "observability_accelerator" {
78+
source = "../../"
79+
80+
aws_region = local.region
81+
eks_cluster_id = module.eks_blueprints.eks_cluster_id
82+
83+
enable_alertmanager = true
84+
enable_managed_grafana = false
85+
86+
managed_grafana_workspace_id = var.managed_grafana_workspace_id
87+
managed_grafana_region = var.managed_grafana_region
88+
89+
grafana_api_key = var.grafana_api_key
90+
91+
tags = {
92+
Source = "aws-observability-accelerator"
93+
}
94+
}
95+
96+
module "infra" {
97+
source = "../../modules/workloads/infra"
98+
99+
dashboards_folder_id = module.observability_accelerator.dashboards_folder_id
100+
eks_cluster_id = module.eks_blueprints.eks_cluster_id
101+
enable_alerting_rules = false
102+
103+
managed_prometheus_workspace_id = module.observability_accelerator.managed_prometheus_workspace_id
104+
managed_prometheus_workspace_region = module.observability_accelerator.managed_prometheus_workspace_region
105+
106+
tags = {
107+
Source = "aws-observability-accelerator"
108+
}
109+
}
110+

0 commit comments

Comments
 (0)