Skip to content

Commit

Permalink
Switch to use data attributes instead of remote state
Browse files Browse the repository at this point in the history
  • Loading branch information
samnang committed Nov 26, 2024
1 parent e9a4f37 commit 2accf7e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
7 changes: 7 additions & 0 deletions infrastructure/core/elasticache.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "aws_security_group" "redis" {
name = var.redis_security_group_name
}

data "aws_elasticache_cluster" "redis" {
cluster_id = var.redis_cluster_id
}
4 changes: 2 additions & 2 deletions infrastructure/core/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ output "rds_cluster" {
}

output "redis_security_group" {
value = data.terraform_remote_state.somleng_core_infrastructure.outputs.redis_security_group
value = data.aws_security_group.redis
}

output "elasticache_redis_endpoint" {
value = data.terraform_remote_state.somleng_core_infrastructure.outputs.elasticache_redis_endpoint
value = data.aws_elasticache_cluster.redis.cache_nodes.0.address
}
10 changes: 0 additions & 10 deletions infrastructure/core/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ data "terraform_remote_state" "core_infrastructure" {
}
}

data "terraform_remote_state" "somleng_core_infrastructure" {
backend = "s3"

config = {
bucket = "infrastructure.somleng.org"
key = "twilreapi_core.tfstate"
region = var.aws_region
}
}

provider "aws" {
region = var.aws_region
}
8 changes: 8 additions & 0 deletions infrastructure/core/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ variable "aws_region" {
default = "ap-southeast-1"
}

variable "redis_security_group_name" {
default = "somleng-redis"
}

variable "redis_cluster_id" {
default = "somleng-redis"
}

locals {
region = data.terraform_remote_state.core_infrastructure.outputs.hydrogen_region
}

0 comments on commit 2accf7e

Please sign in to comment.