Skip to content

Commit

Permalink
declare api keys in each module;
Browse files Browse the repository at this point in the history
  • Loading branch information
ctcac00 committed Jul 28, 2022
1 parent fcf2158 commit 349e7ab
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
24 changes: 15 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
module "cluster" {
source = "./modules/cluster"
region = var.region
cluster_name = var.cluster_name
project_id = var.project_id
source = "./modules/cluster"
region = var.region
cluster_name = var.cluster_name
project_id = var.project_id
atlas_public_key = var.atlas_public_key
atlas_private_key = var.atlas_private_key
}

module "ipAccessList" {
source = "./modules/ipAccesssList"
project_id = var.project_id
cidr_block = var.cidr_block
source = "./modules/ipAccesssList"
project_id = var.project_id
cidr_block = var.cidr_block
atlas_public_key = var.atlas_public_key
atlas_private_key = var.atlas_private_key
}

module "databaseAccessList" {
source = "./modules/databaseAccessList"
project_id = var.project_id
source = "./modules/databaseAccessList"
project_id = var.project_id
atlas_public_key = var.atlas_public_key
atlas_private_key = var.atlas_private_key
}

7 changes: 7 additions & 0 deletions modules/cluster/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "atlas_public_key" {}
variable "atlas_private_key" {}

provider "mongodbatlas" {
public_key = var.atlas_public_key
private_key = var.atlas_private_key
}
7 changes: 7 additions & 0 deletions modules/databaseAccessList/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "atlas_public_key" {}
variable "atlas_private_key" {}

provider "mongodbatlas" {
public_key = var.atlas_public_key
private_key = var.atlas_private_key
}
7 changes: 7 additions & 0 deletions modules/ipAccesssList/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "atlas_public_key" {}
variable "atlas_private_key" {}

provider "mongodbatlas" {
public_key = var.atlas_public_key
private_key = var.atlas_private_key
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
variable "mongodbatlas_public_key" {
variable "atlas_public_key" {
type = string
description = "The public key for the MongoDB Atlas API"
default = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

variable "mongodbatlas_private_key" {
variable "atlas_private_key" {
type = string
description = "The private key for the MongoDB Atlas API"
default = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down

0 comments on commit 349e7ab

Please sign in to comment.