Skip to content

Commit

Permalink
Merge pull request #8 from common-fate/josh/cf-3590-rds-database-aws-…
Browse files Browse the repository at this point in the history
…account-gets-update-to-the-region

Pass the AWS account id to the Common Fate API
  • Loading branch information
JoshuaWilkes authored Sep 9, 2024
2 parents 73e1e9a + 055652f commit 008448a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-trainers-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@common-fate/terraform-commonfate-proxy-resource-rds": patch
---

Provide the current aws account id when registering the database resource with the Common Fate API. The account and region must match the Proxy integration.
19 changes: 11 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
commonfate = {
source = "common-fate/commonfate"
version = "~> 2.25"
version = "~> 2.25.1"
}
aws = {
source = "hashicorp/aws"
Expand All @@ -11,11 +11,13 @@ terraform {
}
}
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
locals {
password_secrets_manager_arns = flatten([
for user in var.users : user.password_secrets_manager_arn
])
aws_region = data.aws_region.current.name
aws_region = data.aws_region.current.name
aws_account_id = data.aws_caller_identity.current.account_id
}


Expand All @@ -42,12 +44,13 @@ resource "aws_security_group_rule" "postgres_access_from_proxy" {
resource "commonfate_proxy_rds_database" "database" {
proxy_id = var.proxy_id

name = var.name == "" ? var.database : var.name
instance_id = var.rds_instance_identifier
endpoint = data.aws_db_instance.database.endpoint
database = var.database
engine = data.aws_db_instance.database.engine
region = local.aws_region
name = var.name == "" ? var.database : var.name
instance_id = var.rds_instance_identifier
endpoint = data.aws_db_instance.database.endpoint
database = var.database
engine = data.aws_db_instance.database.engine
region = local.aws_region
aws_account_id = local.aws_account_id

users = var.users
}
Expand Down

0 comments on commit 008448a

Please sign in to comment.