@ariestools/cli 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -11
- package/dist/bin/aries.mjs +94138 -253208
- package/dist/bin/daemons/chain-server.mjs +9862 -12
- package/dist/bin/daemons/dapp-server.mjs +55 -56
- package/dist/bin/daemons/datalake-dev.mjs +10282 -4342
- package/dist/node/datalake.mjs +7 -5
- package/dist/terraform/cluster-aws/cluster.tf +61 -0
- package/dist/terraform/cluster-aws/encryption.tofu.example +37 -0
- package/dist/terraform/cluster-aws/iam.tf +81 -0
- package/dist/terraform/cluster-aws/irsa_ebs_csi.tf +37 -0
- package/dist/terraform/cluster-aws/kubeconfig.tf +49 -0
- package/dist/terraform/cluster-aws/network.tf +108 -0
- package/dist/terraform/cluster-aws/nodegroup.tf +42 -0
- package/dist/terraform/cluster-aws/outputs.tf +80 -0
- package/dist/terraform/cluster-aws/providers.tf +7 -0
- package/dist/terraform/cluster-aws/terraform.tfvars.example +21 -0
- package/dist/terraform/cluster-aws/variables.tf +120 -0
- package/dist/terraform/cluster-aws/versions.tf +18 -0
- package/dist/terraform/cluster-azure/cluster.tf +83 -0
- package/dist/terraform/cluster-azure/encryption.tofu.example +37 -0
- package/dist/terraform/cluster-azure/identity.tf +9 -0
- package/dist/terraform/cluster-azure/kubeconfig.tf +18 -0
- package/dist/terraform/cluster-azure/network.tf +23 -0
- package/dist/terraform/cluster-azure/outputs.tf +69 -0
- package/dist/terraform/cluster-azure/providers.tf +16 -0
- package/dist/terraform/cluster-azure/terraform.tfvars.example +24 -0
- package/dist/terraform/cluster-azure/variables.tf +126 -0
- package/dist/terraform/cluster-azure/versions.tf +14 -0
- package/dist/terraform/cluster-gcp/cluster.tf +71 -0
- package/dist/terraform/cluster-gcp/encryption.tofu.example +35 -0
- package/dist/terraform/cluster-gcp/kubeconfig.tf +47 -0
- package/dist/terraform/cluster-gcp/network.tf +47 -0
- package/dist/terraform/cluster-gcp/outputs.tf +70 -0
- package/dist/terraform/cluster-gcp/providers.tf +14 -0
- package/dist/terraform/cluster-gcp/terraform.tfvars.example +17 -0
- package/dist/terraform/cluster-gcp/variables.tf +86 -0
- package/dist/terraform/cluster-gcp/versions.tf +14 -0
- package/dist/terraform/serverless-aws/alb.tf +127 -0
- package/dist/terraform/serverless-aws/database.tf +70 -0
- package/dist/terraform/serverless-aws/dns.tf +80 -0
- package/dist/terraform/serverless-aws/ecr.tf +63 -0
- package/dist/terraform/serverless-aws/ecs.tf +199 -0
- package/dist/terraform/serverless-aws/encryption.tofu.example +38 -0
- package/dist/terraform/serverless-aws/iam.tf +68 -0
- package/dist/terraform/serverless-aws/network.tf +190 -0
- package/dist/terraform/serverless-aws/outputs.tf +64 -0
- package/dist/terraform/serverless-aws/providers.tf +19 -0
- package/dist/terraform/serverless-aws/storage.tf +51 -0
- package/dist/terraform/serverless-aws/terraform.tfvars.example +19 -0
- package/dist/terraform/serverless-aws/variables.tf +151 -0
- package/dist/terraform/serverless-aws/versions.tf +14 -0
- package/package.json +22 -19
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
output "cluster_name" {
|
|
2
|
+
description = "GKE cluster name."
|
|
3
|
+
value = google_container_cluster.main.name
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
output "cluster_id" {
|
|
7
|
+
description = "Fully-qualified GKE cluster id (`projects/<id>/locations/<region>/clusters/<name>`)."
|
|
8
|
+
value = google_container_cluster.main.id
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
output "cluster_endpoint" {
|
|
12
|
+
description = "GKE control-plane endpoint (HTTPS host)."
|
|
13
|
+
value = google_container_cluster.main.endpoint
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
output "cluster_certificate_authority_data" {
|
|
17
|
+
description = "Base64-encoded cluster CA cert."
|
|
18
|
+
value = google_container_cluster.main.master_auth[0].cluster_ca_certificate
|
|
19
|
+
sensitive = true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
output "workload_identity_pool" {
|
|
23
|
+
description = "Workload Identity pool (`<project>.svc.id.goog`). Bind GCP SAs to KSAs via this."
|
|
24
|
+
value = "${var.project_id}.svc.id.goog"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
output "project_id" {
|
|
28
|
+
description = "GCP project id the cluster lives in."
|
|
29
|
+
value = var.project_id
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
output "project_number" {
|
|
33
|
+
description = "GCP project number (useful in Workload Identity subjects)."
|
|
34
|
+
value = data.google_project.main.number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
output "vpc_id" {
|
|
38
|
+
description = "Dedicated VPC the cluster runs in."
|
|
39
|
+
value = google_compute_network.main.id
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
output "subnet_id" {
|
|
43
|
+
description = "Subnet hosting the cluster."
|
|
44
|
+
value = google_compute_subnetwork.main.id
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
output "kubeconfig_path" {
|
|
48
|
+
description = "Path to the rendered kubeconfig (relative to the working dir)."
|
|
49
|
+
value = local_sensitive_file.kubeconfig.filename
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
output "region" {
|
|
53
|
+
description = "GCP region the cluster lives in."
|
|
54
|
+
value = var.region
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# The Tier-3 service plane reads this to construct its `ServiceTarget(kubernetes)`.
|
|
58
|
+
output "service_target" {
|
|
59
|
+
description = "Tier-2 → Tier-3 hand-off shape. The CLI projects this into ~/.aries/cluster/<name>/cluster.yaml."
|
|
60
|
+
value = {
|
|
61
|
+
kind = "kubernetes"
|
|
62
|
+
cloud = "gcp"
|
|
63
|
+
cluster_name = google_container_cluster.main.name
|
|
64
|
+
region = var.region
|
|
65
|
+
namespace = "aries-datalake"
|
|
66
|
+
ingress_class = "nginx"
|
|
67
|
+
storage_class = "standard-rwo"
|
|
68
|
+
kubeconfig = local_sensitive_file.kubeconfig.filename
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Auth: the provider picks up Application Default Credentials (ADC) from
|
|
2
|
+
# your local environment. Run `gcloud auth application-default login` once
|
|
3
|
+
# before `aries cluster gcp up`. Optionally point the provider at a
|
|
4
|
+
# specific service-account JSON via `GOOGLE_CREDENTIALS=/path/to/sa.json`.
|
|
5
|
+
#
|
|
6
|
+
# Default labels go on every resource that supports them so it's easy to
|
|
7
|
+
# find — and bulk-delete — the entire stack.
|
|
8
|
+
|
|
9
|
+
provider "google" {
|
|
10
|
+
project = var.project_id
|
|
11
|
+
region = var.region
|
|
12
|
+
|
|
13
|
+
default_labels = local.common_labels
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
project_id = "xyo-datalake" # required — your GCP project id
|
|
2
|
+
region = "us-central1"
|
|
3
|
+
environment = "staging"
|
|
4
|
+
project = "aries-datalake"
|
|
5
|
+
|
|
6
|
+
# cluster_name defaults to `${project}-${environment}` when empty.
|
|
7
|
+
# cluster_name = "aries-datalake-staging"
|
|
8
|
+
|
|
9
|
+
# release_channel = "REGULAR" # one of RAPID, REGULAR, STABLE
|
|
10
|
+
|
|
11
|
+
# vpc_cidr = "10.44.0.0/16" # nodes
|
|
12
|
+
# pods_cidr = "10.48.0.0/14" # secondary range for pods
|
|
13
|
+
# services_cidr = "10.52.0.0/20" # secondary range for Services
|
|
14
|
+
|
|
15
|
+
# master_authorized_networks = [
|
|
16
|
+
# { cidr_block = "203.0.113.4/32", display_name = "office" },
|
|
17
|
+
# ]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
variable "project_id" {
|
|
2
|
+
type = string
|
|
3
|
+
description = "GCP project id the cluster lives in. Must already exist; create with `gcloud projects create` if needed."
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
variable "region" {
|
|
7
|
+
type = string
|
|
8
|
+
description = "GCP region for the GKE Autopilot cluster. Autopilot is regional only — multi-zone HA is automatic."
|
|
9
|
+
default = "us-central1"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
variable "environment" {
|
|
13
|
+
type = string
|
|
14
|
+
description = "Environment name (staging, prod, etc.). Goes into resource labels + names."
|
|
15
|
+
default = "staging"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
variable "project" {
|
|
19
|
+
type = string
|
|
20
|
+
description = "Project label (analog of AWS `Project` tag). Distinct from `project_id` — this is a human-readable category."
|
|
21
|
+
default = "aries-datalake"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
variable "cluster_name" {
|
|
25
|
+
type = string
|
|
26
|
+
description = "GKE cluster name. Defaults to `${var.project}-${var.environment}`."
|
|
27
|
+
default = ""
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
variable "release_channel" {
|
|
31
|
+
type = string
|
|
32
|
+
description = "GKE release channel: RAPID / REGULAR / STABLE. REGULAR is the recommended default."
|
|
33
|
+
default = "REGULAR"
|
|
34
|
+
validation {
|
|
35
|
+
condition = contains(["RAPID", "REGULAR", "STABLE"], var.release_channel)
|
|
36
|
+
error_message = "release_channel must be one of RAPID, REGULAR, STABLE."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
variable "vpc_cidr" {
|
|
41
|
+
type = string
|
|
42
|
+
description = "Primary subnet CIDR for the cluster's nodes. Must not overlap any existing VPC you intend to peer with — or compute-aws (10.42.0.0/16) and cluster-aws (10.43.0.0/16) if both stacks live in the same VPN/Interconnect topology."
|
|
43
|
+
default = "10.44.0.0/16"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
variable "pods_cidr" {
|
|
47
|
+
type = string
|
|
48
|
+
description = "Secondary range for pod IPs (Autopilot needs a /14 or so to scale freely)."
|
|
49
|
+
default = "10.48.0.0/14"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
variable "services_cidr" {
|
|
53
|
+
type = string
|
|
54
|
+
description = "Secondary range for Kubernetes Services."
|
|
55
|
+
default = "10.52.0.0/20"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
variable "master_authorized_networks" {
|
|
59
|
+
type = list(object({
|
|
60
|
+
cidr_block = string
|
|
61
|
+
display_name = string
|
|
62
|
+
}))
|
|
63
|
+
description = "CIDRs allowed to reach the public GKE control plane. Defaults to anywhere; tighten to your office IP for prod."
|
|
64
|
+
default = [
|
|
65
|
+
{ cidr_block = "0.0.0.0/0", display_name = "anywhere" },
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
variable "tfstate_passphrase" {
|
|
70
|
+
type = string
|
|
71
|
+
description = "Passphrase for OpenTofu state encryption. See encryption.tofu.example."
|
|
72
|
+
default = ""
|
|
73
|
+
sensitive = true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
locals {
|
|
77
|
+
cluster_name = length(var.cluster_name) > 0 ? var.cluster_name : "${var.project}-${var.environment}"
|
|
78
|
+
name_prefix = "${var.project}-${var.environment}-cluster"
|
|
79
|
+
|
|
80
|
+
common_labels = {
|
|
81
|
+
project = var.project
|
|
82
|
+
environment = var.environment
|
|
83
|
+
component = "cluster"
|
|
84
|
+
managed-by = "opentofu"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
resource "aws_lb" "main" {
|
|
2
|
+
name = "${local.name_prefix}-alb"
|
|
3
|
+
internal = false
|
|
4
|
+
load_balancer_type = "application"
|
|
5
|
+
security_groups = [aws_security_group.alb.id]
|
|
6
|
+
subnets = [for s in aws_subnet.public : s.id]
|
|
7
|
+
|
|
8
|
+
drop_invalid_header_fields = true
|
|
9
|
+
enable_http2 = true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
resource "aws_lb_target_group" "control" {
|
|
13
|
+
name = "${local.name_prefix}-control"
|
|
14
|
+
port = 8787
|
|
15
|
+
protocol = "HTTP"
|
|
16
|
+
target_type = "ip"
|
|
17
|
+
vpc_id = aws_vpc.main.id
|
|
18
|
+
|
|
19
|
+
health_check {
|
|
20
|
+
enabled = true
|
|
21
|
+
path = "/v1/health"
|
|
22
|
+
matcher = "200"
|
|
23
|
+
healthy_threshold = 2
|
|
24
|
+
unhealthy_threshold = 3
|
|
25
|
+
interval = 15
|
|
26
|
+
timeout = 5
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
deregistration_delay = 30
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
resource "aws_lb_target_group" "plane" {
|
|
33
|
+
name = "${local.name_prefix}-plane"
|
|
34
|
+
port = 8788
|
|
35
|
+
protocol = "HTTP"
|
|
36
|
+
target_type = "ip"
|
|
37
|
+
vpc_id = aws_vpc.main.id
|
|
38
|
+
|
|
39
|
+
health_check {
|
|
40
|
+
enabled = true
|
|
41
|
+
path = "/v1/health"
|
|
42
|
+
matcher = "200"
|
|
43
|
+
healthy_threshold = 2
|
|
44
|
+
unhealthy_threshold = 3
|
|
45
|
+
interval = 15
|
|
46
|
+
timeout = 5
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
deregistration_delay = 30
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resource "aws_lb_listener" "http" {
|
|
53
|
+
load_balancer_arn = aws_lb.main.arn
|
|
54
|
+
port = 80
|
|
55
|
+
protocol = "HTTP"
|
|
56
|
+
|
|
57
|
+
dynamic "default_action" {
|
|
58
|
+
for_each = local.has_domain ? [1] : []
|
|
59
|
+
content {
|
|
60
|
+
type = "redirect"
|
|
61
|
+
redirect {
|
|
62
|
+
port = "443"
|
|
63
|
+
protocol = "HTTPS"
|
|
64
|
+
status_code = "HTTP_301"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
dynamic "default_action" {
|
|
70
|
+
for_each = local.has_domain ? [] : [1]
|
|
71
|
+
content {
|
|
72
|
+
type = "forward"
|
|
73
|
+
target_group_arn = aws_lb_target_group.control.arn
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
resource "aws_lb_listener" "https" {
|
|
79
|
+
count = local.has_domain ? 1 : 0
|
|
80
|
+
load_balancer_arn = aws_lb.main.arn
|
|
81
|
+
port = 443
|
|
82
|
+
protocol = "HTTPS"
|
|
83
|
+
ssl_policy = "ELBSecurityPolicy-TLS13-1-2-2021-06"
|
|
84
|
+
certificate_arn = aws_acm_certificate_validation.main[0].certificate_arn
|
|
85
|
+
|
|
86
|
+
default_action {
|
|
87
|
+
type = "forward"
|
|
88
|
+
target_group_arn = aws_lb_target_group.control.arn
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Host-based routing: data.<domain> → data plane TG.
|
|
93
|
+
resource "aws_lb_listener_rule" "data_https" {
|
|
94
|
+
count = local.has_domain ? 1 : 0
|
|
95
|
+
listener_arn = aws_lb_listener.https[0].arn
|
|
96
|
+
priority = 100
|
|
97
|
+
|
|
98
|
+
action {
|
|
99
|
+
type = "forward"
|
|
100
|
+
target_group_arn = aws_lb_target_group.plane.arn
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
condition {
|
|
104
|
+
host_header {
|
|
105
|
+
values = [local.data_fqdn]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# When no domain is configured, expose the plane on /plane/* on the same HTTP
|
|
111
|
+
# listener so smoke testing the ALB DNS name still reaches both planes.
|
|
112
|
+
resource "aws_lb_listener_rule" "data_http_path" {
|
|
113
|
+
count = local.has_domain ? 0 : 1
|
|
114
|
+
listener_arn = aws_lb_listener.http.arn
|
|
115
|
+
priority = 100
|
|
116
|
+
|
|
117
|
+
action {
|
|
118
|
+
type = "forward"
|
|
119
|
+
target_group_arn = aws_lb_target_group.plane.arn
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
condition {
|
|
123
|
+
path_pattern {
|
|
124
|
+
values = ["/plane/*"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
resource "random_password" "db_master" {
|
|
2
|
+
length = 32
|
|
3
|
+
special = false
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
data "aws_rds_engine_version" "postgres" {
|
|
7
|
+
engine = "postgres"
|
|
8
|
+
version = var.db_engine_version
|
|
9
|
+
latest = true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
resource "aws_db_subnet_group" "main" {
|
|
13
|
+
name = "${local.name_prefix}-db"
|
|
14
|
+
subnet_ids = [for s in aws_subnet.private : s.id]
|
|
15
|
+
tags = { Name = "${local.name_prefix}-db-subnets" }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
resource "aws_db_instance" "main" {
|
|
19
|
+
identifier = "${local.name_prefix}-db"
|
|
20
|
+
engine = "postgres"
|
|
21
|
+
engine_version = data.aws_rds_engine_version.postgres.version_actual
|
|
22
|
+
instance_class = var.db_instance_class
|
|
23
|
+
allocated_storage = var.db_allocated_storage
|
|
24
|
+
storage_type = "gp3"
|
|
25
|
+
storage_encrypted = true
|
|
26
|
+
db_name = "aries_datalake"
|
|
27
|
+
username = "aries"
|
|
28
|
+
password = random_password.db_master.result
|
|
29
|
+
db_subnet_group_name = aws_db_subnet_group.main.name
|
|
30
|
+
vpc_security_group_ids = [aws_security_group.database.id]
|
|
31
|
+
publicly_accessible = false
|
|
32
|
+
multi_az = false
|
|
33
|
+
backup_retention_period = 7
|
|
34
|
+
skip_final_snapshot = var.environment != "prod"
|
|
35
|
+
deletion_protection = var.environment == "prod"
|
|
36
|
+
apply_immediately = var.environment != "prod"
|
|
37
|
+
|
|
38
|
+
tags = { Name = "${local.name_prefix}-db" }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
locals {
|
|
42
|
+
database_url = "postgresql://aries:${random_password.db_master.result}@${aws_db_instance.main.address}:5432/aries_datalake?sslmode=require&uselibpqcompat=true"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
resource "aws_secretsmanager_secret" "database_url" {
|
|
46
|
+
name = "${local.name_prefix}/database-url"
|
|
47
|
+
description = "Postgres connection string for the Aries datalake control plane"
|
|
48
|
+
recovery_window_in_days = 7
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
resource "aws_secretsmanager_secret_version" "database_url" {
|
|
52
|
+
secret_id = aws_secretsmanager_secret.database_url.id
|
|
53
|
+
secret_string = local.database_url
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
resource "random_password" "token_signing_secret" {
|
|
57
|
+
length = 64
|
|
58
|
+
special = false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
resource "aws_secretsmanager_secret" "token_signing" {
|
|
62
|
+
name = "${local.name_prefix}/token-signing-secret"
|
|
63
|
+
description = "HMAC signing secret shared between the control and data planes"
|
|
64
|
+
recovery_window_in_days = 7
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
resource "aws_secretsmanager_secret_version" "token_signing" {
|
|
68
|
+
secret_id = aws_secretsmanager_secret.token_signing.id
|
|
69
|
+
secret_string = random_password.token_signing_secret.result
|
|
70
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
data "aws_route53_zone" "existing" {
|
|
2
|
+
count = local.has_domain && !var.create_route53_zone ? 1 : 0
|
|
3
|
+
name = var.domain_name
|
|
4
|
+
private_zone = false
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
resource "aws_route53_zone" "main" {
|
|
8
|
+
count = local.has_domain && var.create_route53_zone ? 1 : 0
|
|
9
|
+
name = var.domain_name
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
locals {
|
|
13
|
+
zone_id = local.has_domain ? (
|
|
14
|
+
var.create_route53_zone ? aws_route53_zone.main[0].zone_id : data.aws_route53_zone.existing[0].zone_id
|
|
15
|
+
) : ""
|
|
16
|
+
|
|
17
|
+
api_fqdn = local.has_domain ? "api.${var.domain_name}" : ""
|
|
18
|
+
data_fqdn = local.has_domain ? "data.${var.domain_name}" : ""
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
resource "aws_acm_certificate" "main" {
|
|
22
|
+
count = local.has_domain ? 1 : 0
|
|
23
|
+
domain_name = local.api_fqdn
|
|
24
|
+
subject_alternative_names = [local.data_fqdn]
|
|
25
|
+
validation_method = "DNS"
|
|
26
|
+
|
|
27
|
+
lifecycle {
|
|
28
|
+
create_before_destroy = true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
resource "aws_route53_record" "cert_validation" {
|
|
33
|
+
for_each = local.has_domain ? {
|
|
34
|
+
for option in aws_acm_certificate.main[0].domain_validation_options :
|
|
35
|
+
option.domain_name => {
|
|
36
|
+
name = option.resource_record_name
|
|
37
|
+
record = option.resource_record_value
|
|
38
|
+
type = option.resource_record_type
|
|
39
|
+
}
|
|
40
|
+
} : {}
|
|
41
|
+
|
|
42
|
+
allow_overwrite = true
|
|
43
|
+
name = each.value.name
|
|
44
|
+
records = [each.value.record]
|
|
45
|
+
ttl = 60
|
|
46
|
+
type = each.value.type
|
|
47
|
+
zone_id = local.zone_id
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
resource "aws_acm_certificate_validation" "main" {
|
|
51
|
+
count = local.has_domain ? 1 : 0
|
|
52
|
+
certificate_arn = aws_acm_certificate.main[0].arn
|
|
53
|
+
validation_record_fqdns = [for r in aws_route53_record.cert_validation : r.fqdn]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
resource "aws_route53_record" "api" {
|
|
57
|
+
count = local.has_domain ? 1 : 0
|
|
58
|
+
zone_id = local.zone_id
|
|
59
|
+
name = local.api_fqdn
|
|
60
|
+
type = "A"
|
|
61
|
+
|
|
62
|
+
alias {
|
|
63
|
+
name = aws_lb.main.dns_name
|
|
64
|
+
zone_id = aws_lb.main.zone_id
|
|
65
|
+
evaluate_target_health = true
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
resource "aws_route53_record" "data" {
|
|
70
|
+
count = local.has_domain ? 1 : 0
|
|
71
|
+
zone_id = local.zone_id
|
|
72
|
+
name = local.data_fqdn
|
|
73
|
+
type = "A"
|
|
74
|
+
|
|
75
|
+
alias {
|
|
76
|
+
name = aws_lb.main.dns_name
|
|
77
|
+
zone_id = aws_lb.main.zone_id
|
|
78
|
+
evaluate_target_health = true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
resource "aws_ecr_repository" "control" {
|
|
2
|
+
count = var.create_ecr_repos ? 1 : 0
|
|
3
|
+
name = "${local.name_prefix}-control"
|
|
4
|
+
image_tag_mutability = "MUTABLE"
|
|
5
|
+
|
|
6
|
+
image_scanning_configuration {
|
|
7
|
+
scan_on_push = true
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
encryption_configuration {
|
|
11
|
+
encryption_type = "AES256"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
resource "aws_ecr_repository" "plane" {
|
|
16
|
+
count = var.create_ecr_repos ? 1 : 0
|
|
17
|
+
name = "${local.name_prefix}-plane"
|
|
18
|
+
image_tag_mutability = "MUTABLE"
|
|
19
|
+
|
|
20
|
+
image_scanning_configuration {
|
|
21
|
+
scan_on_push = true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
encryption_configuration {
|
|
25
|
+
encryption_type = "AES256"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
resource "aws_ecr_lifecycle_policy" "control" {
|
|
30
|
+
count = var.create_ecr_repos ? 1 : 0
|
|
31
|
+
repository = aws_ecr_repository.control[0].name
|
|
32
|
+
|
|
33
|
+
policy = jsonencode({
|
|
34
|
+
rules = [{
|
|
35
|
+
rulePriority = 1
|
|
36
|
+
description = "Keep last 20 images"
|
|
37
|
+
selection = {
|
|
38
|
+
tagStatus = "any"
|
|
39
|
+
countType = "imageCountMoreThan"
|
|
40
|
+
countNumber = 20
|
|
41
|
+
}
|
|
42
|
+
action = { type = "expire" }
|
|
43
|
+
}]
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
resource "aws_ecr_lifecycle_policy" "plane" {
|
|
48
|
+
count = var.create_ecr_repos ? 1 : 0
|
|
49
|
+
repository = aws_ecr_repository.plane[0].name
|
|
50
|
+
|
|
51
|
+
policy = jsonencode({
|
|
52
|
+
rules = [{
|
|
53
|
+
rulePriority = 1
|
|
54
|
+
description = "Keep last 20 images"
|
|
55
|
+
selection = {
|
|
56
|
+
tagStatus = "any"
|
|
57
|
+
countType = "imageCountMoreThan"
|
|
58
|
+
countNumber = 20
|
|
59
|
+
}
|
|
60
|
+
action = { type = "expire" }
|
|
61
|
+
}]
|
|
62
|
+
})
|
|
63
|
+
}
|