Skip to content

Commit 5f898da

Browse files
committed
DLPXECO-11763| added support to import appdata dsource
1 parent cdddead commit 5f898da

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

internal/provider/commons.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,5 @@ var updatableAppdataDsourceKeys = map[string]bool{
151151
"ops_post_sync": true,
152152
"tags": true,
153153
"ignore_tag_changes": true,
154+
"rollback_on_failure": true,
154155
}

internal/provider/resource_appdata_dsource.go

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@ func resourceAppdataDsource() *schema.Resource {
3535
},
3636
"source_value": {
3737
Type: schema.TypeString,
38-
Required: true,
38+
Optional: true,
39+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
40+
if oldValue != newValue {
41+
tflog.Info(context.Background(), "updating source_value is not allowed. plan changes are suppressed")
42+
}
43+
return d.Id() != ""
44+
},
3945
},
4046
"group_id": {
4147
Type: schema.TypeString,
42-
Required: true,
48+
Optional: true,
49+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
50+
if oldValue != newValue {
51+
tflog.Info(context.Background(), "updating group_id is not allowed. plan changes are suppressed")
52+
}
53+
return d.Id() != ""
54+
},
4355
},
4456
"sync_policy_id": {
4557
Type: schema.TypeString,
@@ -65,23 +77,30 @@ func resourceAppdataDsource() *schema.Resource {
6577
},
6678
"link_type": {
6779
Type: schema.TypeString,
68-
Required: true,
80+
Optional: true,
81+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
82+
tflog.Info(context.Background(), "In DiffSuppressFunc of link_type")
83+
if oldValue != newValue {
84+
tflog.Info(context.Background(), "updating link_type is not allowed. plan changes are suppressed")
85+
}
86+
return d.Id() != ""
87+
},
6988
},
7089
"staging_mount_base": {
7190
Type: schema.TypeString,
72-
Required: true,
91+
Optional: true,
7392
},
7493
"staging_environment": {
7594
Type: schema.TypeString,
76-
Required: true,
95+
Optional: true,
7796
},
7897
"staging_environment_user": {
7998
Type: schema.TypeString,
8099
Optional: true,
81100
},
82101
"environment_user": {
83102
Type: schema.TypeString,
84-
Required: true,
103+
Optional: true,
85104
},
86105
"ignore_tag_changes": {
87106
Type: schema.TypeBool,
@@ -287,11 +306,17 @@ func resourceAppdataDsource() *schema.Resource {
287306
},
288307
"parameters": {
289308
Type: schema.TypeString,
290-
Required: true,
309+
Optional: true,
291310
},
292311
"sync_parameters": {
293312
Type: schema.TypeString,
294-
Required: true,
313+
Optional: true,
314+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
315+
if oldValue != newValue {
316+
tflog.Info(context.Background(), "updating sync_parameters is not allowed. plan changes are suppressed")
317+
}
318+
return d.Id() != ""
319+
},
295320
},
296321
// Output
297322
"id": {
@@ -393,6 +418,9 @@ func resourceAppdataDsource() *schema.Resource {
393418
},
394419
},
395420
},
421+
Importer: &schema.ResourceImporter{
422+
StateContext: schema.ImportStatePassthroughContext,
423+
},
396424
}
397425
}
398426

0 commit comments

Comments
 (0)