DBA Hub

📋Steps in this guide1/5

Terraform : Linking Oracle Cloud Interface (OCI) Terraform Modules Together

This article demonstrates how to link Oracle Cloud Interface (OCI) Terraform modules together to deploy infrastructure.

oracle miscconfigurationintermediate
by OracleDba
11 views
1

Introduction

In previous articles we've discussed how to build individual pieces of OCI infrastructure using Terraform. - Terraform : Oracle Cloud Infrastructure (OCI) Provider - Terraform : Oracle Cloud Infrastructure (OCI) Compartment - Terraform : Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN) - Terraform : Oracle Cloud Infrastructure (OCI) Autonomous Database (ADW, ATP, AJD, APX) The rest of this article assumes you have worked through these articles and have created the relevant files. Typically we would expect to create a whole system with a single definition, but that's not quite as simple as combining the above definitions due to dependencies. We may require information about a parent component before we can build the child component. In this article we'll demonstrate this by creating a new compartment, containing a VCN and an autonomous database. Both the VCN and the database need the ID of the compartment before they can be created. In the individual articles we provided this as an input parameter, but we don't know the compartment ID until it's created, so we need to reference the compartment ID in the dependent resources.
2

Setup

We start by creating a new working directory. We copy in the "*.tf" and "*.tfvars" scripts for the provider and the individual components as our starting point. Now we need to amend the scripts to make sure the dependencies are taken care of. The provider and compartment scripts will work without amendments, as there are no dependencies to worry about. The outputs in the "oci_compartment.tf" script include the following definition. The text in bold is important because that will return the ID of the compartment once we build it. We can use this in dependent scripts to populate the setting.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mkdir \git\oraclebase\terraform\oci\oci_full_adb
cd \git\oraclebase\terraform\oci\oci_full_adb

copy \git\oraclebase\terraform\oci\oci_provider\*.tf .
copy \git\oraclebase\terraform\oci\oci_provider\*.tfvars .

copy \git\oraclebase\terraform\oci\oci_compartment\*.tf .
copy \git\oraclebase\terraform\oci\oci_compartment\*.tfvars .

copy \git\oraclebase\terraform\oci\oci_vcn\*.tf .
copy \git\oraclebase\terraform\oci\oci_vcn\*.tfvars .

copy \git\oraclebase\terraform\oci\oci_adb\*.tf .
copy \git\oraclebase\terraform\oci\oci_adb\*.tfvars .

output "compartment_id" {
  value =
oci_identity_compartment.tf_compartment.id
}
3

Amend the VCN Files

The VCN is a child of the compartment, so we need to source the ID of the compartment we are building. Edit the "oci_vcn.tf" file. It's a large file, so well describe the changes that need to be made. Remove the variable definition. Set all references to the by referencing the output variable from the compartment build. There are several references to amend. One for the module, and one for each resource definition. We need to remove the setting from the "oci_vcn_variables.auto.tfvars" file.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
#variable "compartment_id" { type = string }

compartment_id           = oci_identity_compartment.tf_compartment.id

#compartment_id   = "ocid1.compartment.oc1..aaaaaaaa..."
vcn_display_name = "obvcn3"
vcn_dns_label    = "obvcn3"
4

Amend the Autonomous Database Files

The autonomous database is a child of the compartment, so we need to source the ID of the compartment we are building. Edit the "oci_adb.tf" file. The changes are in bold. We've removed the input variable, and set the in the resource by referencing the output variable from the compartment build. We need to remove the setting from the "oci_adb_variables.auto.tfvars" file.

Code/Command (click line numbers to comment):

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
# Variables
#variable "compartment_id" { type = string }
variable "db_name"        { type = string }
variable "admin_password" { type = string }
variable "db_version"     { type = string }
# OLTP, DW, AJD, APEX
variable "db_workload"    { type = string }
# Must be false for AJD and APEX
variable "is_free_tier"   { type = string }
# BRING_YOUR_OWN_LICENSE or LICENSE_INCLUDED
variable "license_model"  { type = string }

variable "cpu_core_count" {
  type    = number
  default = 1
}

variable "data_storage_size_in_tbs" {
  type    = number
  default = 1
}


# Resources
resource "oci_database_autonomous_database" "tf_adb" {
#compartment_id           = var.compartment_id
  compartment_id           = oci_identity_compartment.tf_compartment.id
cpu_core_count           = var.cpu_core_count
  data_storage_size_in_tbs = var.data_storage_size_in_tbs
  db_name                  = var.db_name
  admin_password           = var.admin_password
  db_version               = var.db_version
  db_workload              = var.db_workload
  display_name             = var.db_name
  is_free_tier             = var.is_free_tier
  license_model            = var.license_model
}


# Outputs
output "db_name" {
  value = oci_database_autonomous_database.tf_adb.display_name
}

output "db_state" {
  value = oci_database_autonomous_database.tf_adb.state
}

#compartment_id = "ocid1.compartment.oc1..aaaaaaaa..."
db_name        = "obadw3"
admin_password = "MyStrongPassword123"
db_version     = "21c"
# OLTP, DW, AJD, APEX
db_workload    = "DW"
# Must be false for AJD and APEX
is_free_tier   = "true"
license_model  = "LICENSE_INCLUDED"
5

Build the Infrastructure

Initialize the working directory using the command. Use the command to test the execution plan. Use the command to create the OCI infrastructure. Check the Oracle Cloud account to see the new infrastructure is built. For more information see: - Terraform : All Articles - Terraform : Oracle Cloud Infrastructure (OCI) Provider - Terraform : Oracle Cloud Infrastructure (OCI) Compartment - Terraform : Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN) - Terraform : Oracle Cloud Infrastructure (OCI) Autonomous Database (ADW, ATP, AJD, APX) Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
terraform init

terraform plan
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # oci_core_dhcp_options.tf_dhcp_options will be created
  + resource "oci_core_dhcp_options" "tf_dhcp_options" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "default-dhcp-options"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + options {
          + custom_dns_servers  = []
          + search_domain_names = (known after apply)
          + server_type         = "VcnLocalPlusInternet"
          + type                = "DomainNameServer"
        }
    }

  # oci_core_security_list.tf_private_security_list will be created
  + resource "oci_core_security_list" "tf_private_security_list" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "security-list-for-private-subnet"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + egress_security_rules {
          + description      = (known after apply)
          + destination      = "0.0.0.0/0"
          + destination_type = "CIDR_BLOCK"
          + protocol         = "all"
          + stateless        = false
        }

      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = -1
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = 4
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 22
              + min = 22
            }
        }
    }

  # oci_core_security_list.tf_public_security_list will be created
  + resource "oci_core_security_list" "tf_public_security_list" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "security-list-for-public-subnet"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + egress_security_rules {
          + description      = (known after apply)
          + destination      = "0.0.0.0/0"
          + destination_type = "CIDR_BLOCK"
          + protocol         = "all"
          + stateless        = false
        }

      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = -1
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = 4
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 1522
              + min = 1521
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 22
              + min = 22
            }
        }
    }

  # oci_core_subnet.tf_vcn_private_subnet will be created
  + resource "oci_core_subnet" "tf_vcn_private_subnet" {
      + availability_domain        = (known after apply)
      + cidr_block                 = "10.0.1.0/24"
      + compartment_id             = (known after apply)
      + defined_tags               = (known after apply)
      + dhcp_options_id            = (known after apply)
      + display_name               = "private-subnet"
      + dns_label                  = (known after apply)
      + freeform_tags              = (known after apply)
      + id                         = (known after apply)
      + ipv6cidr_block             = (known after apply)
      + ipv6public_cidr_block      = (known after apply)
      + ipv6virtual_router_ip      = (known after apply)
      + prohibit_public_ip_on_vnic = (known after apply)
      + route_table_id             = (known after apply)
      + security_list_ids          = (known after apply)
      + state                      = (known after apply)
      + subnet_domain_name         = (known after apply)
      + time_created               = (known after apply)
      + vcn_id                     = (known after apply)
      + virtual_router_ip          = (known after apply)
      + virtual_router_mac         = (known after apply)
    }

  # oci_core_subnet.tf_vcn_public_subnet will be created
  + resource "oci_core_subnet" "tf_vcn_public_subnet" {
      + availability_domain        = (known after apply)
      + cidr_block                 = "10.0.0.0/24"
      + compartment_id             = (known after apply)
      + defined_tags               = (known after apply)
      + dhcp_options_id            = (known after apply)
      + display_name               = "public-subnet"
      + dns_label                  = (known after apply)
      + freeform_tags              = (known after apply)
      + id                         = (known after apply)
      + ipv6cidr_block             = (known after apply)
      + ipv6public_cidr_block      = (known after apply)
      + ipv6virtual_router_ip      = (known after apply)
      + prohibit_public_ip_on_vnic = (known after apply)
      + route_table_id             = (known after apply)
      + security_list_ids          = (known after apply)
      + state                      = (known after apply)
      + subnet_domain_name         = (known after apply)
      + time_created               = (known after apply)
      + vcn_id                     = (known after apply)
      + virtual_router_ip          = (known after apply)
      + virtual_router_mac         = (known after apply)
    }

  # oci_database_autonomous_database.tf_adb will be created
  + resource "oci_database_autonomous_database" "tf_adb" {
      + admin_password                                 = (sensitive value)
      + apex_details                                   = (known after apply)
      + are_primary_whitelisted_ips_used               = (known after apply)
      + autonomous_container_database_id               = (known after apply)
      + autonomous_database_backup_id                  = (known after apply)
      + autonomous_database_id                         = (known after apply)
      + available_upgrade_versions                     = (known after apply)
      + backup_config                                  = (known after apply)
      + clone_type                                     = (known after apply)
      + compartment_id                                 = (known after apply)
      + connection_strings                             = (known after apply)
      + connection_urls                                = (known after apply)
      + cpu_core_count                                 = 1
      + data_safe_status                               = (known after apply)
      + data_storage_size_in_gb                        = (known after apply)
      + data_storage_size_in_tbs                       = 1
      + db_name                                        = "obadw3"
      + db_version                                     = "21c"
      + db_workload                                    = "DW"
      + defined_tags                                   = (known after apply)
      + display_name                                   = "obadw3"
      + failed_data_recovery_in_seconds                = (known after apply)
      + freeform_tags                                  = (known after apply)
      + id                                             = (known after apply)
      + infrastructure_type                            = (known after apply)
      + is_access_control_enabled                      = (known after apply)
      + is_auto_scaling_enabled                        = (known after apply)
      + is_data_guard_enabled                          = (known after apply)
      + is_dedicated                                   = (known after apply)
      + is_free_tier                                   = true
      + is_preview                                     = (known after apply)
      + is_preview_version_with_service_terms_accepted = (known after apply)
      + is_refreshable_clone                           = (known after apply)
      + key_store_id                                   = (known after apply)
      + key_store_wallet_name                          = (known after apply)
      + license_model                                  = "LICENSE_INCLUDED"
      + lifecycle_details                              = (known after apply)
      + nsg_ids                                        = (known after apply)
      + open_mode                                      = (known after apply)
      + operations_insights_status                     = (known after apply)
      + permission_level                               = (known after apply)
      + private_endpoint                               = (known after apply)
      + private_endpoint_ip                            = (known after apply)
      + private_endpoint_label                         = (known after apply)
      + refreshable_mode                               = (known after apply)
      + refreshable_status                             = (known after apply)
      + role                                           = (known after apply)
      + service_console_url                            = (known after apply)
      + source                                         = (known after apply)
      + source_id                                      = (known after apply)
      + standby_db                                     = (known after apply)
      + standby_whitelisted_ips                        = (known after apply)
      + state                                          = (known after apply)
      + subnet_id                                      = (known after apply)
      + system_tags                                    = (known after apply)
      + time_created                                   = (known after apply)
      + time_deletion_of_free_autonomous_database      = (known after apply)
      + time_maintenance_begin                         = (known after apply)
      + time_maintenance_end                           = (known after apply)
      + time_of_last_failover                          = (known after apply)
      + time_of_last_refresh                           = (known after apply)
      + time_of_last_refresh_point                     = (known after apply)
      + time_of_last_switchover                        = (known after apply)
      + time_of_next_refresh                           = (known after apply)
      + time_reclamation_of_free_autonomous_database   = (known after apply)
      + timestamp                                      = (known after apply)
      + used_data_storage_size_in_tbs                  = (known after apply)
    }

  # oci_identity_compartment.tf_compartment will be created
  + resource "oci_identity_compartment" "tf_compartment" {
      + compartment_id = "ocid1.tenancy.oc1..aaaaaaaa..."
      + defined_tags   = (known after apply)
      + description    = "Oracle-Base Compartment 3"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + inactive_state = (known after apply)
      + is_accessible  = (known after apply)
      + name           = "obcomp3"
      + state          = (known after apply)
      + time_created   = (known after apply)
    }

  # module.vcn.oci_core_internet_gateway.ig[0] will be created
  + resource "oci_core_internet_gateway" "ig" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "internet-gateway"
      + enabled        = true
      + freeform_tags  = {
          + "environment" = "dev"
        }
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)
    }

  # module.vcn.oci_core_route_table.ig[0] will be created
  + resource "oci_core_route_table" "ig" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "internet-route"
      + freeform_tags  = {
          + "environment" = "dev"
        }
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + route_rules {
          + cidr_block        = (known after apply)
          + description       = (known after apply)
          + destination       = "0.0.0.0/0"
          + destination_type  = (known after apply)
          + network_entity_id = (known after apply)
        }
    }

  # module.vcn.oci_core_vcn.vcn will be created
  + resource "oci_core_vcn" "vcn" {
      + cidr_block               = "10.0.0.0/16"
      + cidr_blocks              = (known after apply)
      + compartment_id           = (known after apply)
      + default_dhcp_options_id  = (known after apply)
      + default_route_table_id   = (known after apply)
      + default_security_list_id = (known after apply)
      + defined_tags             = (known after apply)
      + display_name             = "obvcn3"
      + dns_label                = "obvcn3"
      + freeform_tags            = {
          + "environment" = "dev"
        }
      + id                       = (known after apply)
      + ipv6cidr_block           = (known after apply)
      + ipv6public_cidr_block    = (known after apply)
      + is_ipv6enabled           = (known after apply)
      + state                    = (known after apply)
      + time_created             = (known after apply)
      + vcn_domain_name          = (known after apply)
    }

Plan: 10 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + compartment_id           = (known after apply)
  + compartment_name         = "obcomp3"
  + db_name                  = "obadw3"
  + db_state                 = (known after apply)
  + private_security_list_id = (known after apply)
  + private_subnet_id        = (known after apply)
  + public_security_list_id  = (known after apply)
  + public_subnet_id         = (known after apply)
  + vcn_id                   = (known after apply)

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

terraform apply
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # oci_core_dhcp_options.tf_dhcp_options will be created
  + resource "oci_core_dhcp_options" "tf_dhcp_options" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "default-dhcp-options"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + options {
          + custom_dns_servers  = []
          + search_domain_names = (known after apply)
          + server_type         = "VcnLocalPlusInternet"
          + type                = "DomainNameServer"
        }
    }

  # oci_core_security_list.tf_private_security_list will be created
  + resource "oci_core_security_list" "tf_private_security_list" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "security-list-for-private-subnet"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + egress_security_rules {
          + description      = (known after apply)
          + destination      = "0.0.0.0/0"
          + destination_type = "CIDR_BLOCK"
          + protocol         = "all"
          + stateless        = false
        }

      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = -1
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = 4
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 22
              + min = 22
            }
        }
    }

  # oci_core_security_list.tf_public_security_list will be created
  + resource "oci_core_security_list" "tf_public_security_list" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "security-list-for-public-subnet"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + egress_security_rules {
          + description      = (known after apply)
          + destination      = "0.0.0.0/0"
          + destination_type = "CIDR_BLOCK"
          + protocol         = "all"
          + stateless        = false
        }

      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "10.0.0.0/16"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = -1
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "1"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + icmp_options {
              + code = 4
              + type = 3
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 1522
              + min = 1521
            }
        }
      + ingress_security_rules {
          + description = (known after apply)
          + protocol    = "6"
          + source      = "0.0.0.0/0"
          + source_type = "CIDR_BLOCK"
          + stateless   = false

          + tcp_options {
              + max = 22
              + min = 22
            }
        }
    }

  # oci_core_subnet.tf_vcn_private_subnet will be created
  + resource "oci_core_subnet" "tf_vcn_private_subnet" {
      + availability_domain        = (known after apply)
      + cidr_block                 = "10.0.1.0/24"
      + compartment_id             = (known after apply)
      + defined_tags               = (known after apply)
      + dhcp_options_id            = (known after apply)
      + display_name               = "private-subnet"
      + dns_label                  = (known after apply)
      + freeform_tags              = (known after apply)
      + id                         = (known after apply)
      + ipv6cidr_block             = (known after apply)
      + ipv6public_cidr_block      = (known after apply)
      + ipv6virtual_router_ip      = (known after apply)
      + prohibit_public_ip_on_vnic = (known after apply)
      + route_table_id             = (known after apply)
      + security_list_ids          = (known after apply)
      + state                      = (known after apply)
      + subnet_domain_name         = (known after apply)
      + time_created               = (known after apply)
      + vcn_id                     = (known after apply)
      + virtual_router_ip          = (known after apply)
      + virtual_router_mac         = (known after apply)
    }

  # oci_core_subnet.tf_vcn_public_subnet will be created
  + resource "oci_core_subnet" "tf_vcn_public_subnet" {
      + availability_domain        = (known after apply)
      + cidr_block                 = "10.0.0.0/24"
      + compartment_id             = (known after apply)
      + defined_tags               = (known after apply)
      + dhcp_options_id            = (known after apply)
      + display_name               = "public-subnet"
      + dns_label                  = (known after apply)
      + freeform_tags              = (known after apply)
      + id                         = (known after apply)
      + ipv6cidr_block             = (known after apply)
      + ipv6public_cidr_block      = (known after apply)
      + ipv6virtual_router_ip      = (known after apply)
      + prohibit_public_ip_on_vnic = (known after apply)
      + route_table_id             = (known after apply)
      + security_list_ids          = (known after apply)
      + state                      = (known after apply)
      + subnet_domain_name         = (known after apply)
      + time_created               = (known after apply)
      + vcn_id                     = (known after apply)
      + virtual_router_ip          = (known after apply)
      + virtual_router_mac         = (known after apply)
    }

  # oci_database_autonomous_database.tf_adb will be created
  + resource "oci_database_autonomous_database" "tf_adb" {
      + admin_password                                 = (sensitive value)
      + apex_details                                   = (known after apply)
      + are_primary_whitelisted_ips_used               = (known after apply)
      + autonomous_container_database_id               = (known after apply)
      + autonomous_database_backup_id                  = (known after apply)
      + autonomous_database_id                         = (known after apply)
      + available_upgrade_versions                     = (known after apply)
      + backup_config                                  = (known after apply)
      + clone_type                                     = (known after apply)
      + compartment_id                                 = (known after apply)
      + connection_strings                             = (known after apply)
      + connection_urls                                = (known after apply)
      + cpu_core_count                                 = 1
      + data_safe_status                               = (known after apply)
      + data_storage_size_in_gb                        = (known after apply)
      + data_storage_size_in_tbs                       = 1
      + db_name                                        = "obadw3"
      + db_version                                     = "21c"
      + db_workload                                    = "DW"
      + defined_tags                                   = (known after apply)
      + display_name                                   = "obadw3"
      + failed_data_recovery_in_seconds                = (known after apply)
      + freeform_tags                                  = (known after apply)
      + id                                             = (known after apply)
      + infrastructure_type                            = (known after apply)
      + is_access_control_enabled                      = (known after apply)
      + is_auto_scaling_enabled                        = (known after apply)
      + is_data_guard_enabled                          = (known after apply)
      + is_dedicated                                   = (known after apply)
      + is_free_tier                                   = true
      + is_preview                                     = (known after apply)
      + is_preview_version_with_service_terms_accepted = (known after apply)
      + is_refreshable_clone                           = (known after apply)
      + key_store_id                                   = (known after apply)
      + key_store_wallet_name                          = (known after apply)
      + license_model                                  = "LICENSE_INCLUDED"
      + lifecycle_details                              = (known after apply)
      + nsg_ids                                        = (known after apply)
      + open_mode                                      = (known after apply)
      + operations_insights_status                     = (known after apply)
      + permission_level                               = (known after apply)
      + private_endpoint                               = (known after apply)
      + private_endpoint_ip                            = (known after apply)
      + private_endpoint_label                         = (known after apply)
      + refreshable_mode                               = (known after apply)
      + refreshable_status                             = (known after apply)
      + role                                           = (known after apply)
      + service_console_url                            = (known after apply)
      + source                                         = (known after apply)
      + source_id                                      = (known after apply)
      + standby_db                                     = (known after apply)
      + standby_whitelisted_ips                        = (known after apply)
      + state                                          = (known after apply)
      + subnet_id                                      = (known after apply)
      + system_tags                                    = (known after apply)
      + time_created                                   = (known after apply)
      + time_deletion_of_free_autonomous_database      = (known after apply)
      + time_maintenance_begin                         = (known after apply)
      + time_maintenance_end                           = (known after apply)
      + time_of_last_failover                          = (known after apply)
      + time_of_last_refresh                           = (known after apply)
      + time_of_last_refresh_point                     = (known after apply)
      + time_of_last_switchover                        = (known after apply)
      + time_of_next_refresh                           = (known after apply)
      + time_reclamation_of_free_autonomous_database   = (known after apply)
      + timestamp                                      = (known after apply)
      + used_data_storage_size_in_tbs                  = (known after apply)
    }

  # oci_identity_compartment.tf_compartment will be created
  + resource "oci_identity_compartment" "tf_compartment" {
      + compartment_id = "ocid1.tenancy.oc1..aaaaaaaa..."
      + defined_tags   = (known after apply)
      + description    = "Oracle-Base Compartment 3"
      + freeform_tags  = (known after apply)
      + id             = (known after apply)
      + inactive_state = (known after apply)
      + is_accessible  = (known after apply)
      + name           = "obcomp3"
      + state          = (known after apply)
      + time_created   = (known after apply)
    }

  # module.vcn.oci_core_internet_gateway.ig[0] will be created
  + resource "oci_core_internet_gateway" "ig" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "internet-gateway"
      + enabled        = true
      + freeform_tags  = {
          + "environment" = "dev"
        }
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)
    }

  # module.vcn.oci_core_route_table.ig[0] will be created
  + resource "oci_core_route_table" "ig" {
      + compartment_id = (known after apply)
      + defined_tags   = (known after apply)
      + display_name   = "internet-route"
      + freeform_tags  = {
          + "environment" = "dev"
        }
      + id             = (known after apply)
      + state          = (known after apply)
      + time_created   = (known after apply)
      + vcn_id         = (known after apply)

      + route_rules {
          + cidr_block        = (known after apply)
          + description       = (known after apply)
          + destination       = "0.0.0.0/0"
          + destination_type  = (known after apply)
          + network_entity_id = (known after apply)
        }
    }

  # module.vcn.oci_core_vcn.vcn will be created
  + resource "oci_core_vcn" "vcn" {
      + cidr_block               = "10.0.0.0/16"
      + cidr_blocks              = (known after apply)
      + compartment_id           = (known after apply)
      + default_dhcp_options_id  = (known after apply)
      + default_route_table_id   = (known after apply)
      + default_security_list_id = (known after apply)
      + defined_tags             = (known after apply)
      + display_name             = "obvcn3"
      + dns_label                = "obvcn3"
      + freeform_tags            = {
          + "environment" = "dev"
        }
      + id                       = (known after apply)
      + ipv6cidr_block           = (known after apply)
      + ipv6public_cidr_block    = (known after apply)
      + is_ipv6enabled           = (known after apply)
      + state                    = (known after apply)
      + time_created             = (known after apply)
      + vcn_domain_name          = (known after apply)
    }

Plan: 10 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + compartment_id           = (known after apply)
  + compartment_name         = "obcomp3"
  + db_name                  = "obadw3"
  + db_state                 = (known after apply)
  + private_security_list_id = (known after apply)
  + private_subnet_id        = (known after apply)
  + public_security_list_id  = (known after apply)
  + public_subnet_id         = (known after apply)
  + vcn_id                   = (known after apply)

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

oci_identity_compartment.tf_compartment: Creating...
oci_identity_compartment.tf_compartment: Still creating... [10s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [20s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [30s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [40s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [50s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [1m0s elapsed]
oci_identity_compartment.tf_compartment: Still creating... [1m11s elapsed]
oci_identity_compartment.tf_compartment: Creation complete after 1m16s [id=ocid1.compartment.oc1..aaaaaaaa...]
module.vcn.oci_core_vcn.vcn: Creating...
oci_database_autonomous_database.tf_adb: Creating...
module.vcn.oci_core_vcn.vcn: Creation complete after 1s [id=ocid1.vcn.oc1.uk-london-1.amaaaaaa...]
module.vcn.oci_core_internet_gateway.ig[0]: Creating...
oci_core_dhcp_options.tf_dhcp_options: Creating...
oci_core_security_list.tf_private_security_list: Creating...
oci_core_security_list.tf_public_security_list: Creating...
module.vcn.oci_core_internet_gateway.ig[0]: Creation complete after 0s [id=ocid1.internetgateway.oc1.uk-london-1.aaaaaaaa...]
module.vcn.oci_core_route_table.ig[0]: Creating...
oci_core_security_list.tf_private_security_list: Creation complete after 0s [id=ocid1.securitylist.oc1.uk-london-1.aaaaaaaa...]
oci_core_subnet.tf_vcn_private_subnet: Creating...
oci_core_security_list.tf_public_security_list: Creation complete after 0s [id=ocid1.securitylist.oc1.uk-london-1.aaaaaaaa...]
module.vcn.oci_core_route_table.ig[0]: Creation complete after 0s [id=ocid1.routetable.oc1.uk-london-1.aaaaaaaa...]
oci_core_subnet.tf_vcn_public_subnet: Creating...
oci_core_dhcp_options.tf_dhcp_options: Creation complete after 0s [id=ocid1.dhcpoptions.oc1.uk-london-1.aaaaaaaa...]
oci_core_subnet.tf_vcn_private_subnet: Creation complete after 5s [id=ocid1.subnet.oc1.uk-london-1.aaaaaaaa...]
oci_core_subnet.tf_vcn_public_subnet: Creation complete after 5s [id=ocid1.subnet.oc1.uk-london-1.aaaaaaaa...]
oci_database_autonomous_database.tf_adb: Still creating... [10s elapsed]
oci_database_autonomous_database.tf_adb: Still creating... [20s elapsed]
oci_database_autonomous_database.tf_adb: Still creating... [30s elapsed]
oci_database_autonomous_database.tf_adb: Still creating... [40s elapsed]
oci_database_autonomous_database.tf_adb: Still creating... [50s elapsed]
oci_database_autonomous_database.tf_adb: Creation complete after 57s [id=ocid1.autonomousdatabase.oc1.uk-london-1.abwgiljsz...]

Apply complete! Resources: 10 added, 0 changed, 0 destroyed.

Outputs:

compartment_id = "ocid1.compartment.oc1..aaaaaaaa..."
compartment_name = "obcomp3"
db_name = "obadw3"
db_state = "AVAILABLE"
private_security_list_id = "ocid1.securitylist.oc1.uk-london-1.aaaaaaaa..."
private_subnet_id = "ocid1.subnet.oc1.uk-london-1.aaaaaaaa..."
public_security_list_id = "ocid1.securitylist.oc1.uk-london-1.aaaaaaaa..."
public_subnet_id = "ocid1.subnet.oc1.uk-london-1.aaaaaaaa..."
vcn_id = "ocid1.vcn.oc1.uk-london-1.amaaaaaa..."

Comments (0)

Please to add comments

No comments yet. Be the first to comment!