-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify example config #5
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Lint | ||
on: | ||
pull_request: | ||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: terraform-linters/setup-tflint@v4 | ||
- name: Init TFLint | ||
run: tflint --init | ||
env: | ||
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- name: Run TFLint | ||
run: tflint -f compact --recursive --config "$(pwd)/.tflint.hcl" | ||
fmt: | ||
name: fmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: terraform fmt -check -recursive |
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,15 @@ | ||
tflint { | ||
required_version = ">= 0.50" | ||
} | ||
|
||
rule "terraform_typed_variables" { | ||
enabled = false | ||
} | ||
|
||
rule "terraform_required_providers" { | ||
enabled = false | ||
} | ||
|
||
rule "terraform_required_version" { | ||
enabled = false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "load_balancer_address" { | ||
description = "The full address for the load balancer" | ||
value = aws_lb.public.dns_name | ||
} | ||
|
||
output "load_balancer_port" { | ||
description = "The port for the load balancer" | ||
value = local.public_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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.62.0" | ||
} | ||
} | ||
} |
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
File renamed without changes.
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,18 @@ | ||
################################################################################ | ||
# VPC | ||
################################################################################ | ||
|
||
output "vpc_id" { | ||
description = "The ID of the vpc" | ||
value = module.vpc.vpc_id | ||
} | ||
|
||
|
||
############################################# | ||
############### API ############### | ||
############################################# | ||
|
||
output "api_load_balancer_address" { | ||
description = "The full address for the API load balancer" | ||
value = module.xmtpd_api.load_balancer_address | ||
} |
File renamed without changes.
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,55 @@ | ||
variable "mls_validation_service_docker_image" { | ||
description = "Docker image for mls validation service" | ||
default = "ghcr.io/xmtp/mls-validation-service:main" | ||
} | ||
|
||
variable "verifier_chain_rpc_urls" { | ||
description = "RPC URLs for the smart contract verifier" | ||
sensitive = true | ||
type = object({ | ||
chain_rpc_1 = string | ||
chain_rpc_8453 = string | ||
chain_rpc_42161 = string | ||
chain_rpc_10 = string | ||
chain_rpc_137 = string | ||
chain_rpc_324 = string | ||
chain_rpc_59144 = string | ||
}) | ||
} | ||
|
||
variable "xmtpd_docker_image" { | ||
description = "Docker image for xmtpd" | ||
default = "ghcr.io/xmtp/xmtpd:main" | ||
} | ||
|
||
variable "chain_id" { | ||
description = "The chain ID of the XMTP chain" | ||
default = "241320161" | ||
} | ||
|
||
variable "nodes_contract_address" { | ||
description = "The address of the nodes contract" | ||
type = string | ||
} | ||
|
||
variable "messages_contract_address" { | ||
description = "The address of the messages contract" | ||
type = string | ||
} | ||
|
||
variable "identity_updates_contract_address" { | ||
description = "The address of the identity updates contract" | ||
type = string | ||
} | ||
|
||
variable "chain_rpc_url" { | ||
description = "The RPC URL to connect to the XMTP chain" | ||
sensitive = true | ||
type = string | ||
} | ||
|
||
variable "signer_private_key" { | ||
description = "The private key of the node's signer" | ||
sensitive = true | ||
type = string | ||
} |
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 @@ | ||
../../aws | ||
File renamed without changes.
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 @@ | ||
|
||
module "mls_validation_service" { | ||
source = "./aws/xmtp-validation-service" # TODO: Replace with git URL once merged to main | ||
depends_on = [module.vpc, aws_service_discovery_private_dns_namespace.xmtp] | ||
|
||
env = terraform.workspace | ||
cluster_id = aws_ecs_cluster.this.id | ||
vpc_id = module.vpc.vpc_id | ||
private_subnets = module.vpc.private_subnets | ||
allowed_ingress_cidr_blocks = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)] | ||
docker_image = var.mls_validation_service_docker_image | ||
service_discovery_namespace_name = aws_service_discovery_private_dns_namespace.xmtp.name | ||
chain_rpc_urls = var.verifier_chain_rpc_urls | ||
|
||
providers = { | ||
aws = aws | ||
} | ||
} | ||
|
||
module "xmtpd_api" { | ||
source = "./aws/xmtpd-api" # TODO: Replace with git URL once merged to main | ||
|
||
vpc_id = module.vpc.vpc_id | ||
public_subnets = module.vpc.public_subnets | ||
private_subnets = module.vpc.private_subnets | ||
docker_image = var.xmtpd_docker_image | ||
cluster_id = aws_ecs_cluster.this.id | ||
|
||
service_config = { | ||
validation_service_grpc_address = module.mls_validation_service.grpc_service_address | ||
chain_id = var.chain_id | ||
nodes_contract_address = var.nodes_contract_address | ||
messages_contract_address = var.messages_contract_address | ||
identity_updates_contract_address = var.identity_updates_contract_address | ||
} | ||
service_secrets = { | ||
signer_private_key = var.signer_private_key | ||
chain_rpc_url = var.chain_rpc_url | ||
database_url = "CHANGE_ME" # TODO:nm add database | ||
} | ||
enable_debug_logs = false | ||
|
||
providers = { | ||
aws = aws | ||
} | ||
} | ||
|
||
module "xmtpd_worker" { | ||
source = "./aws/xmtpd-worker" # TODO: Replace with git URL once merged to main | ||
|
||
vpc_id = module.vpc.vpc_id | ||
public_subnets = module.vpc.public_subnets | ||
docker_image = var.xmtpd_docker_image | ||
cluster_id = aws_ecs_cluster.this.id | ||
service_config = { | ||
validation_service_grpc_address = module.mls_validation_service.grpc_service_address | ||
chain_id = var.chain_id | ||
nodes_contract_address = var.nodes_contract_address | ||
messages_contract_address = var.messages_contract_address | ||
identity_updates_contract_address = var.identity_updates_contract_address | ||
} | ||
service_secrets = { | ||
signer_private_key = var.signer_private_key | ||
chain_rpc_url = var.chain_rpc_url | ||
database_url = "CHANGE_ME" # TODO:nm add database | ||
} | ||
enable_debug_logs = false | ||
|
||
providers = { | ||
aws = aws | ||
} | ||
} |
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 @@ | ||
locals { | ||
vpc_cidr = "10.1.0.0/16" | ||
vpc_name = "x-${basename(path.cwd)}" | ||
azs = slice(data.aws_availability_zones.available.names, 0, 3) | ||
} | ||
|
||
module "vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
version = "~> 5.12.1" | ||
|
||
name = local.vpc_name | ||
cidr = local.vpc_cidr | ||
|
||
azs = local.azs | ||
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)] | ||
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 48)] | ||
|
||
enable_nat_gateway = true | ||
single_nat_gateway = true | ||
} |
2 changes: 1 addition & 1 deletion
2
...lidation-service-aws/service_discovery.tf → ...xamples/aws-complete/service-discovery.tf
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,5 +1,5 @@ | ||
resource "aws_service_discovery_private_dns_namespace" "xmtp" { | ||
name = "xmtp.private" | ||
description = "The AWS service discovery namespace" | ||
vpc = module.network.vpc_id | ||
vpc = module.vpc.vpc_id | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
terraform/examples/validation-service-aws/network/_outputs.tf
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In the base PR I actually switched to using GitHub paths with a branch, I actually forgot to point it back to main before landing:
github.com/xmtp/xmtpd-infrastructure//terraform/aws/xmtp-validation-service?ref=rich-tf-validation-svc
I wonder if that would be easier to work off of
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.
That's the right place to leave the repo. It gets a little weird when you're trying to run
terraform validate
and you have any changes in the dependent modules.You could push and then point at your current branch, but then you have to point back to main at some point...at which point the linter will fail. Almost need to break the PR into two pieces, one to update the module and one to update the dependency.
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.
I'll point it to
main
in the next PR, whenmain
has stuff in the right place