Skip to content

Commit 6c3e4d6

Browse files
authored
added support to null DRG ID passed as input from external modules (#9)
* fix: removed the region variable * added support to null DRG ID passed as input from external modules
1 parent 447cf22 commit 6c3e4d6

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

drg.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data "oci_core_drgs" "drg_data" {
1717

1818
filter {
1919
name = "id"
20-
values = [var.drg_id]
20+
values = [var.drg_id == null ? "none" : var.drg_id]
2121
}
2222

2323
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ output "drg_summary" {
2727
description = "drg information summary"
2828
value = {
2929
(length(data.oci_core_drgs.drg_data.drgs) == 0 ? oci_core_drg.drg[0].display_name : data.oci_core_drgs.drg_data.drgs[0].display_name) = {
30-
drg_id = length(data.oci_core_drgs.drg_data.drgs) == 0 ? oci_core_drg.drg[0].id : data.oci_core_drgs.drg_data.drgs[*].id
30+
drg_id = length(data.oci_core_drgs.drg_data.drgs) == 0 ? oci_core_drg.drg[0].id : data.oci_core_drgs.drg_data.drgs[0].id
3131
vcn_attachments = { for k, v in oci_core_drg_attachment.vcns : k => v.network_details[0].id }
3232

3333
}

terraform.tfvars.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Copyright (c) 2022 Oracle Corporation and/or affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

4-
# Region
5-
6-
region = "us-phoenix-1"
7-
84
# general oci parameters
95

106
compartment_id = ""

0 commit comments

Comments
 (0)