Skip to content

Commit e860b85

Browse files
rohith kumar veligetivsin12
authored andcommitted
BugFix - Fixed network source resource discovery issue
1 parent 88e82d4 commit e860b85

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

internal/integrationtest/identity_network_source_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,19 @@ var (
5555
"public_source_list": acctest.Representation{RepType: acctest.Optional, Create: []string{`128.2.13.5`}, Update: []string{`128.2.13.5`, `128.2.13.6`}},
5656
"services": acctest.Representation{RepType: acctest.Optional, Create: []string{`none`}, Update: []string{`all`}},
5757
"virtual_source_list": acctest.RepresentationGroup{RepType: acctest.Optional, Group: IdentityNetworkVirtualSourceListRepresentation},
58+
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Required, Group: IdentityNetworkSourceIgnoreChangesRepresentation},
5859
}
5960

6061
IdentityNetworkVirtualSourceListRepresentation = map[string]interface{}{
6162
"vcn_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_vcn.test_vcn.id}`},
6263
"ip_ranges": acctest.Representation{RepType: acctest.Required, Create: []string{`10.0.0.0/16`}},
6364
}
6465

65-
IdentityNetworkSourceResourceDependencies = DefinedTagsDependencies // + VcnRequiredOnlyResource
66+
IdentityNetworkSourceIgnoreChangesRepresentation = map[string]interface{}{ // This may vary depending on the tenancy settings
67+
"ignore_changes": acctest.Representation{RepType: acctest.Required, Create: []string{`defined_tags`, `freeform_tags`}},
68+
}
69+
70+
IdentityNetworkSourceResourceDependencies = DefinedTagsDependencies + acctest.GenerateResourceFromRepresentationMap("oci_core_vcn", "test_vcn", acctest.Required, acctest.Create, CoreVcnRepresentation)
6671
)
6772

6873
// issue-routing-tag: identity/default
@@ -125,7 +130,7 @@ func TestIdentityNetworkSourceResource_basic(t *testing.T) {
125130
func(s *terraform.State) (err error) {
126131
resId, err = acctest.FromInstanceState(s, resourceName, "id")
127132
if isEnableExportCompartment, _ := strconv.ParseBool(utils.GetEnvSettingWithDefault("enable_export_compartment", "true")); isEnableExportCompartment {
128-
if errExport := resourcediscovery.TestExportCompartmentWithResourceName(&resId, &compartmentId, resourceName); errExport != nil {
133+
if errExport := resourcediscovery.TestExportCompartmentWithResourceName(&resId, &tenancyId, resourceName); errExport != nil {
129134
return errExport
130135
}
131136
}
@@ -179,6 +184,7 @@ func TestIdentityNetworkSourceResource_basic(t *testing.T) {
179184
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.public_source_list.#", "2"),
180185
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.services.#", "1"),
181186
resource.TestCheckResourceAttrSet(datasourceName, "network_sources.0.time_created"),
187+
resource.TestCheckResourceAttrSet(datasourceName, "network_sources.0.state"),
182188
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.virtual_source_list.#", "1"),
183189
),
184190
},

internal/service/identity/identity_network_sources_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func (s *IdentityNetworkSourcesDataSourceCrud) SetData() error {
132132

133133
networkSource["services"] = r.Services
134134

135+
if r.LifecycleState != "" {
136+
networkSource["state"] = r.LifecycleState
137+
}
138+
135139
if r.TimeCreated != nil {
136140
networkSource["time_created"] = r.TimeCreated.String()
137141
}

0 commit comments

Comments
 (0)