File tree Expand file tree Collapse file tree 6 files changed +81
-3
lines changed
Expand file tree Collapse file tree 6 files changed +81
-3
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ You need the following permissions to run this module.
9191
9292| Name | Description |
9393| ------| -------------|
94+ | <a name =" output_cbr_rule_ids " ></a > [ cbr\_ rule\_ ids] ( #output\_ cbr\_ rule\_ ids ) | CBR rule ids created to restrict Postgresql |
95+ | <a name =" output_crn " ></a > [ crn] ( #output\_ crn ) | Postgresql instance crn |
9496| <a name =" output_guid " ></a > [ guid] ( #output\_ guid ) | Postgresql instance guid |
9597| <a name =" output_id " ></a > [ id] ( #output\_ id ) | Postgresql instance id |
9698| <a name =" output_service_credentials_json " ></a > [ service\_ credentials\_ json] ( #output\_ service\_ credentials\_ json ) | Service credentials json map |
Original file line number Diff line number Diff line change @@ -104,3 +104,36 @@ module "postgresql_db" {
104104 }
105105 ]
106106}
107+
108+ # VPE provisioning should wait for the database provisioning
109+ resource "time_sleep" "wait_120_seconds" {
110+ depends_on = [module . postgresql_db ]
111+ create_duration = " 120s"
112+ }
113+
114+ # #############################################################################
115+ # VPE
116+ # #############################################################################
117+
118+ resource "ibm_is_security_group" "sg1" {
119+ name = " ${ var . prefix } -sg1"
120+ vpc = ibm_is_vpc. example_vpc . id
121+ }
122+
123+ resource "ibm_is_virtual_endpoint_gateway" "pgvpe" {
124+ name = " ${ var . prefix } -vpe-to-pg"
125+ target {
126+ crn = module. postgresql_db . crn
127+ resource_type = " provider_cloud_service"
128+ }
129+ vpc = ibm_is_vpc. example_vpc . id
130+ ips {
131+ subnet = ibm_is_subnet. testacc_subnet . id
132+ name = " ${ var . prefix } -pg-access-reserved-ip"
133+ }
134+ resource_group = module. resource_group . resource_group_id
135+ security_groups = [ibm_is_security_group . sg1 . id ]
136+ depends_on = [
137+ time_sleep . wait_120_seconds
138+ ]
139+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ output "id" {
66 value = module. postgresql_db . id
77}
88
9+ output "guid" {
10+ description = " Postgresql instance guid"
11+ value = module. postgresql_db . guid
12+ }
13+
914output "version" {
1015 description = " Postgresql instance version"
1116 value = module. postgresql_db . version
@@ -22,3 +27,8 @@ output "service_credentials_object" {
2227 value = module. postgresql_db . service_credentials_object
2328 sensitive = true
2429}
30+
31+ output "cbr_rule_ids" {
32+ description = " CBR rule ids created to restrict Postgresql"
33+ value = module. postgresql_db . cbr_rule_ids
34+ }
Original file line number Diff line number Diff line change @@ -6,5 +6,9 @@ terraform {
66 source = " IBM-Cloud/ibm"
77 version = " 1.49.0"
88 }
9+ time = {
10+ source = " hashicorp/time"
11+ version = " >= 0.8.0"
12+ }
913 }
1014}
Original file line number Diff line number Diff line change 248248 }
249249 },
250250 "outputs" : {
251+ "cbr_rule_ids" : {
252+ "name" : " cbr_rule_ids" ,
253+ "description" : " CBR rule ids created to restrict Postgresql" ,
254+ "pos" : {
255+ "filename" : " outputs.tf" ,
256+ "line" : 38
257+ }
258+ },
259+ "crn" : {
260+ "name" : " crn" ,
261+ "description" : " Postgresql instance crn" ,
262+ "value" : " ibm_database.postgresql_db.resource_crn" ,
263+ "pos" : {
264+ "filename" : " outputs.tf" ,
265+ "line" : 15
266+ },
267+ "type" : " TypeString"
268+ },
251269 "guid" : {
252270 "name" : " guid" ,
253271 "description" : " Postgresql instance guid" ,
274292 "sensitive" : true ,
275293 "pos" : {
276294 "filename" : " outputs.tf" ,
277- "line" : 20
295+ "line" : 25
278296 }
279297 },
280298 "service_credentials_object" : {
284302 "sensitive" : true ,
285303 "pos" : {
286304 "filename" : " outputs.tf" ,
287- "line" : 26
305+ "line" : 31
288306 }
289307 },
290308 "version" : {
293311 "value" : " ibm_database.postgresql_db.version" ,
294312 "pos" : {
295313 "filename" : " outputs.tf" ,
296- "line" : 15
314+ "line" : 20
297315 },
298316 "type" : " TypeString"
299317 }
Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ output "guid" {
1212 value = ibm_database. postgresql_db . guid
1313}
1414
15+ output "crn" {
16+ description = " Postgresql instance crn"
17+ value = ibm_database. postgresql_db . resource_crn
18+ }
19+
1520output "version" {
1621 description = " Postgresql instance version"
1722 value = ibm_database. postgresql_db . version
@@ -28,3 +33,9 @@ output "service_credentials_object" {
2833 value = local. service_credentials_object
2934 sensitive = true
3035}
36+
37+
38+ output "cbr_rule_ids" {
39+ description = " CBR rule ids created to restrict Postgresql"
40+ value = module. cbr_rule [* ]. rule_id
41+ }
You can’t perform that action at this time.
0 commit comments