forked from PhongHuynh0394/Spotify-Analysis-with-PySpark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
62 lines (53 loc) · 1.43 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
terraform {
required_providers {
mongodbatlas = {
source = "mongodb/mongodbatlas",
version = "1.8.0"
}
}
}
provider "mongodbatlas" {
public_key = var.public_key
private_key = var.private_key
}
resource "mongodbatlas_project" "spotify_project" {
name = "spotify_project"
org_id = var.org_id
is_collect_database_specifics_statistics_enabled = true
is_data_explorer_enabled = true
is_performance_advisor_enabled = true
is_realtime_performance_panel_enabled = true
is_schema_advisor_enabled = true
}
resource "mongodbatlas_cluster" "spotify" {
name = var.cluster_name
project_id = mongodbatlas_project.spotify_project.id
backing_provider_name = "GCP"
provider_name = "TENANT"
provider_instance_size_name = var.cluster_size
provider_region_name = var.region
}
resource "mongodbatlas_database_user" "mongo_user" {
project_id = mongodbatlas_project.spotify_project.id
auth_database_name = "admin"
username = var.username
password = var.password
roles {
role_name = "readWriteAnyDatabase"
database_name = "admin"
}
}
resource "mongodbatlas_project_ip_access_list" "network" {
project_id = mongodbatlas_project.spotify_project.id
cidr_block = "0.0.0.0/0"
comment = "Access from anywhere"
}
output "srv_address" {
value = mongodbatlas_cluster.spotify.connection_strings[0].standard_srv
}
output "user" {
value = var.username
}
output "password" {
value = var.password
}