Skip to content

Commit 8b62148

Browse files
rohith kumar veligetiNagaRajuPasunuri
authored andcommitted
Bug Fix - Fixed network-source/Domains/Polices resource discovery issue.
1 parent a08d3d0 commit 8b62148

File tree

45 files changed

+238
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+238
-169
lines changed

internal/integrationtest/identity_domain_test.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ var (
6565
"state": acctest.Representation{RepType: acctest.Optional, Update: `INACTIVE`},
6666
}
6767

68+
IdentityDomainReplicationToRegionRepresentation1 = map[string]interface{}{
69+
"domain_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_identity_domain.test_domain.id}`},
70+
"replica_region": acctest.Representation{RepType: acctest.Required, Create: `us-sanjose-1`},
71+
}
72+
6873
IdentityDomainResourceDependencies = DefinedTagsDependencies
6974
)
7075

7176
// issue-routing-tag: identity/default
7277
func TestIdentityDomainResource_basic(t *testing.T) {
73-
t.Skip("Skip this test because henosis tenancy is needed")
7478
httpreplay.SetScenario("TestIdentityDomainResource_basic")
7579
defer httpreplay.SaveScenario()
7680

@@ -121,7 +125,8 @@ func TestIdentityDomainResource_basic(t *testing.T) {
121125
// verify Create with optionals
122126
{
123127
Config: config + compartmentIdVariableStr + IdentityDomainResourceDependencies +
124-
acctest.GenerateResourceFromRepresentationMap("oci_identity_domain", "test_domain", acctest.Optional, acctest.Create, IdentityDomainRepresentation),
128+
acctest.GenerateResourceFromRepresentationMap("oci_identity_domain", "test_domain", acctest.Optional, acctest.Create, IdentityDomainRepresentation) +
129+
acctest.GenerateResourceFromRepresentationMap("oci_identity_domain_replication_to_region", "test_domain_replication_to_region", acctest.Optional, acctest.Create, IdentityDomainReplicationToRegionRepresentation1),
125130
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
126131
resource.TestCheckResourceAttr(resourceName, "admin_email", "adminEmail@test.com"),
127132
resource.TestCheckResourceAttr(resourceName, "admin_first_name", "adminFirstName"),
@@ -180,6 +185,10 @@ func TestIdentityDomainResource_basic(t *testing.T) {
180185
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
181186
resource.TestCheckResourceAttrSet(resourceName, "type"),
182187
resource.TestCheckResourceAttrSet(resourceName, "url"),
188+
resource.TestCheckResourceAttrSet(resourceName, "replica_regions.0.regional_url"),
189+
resource.TestCheckResourceAttrSet(resourceName, "replica_regions.0.url"),
190+
resource.TestCheckResourceAttr(resourceName, "replica_regions.0.state", "REPLICATION_ENABLED"),
191+
resource.TestCheckResourceAttr(resourceName, "replica_regions.0.region", "us-sanjose-1"),
183192

184193
func(s *terraform.State) (err error) {
185194
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -214,6 +223,10 @@ func TestIdentityDomainResource_basic(t *testing.T) {
214223
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
215224
resource.TestCheckResourceAttrSet(resourceName, "type"),
216225
resource.TestCheckResourceAttrSet(resourceName, "url"),
226+
resource.TestCheckResourceAttrSet(resourceName, "replica_regions.0.regional_url"),
227+
resource.TestCheckResourceAttrSet(resourceName, "replica_regions.0.url"),
228+
resource.TestCheckResourceAttr(resourceName, "replica_regions.0.state", "REPLICATION_ENABLED"),
229+
resource.TestCheckResourceAttr(resourceName, "replica_regions.0.region", "us-sanjose-1"),
217230

218231
func(s *terraform.State) (err error) {
219232
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -254,6 +267,10 @@ func TestIdentityDomainResource_basic(t *testing.T) {
254267
resource.TestCheckResourceAttrSet(datasourceName, "domains.0.time_created"),
255268
resource.TestCheckResourceAttrSet(datasourceName, "domains.0.type"),
256269
resource.TestCheckResourceAttrSet(datasourceName, "domains.0.url"),
270+
resource.TestCheckResourceAttrSet(datasourceName, "domains.0.replica_regions.0.regional_url"),
271+
resource.TestCheckResourceAttrSet(datasourceName, "domains.0.replica_regions.0.url"),
272+
resource.TestCheckResourceAttr(datasourceName, "domains.0.replica_regions.0.state", "REPLICATION_ENABLED"),
273+
resource.TestCheckResourceAttr(datasourceName, "domains.0.replica_regions.0.region", "us-sanjose-1"),
257274
),
258275
},
259276
// verify singular datasource
@@ -276,6 +293,10 @@ func TestIdentityDomainResource_basic(t *testing.T) {
276293
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
277294
resource.TestCheckResourceAttrSet(singularDatasourceName, "type"),
278295
resource.TestCheckResourceAttrSet(singularDatasourceName, "url"),
296+
resource.TestCheckResourceAttrSet(singularDatasourceName, "replica_regions.0.regional_url"),
297+
resource.TestCheckResourceAttrSet(singularDatasourceName, "replica_regions.0.url"),
298+
resource.TestCheckResourceAttr(singularDatasourceName, "replica_regions.0.state", "REPLICATION_ENABLED"),
299+
resource.TestCheckResourceAttr(singularDatasourceName, "replica_regions.0.region", "us-sanjose-1"),
279300
),
280301
},
281302
// verify resource import

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
}
@@ -178,6 +183,7 @@ func TestIdentityNetworkSourceResource_basic(t *testing.T) {
178183
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.name", "corpnet"),
179184
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.public_source_list.#", "2"),
180185
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.services.#", "1"),
186+
resource.TestCheckResourceAttrSet(datasourceName, "network_sources.0.state"),
181187
resource.TestCheckResourceAttrSet(datasourceName, "network_sources.0.time_created"),
182188
resource.TestCheckResourceAttr(datasourceName, "network_sources.0.virtual_source_list.#", "1"),
183189
),

internal/resourcediscovery/export_compartment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ func TestUnitGetDiscoverResourceWithGraphSteps(t *testing.T) {
27062706
ctx.Services = []string{"identity"}
27072707
result, err := getDiscoverResourceWithGraphSteps(ctx)
27082708
assert.NoError(t, err)
2709-
assert.Equal(t, 0, len(result))
2709+
assert.Equal(t, 1, len(result))
27102710
})
27112711

27122712
// With targetResource

internal/service/identity/identity_domain_resource.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func IdentityDomainResource() *schema.Resource {
132132
Type: schema.TypeString,
133133
Computed: true,
134134
},
135+
"regional_url": {
136+
Type: schema.TypeString,
137+
Computed: true,
138+
},
135139
"state": {
136140
Type: schema.TypeString,
137141
Computed: true,
@@ -674,6 +678,10 @@ func ReplicatedRegionDetailsToMap(obj oci_identity.ReplicatedRegionDetails) map[
674678
result["region"] = string(*obj.Region)
675679
}
676680

681+
if obj.RegionalUrl != nil {
682+
result["regional_url"] = string(*obj.RegionalUrl)
683+
}
684+
677685
result["state"] = string(obj.State)
678686

679687
if obj.Url != nil {

internal/service/identity/identity_export.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func init() {
2929
exportIdentityTagHints.ProcessDiscoveredResourcesFn = processTagDefinitions
3030
tf_export.RegisterTenancyGraphs("identity", identityResourceGraph)
3131
tf_export.RegisterCompartmentGraphs("tagging", taggingResourceGraph)
32+
tf_export.RegisterCompartmentGraphs("identity", identityCompartmentResourceGraph)
3233
tf_export.BuildAvailabilityResourceGraph("oci_identity_compartment", customAssociationIdentityCompartment)
3334
}
3435

@@ -509,6 +510,13 @@ var identityResourceGraph = tf_export.TerraformResourceGraph{
509510
},
510511
}
511512

513+
var identityCompartmentResourceGraph = tf_export.TerraformResourceGraph{
514+
"oci_identity_compartment": {
515+
{TerraformResourceHints: exportIdentityPolicyHints},
516+
{TerraformResourceHints: exportIdentityDomainHints},
517+
},
518+
}
519+
512520
var taggingResourceGraph = tf_export.TerraformResourceGraph{
513521
"oci_identity_compartment": {
514522
{TerraformResourceHints: exportIdentityTagDefaultHints},

internal/service/identity/identity_network_sources_data_source.go

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

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

135+
networkSource["state"] = r.LifecycleState
136+
135137
if r.TimeCreated != nil {
136138
networkSource["time_created"] = r.TimeCreated.String()
137139
}

website/docs/d/identity_allowed_domain_license_types.html.markdown

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ description: |-
1010
# Data Source: oci_identity_allowed_domain_license_types
1111
This data source provides the list of Allowed Domain License Types in Oracle Cloud Infrastructure Identity service.
1212

13-
List the allowed domain license types supported by Oracle Cloud Infrastructure If {@code currentLicenseTypeName} provided, returns allowed license types a domain with the specified license type name can migrate to.
14-
If {@code name} is provided, it filters and returns resources that match the given license type name.
15-
Otherwise, returns all valid license types that are currently supported.
13+
(For tenancies that support identity domains) Lists the license types for identity domains supported by Oracle Cloud Infrastructure.
14+
(License types are also referred to as domain types.)
1615

17-
- If license type details are retrieved sucessfully, return 202 ACCEPTED.
18-
- If any internal error occurs, return 500 INTERNAL SERVER ERROR.
16+
If `currentLicenseTypeName` is provided, then the request returns license types that the identity domain with the specified license
17+
type name can change to. Otherwise, the request returns all valid license types currently supported.
1918

2019

2120
## Example Usage
@@ -32,7 +31,7 @@ data "oci_identity_allowed_domain_license_types" "test_allowed_domain_license_ty
3231

3332
The following arguments are supported:
3433

35-
* `current_license_type_name` - (Optional) The domain license type
34+
* `current_license_type_name` - (Optional) The license type of the identity domain.
3635

3736

3837
## Attributes Reference

website/docs/d/identity_auth_tokens.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ The following attributes are exported:
4141
The following attributes are exported:
4242

4343
* `description` - The description you assign to the auth token. Does not have to be unique, and it's changeable.
44+
45+
(For tenancies that support identity domains) You can have an empty description.
4446
* `id` - The OCID of the auth token.
4547
* `inactive_state` - The detailed status of INACTIVE lifecycleState.
4648
* `state` - The token's current state.

website/docs/d/identity_authentication_policy.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: |-
1010
# Data Source: oci_identity_authentication_policy
1111
This data source provides details about a specific Authentication Policy resource in Oracle Cloud Infrastructure Identity service.
1212

13-
Gets the authentication policy for the given tenancy. You must specify your tenants OCID as the value for
13+
Gets the authentication policy for the given tenancy. You must specify your tenant's OCID as the value for
1414
the compartment ID (remember that the tenancy is simply the root compartment).
1515

1616

@@ -35,7 +35,7 @@ The following arguments are supported:
3535
The following attributes are exported:
3636

3737
* `compartment_id` - Compartment OCID.
38-
* `network_policy` - Network policy, Consists of a list of Network Source ids.
38+
* `network_policy` - Network policy, which consists of a list of network source IDs.
3939
* `network_source_ids` - Network Source ids
4040
* `password_policy` - Password policy, currently set for the given compartment.
4141
* `is_lowercase_characters_required` - At least one lower case character required.

website/docs/d/identity_cost_tracking_tags.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: |-
1111
This data source provides the list of Cost Tracking Tags in Oracle Cloud Infrastructure Identity service.
1212

1313
Lists all the tags enabled for cost-tracking in the specified tenancy. For information about
14-
cost-tracking tags, see [Using Cost-tracking Tags](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm#costs).
14+
cost-tracking tags, see [Using Cost-tracking Tags](https://docs.cloud.oracle.com/iaas/Content/Tagging/Tasks/usingcosttrackingtags.htm).
1515

1616

1717
## Example Usage
@@ -46,13 +46,13 @@ The following attributes are exported:
4646
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
4747
* `id` - The OCID of the tag definition.
4848
* `is_cost_tracking` - Indicates whether the tag is enabled for cost tracking.
49-
* `is_retired` - Indicates whether the tag is retired. See [Retiring Key Definitions and Namespace Definitions](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm#Retiring).
49+
* `is_retired` - Indicates whether the tag is retired. See [Retiring Key Definitions and Namespace Definitions](https://docs.cloud.oracle.com/iaas/Content/Tagging/Tasks/managingtagsandtagnamespaces.htm#retiringkeys).
5050
* `name` - The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
5151
* `state` - The tag's current state. After creating a tag, make sure its `lifecycleState` is ACTIVE before using it. After retiring a tag, make sure its `lifecycleState` is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's `lifecycleState` changes from DELETING to DELETED.
5252
* `tag_namespace_id` - The OCID of the namespace that contains the tag definition.
5353
* `tag_namespace_name` - The name of the tag namespace that contains the tag definition.
5454
* `time_created` - Date and time the tag was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
55-
* `validator` - Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see [Limits on Tags](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm#Limits).
55+
* `validator` - Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see [Limits on Tags](https://docs.cloud.oracle.com/iaas/Content/Tagging/Concepts/taggingoverview.htm#limits).
5656

5757
If you define a validator after a value has been set for a defined tag, then any updates that attempt to change the value must pass the additional validation defined by the current rule. Previously set values (even those that would fail the current validation) are not updated. You can still update other attributes to resources that contain a non-valid defined tag.
5858

0 commit comments

Comments
 (0)