-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TER-412 regenerate platform metadata on lint
change the behavior of lint command to always regenerate the platform metadata file (terrarium.yaml) on every lint command execution This implies that the manual changes in platform metadata file are not acceptable now. this also impacts the behavior of terrarium generate command such that it doesn't respect the manual changes in the platform metadata file This also impacts the example platform since it was not actually implementing the dependencies and it was only added to the metadata file to bypass the errors. Therefore this change also has updates the the `example/platform` such that now it implements each dependency in terraform and doesn't have manually adjusted metadata. Although the `example/platform` contains working mock implementation such that it can be used to test the t8 lint & generate command and can also run terraform plan and apply successfully but it'll generate random mock values for output instead of actually provisioning resources on cloud.
- Loading branch information
Kanak Singhal
committed
Dec 21, 2023
1 parent
640b4dd
commit 7e3ed32
Showing
26 changed files
with
1,179 additions
and
439 deletions.
There are no files selected for viewing
This file was deleted.
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,39 @@ | ||
module "job_queue_runner" { | ||
source = "./mock-modules/k8s-service" | ||
|
||
for_each = local.tr_component_job_queue | ||
|
||
name = "queue_watcher_${each.key}" | ||
cluster_id = module.k8s_cluster.cluster_id | ||
} | ||
|
||
module "job_scheduled_runner" { | ||
source = "./mock-modules/k8s-service" | ||
|
||
for_each = local.tr_component_job_scheduled | ||
|
||
name = "scheduler_${each.key}" | ||
cluster_id = module.k8s_cluster.cluster_id | ||
} | ||
|
||
# A job that performs tasks in the queue. | ||
# @title: Queue Job | ||
module "tr_component_job_queue" { | ||
source = "./mock-modules/pubsub-queue" | ||
|
||
for_each = local.tr_component_job_queue | ||
|
||
event_receiver_url = module.job_queue_runner[each.key].host | ||
name = each.key | ||
} | ||
|
||
# A job that is run at scheduled intervals. | ||
# @title: Scheduled Job | ||
module "tr_component_job_scheduled" { | ||
source = "./mock-modules/cloud-scheduler" | ||
|
||
for_each = local.tr_component_job_scheduled | ||
|
||
event_receiver_url = module.job_scheduled_runner[each.key].host | ||
name = each.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
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 |
---|---|---|
@@ -1,26 +1,15 @@ | ||
# An in-memory data structure store used as a cache or message broker. | ||
# @title: Redis Cache | ||
module "tr_component_redis" { | ||
source = "cloudposse/elasticache-redis/aws" | ||
source = "./mock-modules/elasticache-redis" | ||
|
||
for_each = local.tr_component_redis | ||
|
||
availability_zones = local.azs | ||
vpc_id = module.core_vpc.default_vpc_id | ||
vpc_id = module.core_vpc.vpc_id | ||
allowed_security_group_ids = [module.core_vpc.default_security_group_id] | ||
subnets = module.core_vpc.elasticache_subnets | ||
apply_immediately = true | ||
automatic_failover_enabled = false | ||
engine_version = each.value.version | ||
|
||
context = module.this.context | ||
} | ||
|
||
module "this" { | ||
source = "cloudposse/label/null" | ||
# Cloud Posse recommends pinning every module to a specific version | ||
# version = "x.x.x" | ||
namespace = "var.namespace" | ||
stage = "var.stage" | ||
name = "var.name" | ||
} |
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,39 @@ | ||
# A server that hosts and serves static files. | ||
# @title: Static Server | ||
module "tr_component_server_static" { | ||
source = "./mock-modules/bucket-static-site" | ||
|
||
for_each = local.tr_component_server_static | ||
|
||
bucket_name = each.key | ||
} | ||
|
||
module "k8s_cluster" { | ||
source = "./mock-modules/k8s-cluster" | ||
} | ||
|
||
# A server that hosts web applications and handles HTTP requests. | ||
# @title: Web Server | ||
module "tr_component_server_web" { | ||
source = "./mock-modules/k8s-service" | ||
|
||
for_each = local.tr_component_server_web | ||
|
||
cluster_id = module.k8s_cluster.cluster_id | ||
is_public = true | ||
name = each.key | ||
port = each.value.port | ||
} | ||
|
||
# A server that is not exposed to the public internet. | ||
# @title: Private Server | ||
module "tr_component_server_private" { | ||
source = "./mock-modules/k8s-service" | ||
|
||
for_each = local.tr_component_server_private | ||
|
||
cluster_id = module.k8s_cluster.cluster_id | ||
is_public = false | ||
name = each.key | ||
port = each.value.port | ||
} |
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,26 @@ | ||
variable "bucket_name" { | ||
description = "Name of the bucket" | ||
type = string | ||
default = "by_bucket" | ||
} | ||
|
||
variable "index_document" { | ||
description = "Index document for the website" | ||
type = string | ||
default = "index.html" | ||
} | ||
|
||
variable "error_document" { | ||
description = "Error document for the website" | ||
type = string | ||
default = "error.html" | ||
} | ||
|
||
resource "random_pet" "random" { | ||
length = 2 | ||
} | ||
|
||
output "website_endpoint" { | ||
description = "The website endpoint URL" | ||
value = "http://${random_pet.random.id}.mocksite.com" | ||
} |
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,20 @@ | ||
variable "name" { | ||
type = string | ||
description = "Name of the scheduler" | ||
default = "default" | ||
} | ||
|
||
variable "event_receiver_url" { | ||
type = string | ||
description = "URL to push the events to" | ||
default = "" | ||
} | ||
|
||
resource "random_id" "random" { | ||
byte_length = 8 | ||
} | ||
|
||
output "scheduler_id" { | ||
description = "Id of the scheduler" | ||
value = random_id.random.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,72 @@ | ||
# --- Input | ||
|
||
variable "availability_zones" { | ||
type = list(string) | ||
description = "A list of availability zones in which to place the cluster" | ||
default = ["us-west-1a", "us-west-1b"] | ||
} | ||
|
||
variable "vpc_id" { | ||
type = string | ||
description = "The VPC ID where the cluster is created" | ||
default = "vpc-12345678" | ||
} | ||
|
||
variable "allowed_security_group_ids" { | ||
type = list(string) | ||
description = "A list of Security Group IDs that are allowed to access the cluster" | ||
default = ["sg-12345678"] | ||
} | ||
|
||
variable "subnets" { | ||
type = list(string) | ||
description = "A list of subnet IDs for the cluster" | ||
default = ["subnet-12345678", "subnet-23456789"] | ||
} | ||
|
||
variable "apply_immediately" { | ||
type = bool | ||
description = "Specifies whether any modifications are applied immediately, or during the next maintenance window" | ||
default = true | ||
} | ||
|
||
variable "automatic_failover_enabled" { | ||
type = bool | ||
description = "Specifies whether a read-only replica will be automatically promoted to primary if the existing primary fails" | ||
default = false | ||
} | ||
|
||
variable "engine_version" { | ||
type = string | ||
description = "The version number of the cache engine to use" | ||
default = "6.x" | ||
} | ||
|
||
# --- Config | ||
|
||
resource "random_pet" "redis_instance" { | ||
length = 2 | ||
} | ||
|
||
resource "random_password" "redis_password" { | ||
length = 16 | ||
special = true | ||
} | ||
|
||
# --- Output | ||
|
||
output "host" { | ||
description = "The DNS name of the cache instance" | ||
value = "${random_pet.redis_instance.id}.mock-elasticache.com" | ||
} | ||
|
||
output "port" { | ||
description = "The port number on which each of the cache nodes will accept connections" | ||
value = "6379" # Default Redis port | ||
} | ||
|
||
output "password" { | ||
description = "The password used to access a password-protected Redis server" | ||
value = random_password.redis_password.result | ||
sensitive = true | ||
} |
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,14 @@ | ||
variable "name" { | ||
type = string | ||
description = "Name cluster name" | ||
default = "" | ||
} | ||
|
||
resource "random_id" "random" { | ||
byte_length = 8 | ||
} | ||
|
||
output "cluster_id" { | ||
description = "cluster id" | ||
value = random_id.random.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,32 @@ | ||
variable "name" { | ||
type = string | ||
description = "Name of the service" | ||
default = "" | ||
} | ||
|
||
variable "port" { | ||
type = number | ||
description = "Port to bind the service at" | ||
default = 80 | ||
} | ||
|
||
variable "cluster_id" { | ||
type = string | ||
description = "ID of the cluster" | ||
default = "" | ||
} | ||
|
||
variable "is_public" { | ||
type = bool | ||
description = "Should this service be exposed to the public network" | ||
default = false | ||
} | ||
|
||
resource "random_pet" "random" { | ||
length = 2 | ||
} | ||
|
||
output "host" { | ||
description = "The service host" | ||
value = "${random_pet.random.id}.mocksite.com" | ||
} |
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,25 @@ | ||
variable "name" { | ||
type = string | ||
description = "Name of the queue" | ||
default = "default" | ||
} | ||
|
||
variable "event_receiver_url" { | ||
type = string | ||
description = "URL for push based model where the events are sent to the given url" | ||
default = "" | ||
} | ||
|
||
resource "random_id" "random" { | ||
byte_length = 8 | ||
} | ||
|
||
output "queue_id" { | ||
description = "Id of the queue" | ||
value = random_id.random.id | ||
} | ||
|
||
output "queue_url" { | ||
description = "URL of the queue to send events at and query for messages using sdk" | ||
value = "http://${random_id.random.id}.mockqueue.com" | ||
} |
Oops, something went wrong.
7e3ed32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.