Skip to content

Commit c071c4f

Browse files
Balint PappSrividyaKamakshi
authored andcommitted
Added - Support for GGS Release 9 Connections
1 parent ce4638d commit c071c4f

File tree

8 files changed

+689
-16
lines changed

8 files changed

+689
-16
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
variable "tenancy_ocid" {}
2+
variable "user_ocid" {}
3+
variable "fingerprint" {}
4+
variable "private_key_path" {}
5+
variable "compartment_id" {}
6+
variable "region" {}
7+
variable "subnet_id" {}
8+
9+
variable "locks_type" {
10+
default = "FULL"
11+
}
12+
13+
variable "locks_message" {
14+
default = "message"
15+
}
16+
17+
variable "is_lock_override" {
18+
default = true
19+
}
20+
21+
variable "description" {
22+
default = "Created as example for TERSI-4887 Connections R9"
23+
}
24+
variable "freeform_tags" {
25+
default = { "bar-key" = "value" }
26+
}
27+
variable "connection_type" {
28+
default = "ORACLE_AI_DATA_PLATFORM"
29+
}
30+
variable "display_name" {
31+
default = "OracleAiDataPlatform_TerraformTest"
32+
}
33+
variable "technology_type" {
34+
default = "ORACLE_AI_DATA_PLATFORM"
35+
}
36+
variable "connection_url" {
37+
default = "jdbc:spark://gateway.datalake.us-phoenix-1.oci.oraclecloud.com/default"
38+
}
39+
variable "should_use_resource_principal" {
40+
default = true
41+
}
42+
provider "oci" {
43+
tenancy_ocid = var.tenancy_ocid
44+
user_ocid = var.user_ocid
45+
fingerprint = var.fingerprint
46+
private_key_path = var.private_key_path
47+
region = var.region
48+
}
49+
resource "oci_golden_gate_connection" "test_connection"{
50+
#Required
51+
compartment_id = var.compartment_id
52+
connection_type = var.connection_type
53+
display_name = var.display_name
54+
55+
#Required for OracleAiDataPlatform connection_type
56+
technology_type = var.technology_type
57+
connection_url = var.connection_url
58+
59+
#Optional
60+
description = var.description
61+
62+
#Optional for OracleAiDataPlatform connection_type
63+
should_use_resource_principal = var.should_use_resource_principal
64+
locks {
65+
type = var.locks_type
66+
message = var.locks_message
67+
}
68+
is_lock_override = var.is_lock_override
69+
lifecycle {
70+
ignore_changes = [defined_tags, locks, freeform_tags, is_lock_override]
71+
}
72+
}

examples/goldengate/Connection/s3/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ resource "oci_golden_gate_connection" "test_connection"{
5555
secret_access_key = var.secret_access_key
5656

5757
description = var.description
58-
freeform_tags = var.freeform_tags
5958

6059
security_attributes = var.security_attributes
6160

internal/integrationtest/golden_gate_connection_test.go

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Following environment variables are required:
3636
- TF_VAR_new_password - new password used for update connection, due to sec central issues, we must use environment variables instead of hardcoded passwords
3737
- TF_VAR_password_secret_id - secret which stores the password used for create connection
3838
- TF_VAR_new_password_secret_id - secret which stores new password used for update connection
39+
- TF_VAR_stream_pool_id - streampool id for oci streaming connection
40+
- TF_VAR_streaming_username - full username including tenant and streampool id for oci streaming connection (e.g. tenant/username/streampoolid)
41+
- TF_VAR_cluster_id - Kafka cluster ocid
42+
- TF_VAR_user_ocid - user ocid
3943
4044
Following environment variables are optional:
4145
- TF_VAR_create_security_attributes - by default the SAs are not created, set this to true if creation should happen
@@ -138,6 +142,7 @@ var (
138142
oci_golden_gate.ConnectionTypeDatabricks,
139143
oci_golden_gate.ConnectionTypeGooglePubsub,
140144
oci_golden_gate.ConnectionTypeMicrosoftFabric,
145+
oci_golden_gate.ConnectionTypeOracleAiDataPlatform,
141146
}
142147

143148
CommonConnectionRepresentation = map[string]interface{}{
@@ -430,6 +435,30 @@ var (
430435
excludedFieldsFromDataCheck: []string{"bootstrap_servers"},
431436
},
432437

438+
// OCI Streaming
439+
{connectionType: oci_golden_gate.ConnectionTypeKafka, technologyType: oci_golden_gate.TechnologyTypeOciStreaming,
440+
representation: map[string]interface{}{
441+
"security_protocol": acctest.Representation{RepType: acctest.Required, Create: string(oci_golden_gate.KafkaConnectionSecurityProtocolSaslSsl)},
442+
"stream_pool_id": acctest.Representation{RepType: acctest.Optional, Create: `${var.stream_pool_id}`},
443+
"should_use_resource_principal": acctest.Representation{RepType: acctest.Optional, Create: `true`},
444+
},
445+
},
446+
447+
// OCI Streaming with Apache Kafka
448+
{connectionType: oci_golden_gate.ConnectionTypeKafka, technologyType: oci_golden_gate.TechnologyTypeOciStreamingWithApacheKafka,
449+
representation: map[string]interface{}{
450+
"security_protocol": acctest.Representation{RepType: acctest.Required, Create: string(oci_golden_gate.KafkaConnectionSecurityProtocolSaslSsl)},
451+
"username": acctest.Representation{RepType: acctest.Optional, Create: `username`, Update: `newUsername`},
452+
"password": acctest.Representation{RepType: acctest.Optional, Create: `${var.password}`, Update: `${var.new_password}`},
453+
"bootstrap_servers": acctest.RepresentationGroup{RepType: acctest.Optional, Group: map[string]interface{}{
454+
"host": acctest.Representation{RepType: acctest.Required, Create: `whatever.fqdn.oraclecloud.com`},
455+
"port": acctest.Representation{RepType: acctest.Required, Create: `9092`},
456+
"private_ip": acctest.Representation{RepType: acctest.Required, Create: `10.0.0.1`},
457+
}},
458+
},
459+
excludedFieldsFromDataCheck: []string{"bootstrap_servers"},
460+
},
461+
433462
// Kafka Schema Registry
434463
{connectionType: oci_golden_gate.ConnectionTypeKafkaSchemaRegistry, technologyType: oci_golden_gate.TechnologyTypeConfluentSchemaRegistry,
435464
representation: map[string]interface{}{
@@ -619,6 +648,21 @@ var (
619648
}},
620649
},
621650
},
651+
652+
// OracleAiDataPlatform
653+
{connectionType: oci_golden_gate.ConnectionTypeOracleAiDataPlatform, technologyType: oci_golden_gate.TechnologyTypeOracleAiDataPlatform,
654+
representation: map[string]interface{}{
655+
"connection_url": acctest.Representation{RepType: acctest.Required, Create: `jdbc:spark://gateway.datalake.us-phoenix-1.oci.oraclecloud.com/default`,
656+
Update: `jdbc:spark://gateway.datalake.us-phoenix-1.oci.oraclecloud.com/default2`},
657+
"user_id": acctest.Representation{RepType: acctest.Required, Update: `${var.user_ocid}`},
658+
"private_key_file_secret_id": acctest.Representation{RepType: acctest.Required, Update: `${var.new_password_secret_id}`},
659+
"public_key_fingerprint": acctest.Representation{RepType: acctest.Required, Update: `myfingerprint`},
660+
"key_id": acctest.Representation{RepType: acctest.Required},
661+
"vault_id": acctest.Representation{RepType: acctest.Required},
662+
"should_use_resource_principal": acctest.Representation{RepType: acctest.Optional, Create: `true`, Update: `false`},
663+
"does_use_secret_ids": acctest.Representation{RepType: acctest.Required, Create: `true`},
664+
},
665+
},
622666
}
623667

624668
ExcludedFields = []string{
@@ -671,7 +715,11 @@ func TestGoldenGateConnectionResource_basic(t *testing.T) {
671715
NEW_PASSWORD_SECRET_ID = "new_password_secret_id"
672716
SUBSCRIPTION_ID = "subscription_id"
673717
CLUSTER_PLACEMENT_GROUP_ID = "cluster_placement_group_id"
674-
SECURITY_ATTRIBUTES = "security_attributes"
718+
SECURITY_ATTRIBUTES = "security_attributes"
719+
STREAM_POOL_ID = "stream_pool_id"
720+
STREAMING_USERNAME = "streaming_username"
721+
CLUSTER_ID = "cluster_id"
722+
USER_ID = "user_ocid"
675723
)
676724

677725
config := acctest.ProviderTestConfig() +
@@ -686,7 +734,11 @@ func TestGoldenGateConnectionResource_basic(t *testing.T) {
686734
makeVariableStr(PASSWORD_SECRET_ID, t) +
687735
makeVariableStr(NEW_PASSWORD_SECRET_ID, t) +
688736
makeVariableStr(SUBSCRIPTION_ID, t) +
689-
makeVariableStr(CLUSTER_PLACEMENT_GROUP_ID, t)
737+
makeVariableStr(CLUSTER_PLACEMENT_GROUP_ID, t) +
738+
makeVariableStr(STREAM_POOL_ID, t) +
739+
makeVariableStr(STREAMING_USERNAME, t) +
740+
makeVariableStr(CLUSTER_ID, t) +
741+
makeVariableStr(USER_ID, t)
690742

691743
var createResourcesConfig, dataSourceConfig, listDataSourceConfig, updateResourcesConfig string
692744
// CREATE CHECK FUNCTION MAPS

internal/service/golden_gate/golden_gate_connection_data_source.go

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,10 @@ func (s *GoldenGateConnectionDataSourceCrud) SetData() error {
17921792
}
17931793
s.D.Set("bootstrap_servers", bootstrapServers)
17941794

1795+
if v.ClusterId != nil {
1796+
s.D.Set("cluster_id", *v.ClusterId)
1797+
}
1798+
17951799
if v.ConsumerProperties != nil {
17961800
s.D.Set("consumer_properties", *v.ConsumerProperties)
17971801
}
@@ -1814,6 +1818,10 @@ func (s *GoldenGateConnectionDataSourceCrud) SetData() error {
18141818

18151819
s.D.Set("security_protocol", v.SecurityProtocol)
18161820

1821+
if v.ShouldUseResourcePrincipal != nil {
1822+
s.D.Set("should_use_resource_principal", *v.ShouldUseResourcePrincipal)
1823+
}
1824+
18171825
if v.SslKeyPasswordSecretId != nil {
18181826
s.D.Set("ssl_key_password_secret_id", *v.SslKeyPasswordSecretId)
18191827
}
@@ -2768,6 +2776,128 @@ func (s *GoldenGateConnectionDataSourceCrud) SetData() error {
27682776
s.D.Set("time_updated", v.TimeUpdated.String())
27692777
}
27702778

2779+
if v.VaultId != nil {
2780+
s.D.Set("vault_id", *v.VaultId)
2781+
}
2782+
case oci_golden_gate.OracleAiDataPlatformConnection:
2783+
s.D.Set("connection_type", "ORACLE_AI_DATA_PLATFORM")
2784+
2785+
if v.ConnectionUrl != nil {
2786+
s.D.Set("connection_url", *v.ConnectionUrl)
2787+
}
2788+
2789+
if v.PrivateKeyFileSecretId != nil {
2790+
s.D.Set("private_key_file_secret_id", *v.PrivateKeyFileSecretId)
2791+
}
2792+
2793+
if v.PrivateKeyPassphraseSecretId != nil {
2794+
s.D.Set("private_key_passphrase_secret_id", *v.PrivateKeyPassphraseSecretId)
2795+
}
2796+
2797+
if v.PublicKeyFingerprint != nil {
2798+
s.D.Set("public_key_fingerprint", *v.PublicKeyFingerprint)
2799+
}
2800+
2801+
if v.Region != nil {
2802+
s.D.Set("region", *v.Region)
2803+
}
2804+
2805+
if v.ShouldUseResourcePrincipal != nil {
2806+
s.D.Set("should_use_resource_principal", *v.ShouldUseResourcePrincipal)
2807+
}
2808+
2809+
s.D.Set("technology_type", v.TechnologyType)
2810+
2811+
if v.TenancyId != nil {
2812+
s.D.Set("tenancy_id", *v.TenancyId)
2813+
}
2814+
2815+
if v.UserId != nil {
2816+
s.D.Set("user_id", *v.UserId)
2817+
}
2818+
2819+
if v.ClusterPlacementGroupId != nil {
2820+
s.D.Set("cluster_placement_group_id", *v.ClusterPlacementGroupId)
2821+
}
2822+
2823+
if v.CompartmentId != nil {
2824+
s.D.Set("compartment_id", *v.CompartmentId)
2825+
}
2826+
2827+
if v.DefinedTags != nil {
2828+
s.D.Set("defined_tags", tfresource.DefinedTagsToMap(v.DefinedTags))
2829+
}
2830+
2831+
if v.Description != nil {
2832+
s.D.Set("description", *v.Description)
2833+
}
2834+
2835+
if v.DisplayName != nil {
2836+
s.D.Set("display_name", *v.DisplayName)
2837+
}
2838+
2839+
if v.DoesUseSecretIds != nil {
2840+
s.D.Set("does_use_secret_ids", *v.DoesUseSecretIds)
2841+
}
2842+
2843+
s.D.Set("freeform_tags", v.FreeformTags)
2844+
2845+
ingressIps := []interface{}{}
2846+
for _, item := range v.IngressIps {
2847+
ingressIps = append(ingressIps, IngressIpDetailsToMap(item))
2848+
}
2849+
s.D.Set("ingress_ips", ingressIps)
2850+
2851+
if v.KeyId != nil {
2852+
s.D.Set("key_id", *v.KeyId)
2853+
}
2854+
2855+
if v.LifecycleDetails != nil {
2856+
s.D.Set("lifecycle_details", *v.LifecycleDetails)
2857+
}
2858+
2859+
locks := []interface{}{}
2860+
for _, item := range v.Locks {
2861+
locks = append(locks, ResourceLockToMap(item))
2862+
}
2863+
s.D.Set("locks", locks)
2864+
2865+
nsgIds := []interface{}{}
2866+
for _, item := range v.NsgIds {
2867+
nsgIds = append(nsgIds, item)
2868+
}
2869+
s.D.Set("nsg_ids", nsgIds)
2870+
2871+
s.D.Set("routing_method", v.RoutingMethod)
2872+
2873+
if v.SecurityAttributes != nil {
2874+
s.D.Set("security_attributes", tfresource.SecurityAttributesToMap(v.SecurityAttributes))
2875+
}
2876+
2877+
s.D.Set("state", v.LifecycleState)
2878+
2879+
if v.SubnetId != nil {
2880+
s.D.Set("subnet_id", *v.SubnetId)
2881+
}
2882+
2883+
if v.SubscriptionId != nil {
2884+
s.D.Set("subscription_id", *v.SubscriptionId)
2885+
}
2886+
2887+
if v.SystemTags != nil {
2888+
s.D.Set("system_tags", tfresource.SystemTagsToMap(v.SystemTags))
2889+
}
2890+
2891+
s.D.Set("technology_type", v.TechnologyType)
2892+
2893+
if v.TimeCreated != nil {
2894+
s.D.Set("time_created", v.TimeCreated.String())
2895+
}
2896+
2897+
if v.TimeUpdated != nil {
2898+
s.D.Set("time_updated", v.TimeUpdated.String())
2899+
}
2900+
27712901
if v.VaultId != nil {
27722902
s.D.Set("vault_id", *v.VaultId)
27732903
}

0 commit comments

Comments
 (0)