Skip to content

Feature/cognito #6

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
find -name \*.tf -exec grep -r provider {} \; -print
3 changes: 2 additions & 1 deletion accounts/mdupont/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
make :
#tofu init
tofu init
tofu plan
tofu apply
1 change: 1 addition & 0 deletions accounts/mdupont/custom_style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.label-customizable {font-weight: 400;}
21 changes: 10 additions & 11 deletions accounts/mdupont/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ data "aws_iam_user" "example_user" {
user_name = var.iam_user
}

data "aws_dynamodb_table" "terraform_dynamo_table" {
name = var.table_name
}
#data "aws_dynamodb_table" "terraform_dynamo_table" {
# name = var.table_name
#}


# Data resource for AWS call identity
data "aws_caller_identity" "current" {}

data "aws_s3_bucket" "terraform_logging" {
bucket = "${var.project_name}-tf-state-log-${var.aws_region}"
}

data "aws_s3_bucket" "terraform_state" {
bucket = "${var.project_name}-tf-state-${var.aws_region}"
}
#data "aws_s3_bucket" "terraform_logging" {
# bucket = "${var.project_name}-tf-state-log-${var.aws_region}"
#}

#data "aws_s3_bucket" "terraform_state" {
# bucket = "${var.project_name}-tf-state-${var.aws_region}"
#}

data "aws_cloudtrail_service_account" "main" {}
#data "aws_cloudtrail_service_account" "main" {}
Binary file added accounts/mdupont/logo.png

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be included?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions accounts/mdupont/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "google_oauth_client_secret" {}
variable "google_oauth_client_id" {}

module cognito {
aws_account =var.aws_account_id
myemail ="jmdupont"
mydomain ="introspector"
mydomain_suffix = "meme"
#../../../17/
aws_region = var.aws_region
env={
region = var.aws_region
profile = var.profile
}
source = "../../environments/swarms-aws-agent-api/dev/us-east-1/components/cognito_user_pool"
#source = "~/2024/12/17/cognito/terraform-aws-cognito-user-pool/examples/complete/"
#source = "git::https://github.com/meta-introspector/terraform-aws-cognito-user-pool.git?ref=feature/meta-meme"
google_oauth_client_secret=var.google_oauth_client_secret
google_oauth_client_id=var.google_oauth_client_id
}
output cognito{
value = module.cognito
sensitive = true
}
15 changes: 9 additions & 6 deletions accounts/mdupont/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ output "iam_user" {
value = var.iam_user
}

output "table_name" {
value = var.table_name
}
#output "table_name" {
# value = var.table_name
#}

output "project_name" {
value = var.project_name
Expand All @@ -19,15 +19,18 @@ output "aws_caller_identity_account_id" {
}

output "aws_s3_bucket_logging_name" {
value = data.aws_s3_bucket.terraform_logging.bucket
# value = data.aws_s3_bucket.terraform_logging.bucket
value = null
}

output "aws_s3_bucket_state_name" {
value = data.aws_s3_bucket.terraform_state.bucket
#value = data.aws_s3_bucket.terraform_state.bucket
value = null
}

output "aws_cloudtrail_service_account_id" {
value = data.aws_cloudtrail_service_account.main.id
#value = data.aws_cloudtrail_service_account.main.id
value = null
}


27 changes: 16 additions & 11 deletions accounts/mdupont/variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
variable "project_name" {
type = string
default = "swarms"
}
variable "project_name" {
type = string
default = "meta-meme"
}

variable "profile" {
type = string
default = "default"
}

variable "aws_region" {
type = string
default = "us-east-1"
}
type = string
default = "us-east-1"
}

variable "aws_account_id" {
type = string
Expand All @@ -18,10 +23,10 @@ variable "aws_region" {
default = "mdupont"
}

variable "table_name" {
type = string
default = "swarms"
}
# variable "table_name" {
# type = string
# default = "meta-meme"
# }

variable "lock_resource" {
type = string
Expand Down
60 changes: 60 additions & 0 deletions accounts/swarms/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

# credentials

set up ~/.aws/credentials
```
[swarms]
aws_access_key_id =${your key}
aws_secret_access_key=${your SECRET}
```

# install opentofu or terraform
# install aws cli
# install aws ssm plugin

# create openai secret token

TODO:
`aws ssm set-parameter --name "swarms_openai_key"`

# tofu init
# tofu plan
# tofu apply
point the dns api.swarms.ai at the dns servers in godaddy

`tofu state show module.swarms_api.module.alb.module.route53.data.aws_route53_zone.primary`

```terraform
# module.swarms_api.module.alb.module.route53.data.aws_route53_zone.primary:
data "aws_route53_zone" "primary" {
arn = "arn:aws:route53:::hostedzone/Z04162952OP7P14Z97UWY"
caller_reference = "937599df-113d-4b02-8c75-4a20f8e6293e"
id = "Z04162952OP7P14Z97UWY"
name = "api.swarms.ai"
name_servers = [
"ns-864.awsdns-44.net",
"ns-1595.awsdns-07.co.uk",
"ns-1331.awsdns-38.org",
"ns-463.awsdns-57.com",
]
primary_name_server = "ns-864.awsdns-44.net"
private_zone = false
resource_record_set_count = 3
tags = {}
zone_id = "Z04162952OP7P14Z97UWY"
}
```
so we need 4 records

1. NS api -> "ns-864.awsdns-44.net"
2. NS api -> "ns-1595.awsdns-07.co.uk"
3. NS api -> "ns-1331.awsdns-38.org"
4. NS api -> "ns-463.awsdns-57.com"

see youtube or
https://youtu.be/3BI6_gq-lSU
https://dev.to/diegop0s/managing-your-godaddy-domain-with-route53-5f2p

# tofu apply

`tofu apply`
49 changes: 49 additions & 0 deletions accounts/swarms/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
locals {
#ami_name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*"
ami_name = "ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-minimal-*"
dns = "api.swarms.ai"
account = "916723593639"
region = "us-east-2"
}

provider aws {
region = "us-east-2"
profile = "swarms"
}
output dns {
value = local.dns
}

output profile {
value = "swarms"
}

output account {
value = "916723593639"
}

output region {
value = "us-east-2"
}

#SLOW
data "aws_ami" "ami" {
most_recent = true
name_regex = "^${local.ami_name}"
}

module "swarms_api" {
source = "../../environments/swarms-aws-agent-api/dev/us-east-1"
domain = local.dns
ami_id = data.aws_ami.ami.id
#"ami-0ad5d6c7069ce56ac"
#ami_id = "ami-0ad5d6c7069ce56ac"

name = "swarms"
tags = {project="swarms"}

}

output api {
value = module.swarms_api
}
Loading
Loading