Skip to content

Commit b326b3e

Browse files
Terraform Team Automationrashik-bhasin
authored andcommitted
Added - Support for Complete Terraform testing for Diagnostics using TFACTL feature
1 parent c051203 commit b326b3e

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

internal/integrationtest/golden_gate_deployment_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
255255
resource.TestCheckResourceAttrSet(singularDatasourceName, "deployment_id"),
256256
resource.TestCheckResourceAttr(singularDatasourceName, "compartment_id", compartmentId),
257257
resource.TestCheckResourceAttr(singularDatasourceName, "cpu_core_count", "1"),
258+
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_diagnostic_data.#", "0"),
258259
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_type", "OGG"),
259260
resource.TestCheckResourceAttrSet(singularDatasourceName, "deployment_url"),
260261
resource.TestCheckResourceAttr(singularDatasourceName, "description", "description2"),

internal/service/golden_gate/golden_gate_deployment_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ func (s *GoldenGateDeploymentDataSourceCrud) SetData() error {
8383
s.D.Set("deployment_backup_id", *s.Res.DeploymentBackupId)
8484
}
8585

86+
if s.Res.DeploymentDiagnosticData != nil {
87+
s.D.Set("deployment_diagnostic_data", []interface{}{DeploymentDiagnosticDataToMap(s.Res.DeploymentDiagnosticData)})
88+
} else {
89+
s.D.Set("deployment_diagnostic_data", nil)
90+
}
91+
8692
s.D.Set("deployment_type", s.Res.DeploymentType)
8793

8894
if s.Res.DeploymentUrl != nil {

internal/service/golden_gate/golden_gate_deployment_resource.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,43 @@ func GoldenGateDeploymentResource() *schema.Resource {
157157
},
158158

159159
// Computed
160+
"deployment_diagnostic_data": {
161+
Type: schema.TypeList,
162+
Computed: true,
163+
Elem: &schema.Resource{
164+
Schema: map[string]*schema.Schema{
165+
// Required
166+
167+
// Optional
168+
169+
// Computed
170+
"bucket": {
171+
Type: schema.TypeString,
172+
Computed: true,
173+
},
174+
"diagnostic_state": {
175+
Type: schema.TypeString,
176+
Computed: true,
177+
},
178+
"namespace": {
179+
Type: schema.TypeString,
180+
Computed: true,
181+
},
182+
"object": {
183+
Type: schema.TypeString,
184+
Computed: true,
185+
},
186+
"time_diagnostic_end": {
187+
Type: schema.TypeString,
188+
Computed: true,
189+
},
190+
"time_diagnostic_start": {
191+
Type: schema.TypeString,
192+
Computed: true,
193+
},
194+
},
195+
},
196+
},
160197
"deployment_url": {
161198
Type: schema.TypeString,
162199
Computed: true,
@@ -665,6 +702,12 @@ func (s *GoldenGateDeploymentResourceCrud) SetData() error {
665702
s.D.Set("deployment_backup_id", *s.Res.DeploymentBackupId)
666703
}
667704

705+
if s.Res.DeploymentDiagnosticData != nil {
706+
s.D.Set("deployment_diagnostic_data", []interface{}{DeploymentDiagnosticDataToMap(s.Res.DeploymentDiagnosticData)})
707+
} else {
708+
s.D.Set("deployment_diagnostic_data", nil)
709+
}
710+
668711
s.D.Set("deployment_type", s.Res.DeploymentType)
669712

670713
if s.Res.DeploymentUrl != nil {
@@ -856,6 +899,34 @@ func OggDeploymentToMap(obj *oci_golden_gate.OggDeployment, resourceData *schema
856899
return result
857900
}
858901

902+
func DeploymentDiagnosticDataToMap(obj *oci_golden_gate.DeploymentDiagnosticData) map[string]interface{} {
903+
result := map[string]interface{}{}
904+
905+
if obj.BucketName != nil {
906+
result["bucket"] = string(*obj.BucketName)
907+
}
908+
909+
result["diagnostic_state"] = string(obj.DiagnosticState)
910+
911+
if obj.NamespaceName != nil {
912+
result["namespace"] = string(*obj.NamespaceName)
913+
}
914+
915+
if obj.ObjectName != nil {
916+
result["object"] = string(*obj.ObjectName)
917+
}
918+
919+
if obj.TimeDiagnosticEnd != nil {
920+
result["time_diagnostic_end"] = obj.TimeDiagnosticEnd.String()
921+
}
922+
923+
if obj.TimeDiagnosticStart != nil {
924+
result["time_diagnostic_start"] = obj.TimeDiagnosticStart.String()
925+
}
926+
927+
return result
928+
}
929+
859930
func GoldenGateDeploymentSummaryToMap(obj oci_golden_gate.DeploymentSummary) map[string]interface{} {
860931
result := map[string]interface{}{}
861932

website/docs/d/golden_gate_deployment.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ The following attributes are exported:
3737
* `cpu_core_count` - The Minimum number of OCPUs to be made available for this Deployment.
3838
* `defined_tags` - Tags defined for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
3939
* `deployment_backup_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the backup being referenced.
40+
* `deployment_diagnostic_data` - Information regarding the deployment diagnostic collection
41+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
42+
* `diagnostic_state` - The state of the deployment diagnostic collection.
43+
* `namespace` - Name of namespace that serves as a container for all of your buckets
44+
* `object` - Name of the diagnostic collected and uploaded to object storage
45+
* `time_diagnostic_end` - The time until which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
46+
* `time_diagnostic_start` - The time from which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
4047
* `deployment_type` - The type of deployment, the value determines the exact 'type' of service executed in the Deployment. NOTE: Use of the value OGG is maintained for backward compatibility purposes. Its use is discouraged in favor of the equivalent DATABASE_ORACLE value.
4148
* `deployment_url` - The URL of a resource.
4249
* `description` - Metadata about this specific object.

website/docs/d/golden_gate_deployments.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ The following attributes are exported:
5353
* `cpu_core_count` - The Minimum number of OCPUs to be made available for this Deployment.
5454
* `defined_tags` - Tags defined for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
5555
* `deployment_backup_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the backup being referenced.
56+
* `deployment_diagnostic_data` - Information regarding the deployment diagnostic collection
57+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
58+
* `diagnostic_state` - The state of the deployment diagnostic collection.
59+
* `namespace` - Name of namespace that serves as a container for all of your buckets
60+
* `object` - Name of the diagnostic collected and uploaded to object storage
61+
* `time_diagnostic_end` - The time until which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
62+
* `time_diagnostic_start` - The time from which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
5663
* `deployment_type` - The type of deployment, the value determines the exact 'type' of service executed in the Deployment. NOTE: Use of the value OGG is maintained for backward compatibility purposes. Its use is discouraged in favor of the equivalent DATABASE_ORACLE value.
5764
* `deployment_url` - The URL of a resource.
5865
* `description` - Metadata about this specific object.

website/docs/r/golden_gate_deployment.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ The following attributes are exported:
8484
* `cpu_core_count` - The Minimum number of OCPUs to be made available for this Deployment.
8585
* `defined_tags` - Tags defined for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
8686
* `deployment_backup_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the backup being referenced.
87+
* `deployment_diagnostic_data` - Information regarding the deployment diagnostic collection
88+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
89+
* `diagnostic_state` - The state of the deployment diagnostic collection.
90+
* `namespace` - Name of namespace that serves as a container for all of your buckets
91+
* `object` - Name of the diagnostic collected and uploaded to object storage
92+
* `time_diagnostic_end` - The time until which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
93+
* `time_diagnostic_start` - The time from which the diagnostic collection should collect the logs. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2016-08-25T21:10:29.600Z`.
8794
* `deployment_type` - The type of deployment, the value determines the exact 'type' of service executed in the Deployment. NOTE: Use of the value OGG is maintained for backward compatibility purposes. Its use is discouraged in favor of the equivalent DATABASE_ORACLE value.
8895
* `deployment_url` - The URL of a resource.
8996
* `description` - Metadata about this specific object.

0 commit comments

Comments
 (0)