Skip to content

Commit fb4db21

Browse files
committed
feat(Legacy_Vendor_Images): terraform fixed review comments
1 parent 0729fa7 commit fb4db21

File tree

3 files changed

+26
-29
lines changed

3 files changed

+26
-29
lines changed

ibm/service/vpc/data_source_ibm_is_image.go

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -437,24 +437,14 @@ func imageGetById(d *schema.ResourceData, meta interface{}, identifier string) e
437437
fmt.Printf("[WARN] Given image %s is deprecated and soon will be obsolete.", name)
438438
}
439439

440-
if image.Remote != nil && image.Remote.Account != nil {
441-
accountMap := map[string]interface{}{}
442-
443-
if image.Remote.Account.ID != nil {
444-
accountMap["id"] = *image.Remote.Account.ID
445-
}
446-
if image.Remote.Account.ResourceType != nil {
447-
accountMap["resource_type"] = *image.Remote.Account.ResourceType
448-
}
449-
450-
remoteMap := map[string]interface{}{
451-
"account": []interface{}{accountMap},
452-
}
453-
remoteList := []interface{}{remoteMap}
454-
455-
if err := d.Set(isImageRemote, remoteList); err != nil {
456-
return fmt.Errorf("error setting image remote: %s", err)
440+
if image.Remote != nil {
441+
imageRemoteList := []map[string]interface{}{}
442+
imageRemoteMap, err := dataSourceImageRemote(*image)
443+
if err != nil {
444+
return err
457445
}
446+
imageRemoteList = append(imageRemoteList, imageRemoteMap)
447+
d.Set(isImageRemote, imageRemoteList)
458448
}
459449

460450
if len(image.StatusReasons) > 0 {

website/docs/d/is_image.html.markdown

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ In addition to all argument reference list, you can access the following attribu
104104

105105
- `source_volume` - The source volume id of the image.
106106
- `user_data_format` - (String) The user data format for this image.
107-
- `remote` - (Optional, List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable.
108-
Nested schema for **remote**:
109-
- `account` - (Optional, List) If present, this property indicates that the referenced resource is remote to thisaccount, and identifies the owning account.
110-
Nested schema for **account**:
111-
- `id` - (Computed, String) The unique identifier for this account.
112-
- `resource_type` - (Computed, String) The resource type.
107+
- `remote` - (Optional, List) If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.
108+
109+
**Nested schema for `remote`:**
110+
- `account` - (Optional, List) Indicates that the referenced resource is remote to this account, and identifies the owning account.
111+
112+
**Nested schema for `account`:**
113+
- `id` – (Computed, String) The unique identifier for this account.
114+
- `resource_type` – (Computed, String) The resource type.
115+
113116

114117
~> **Note:** </br> Supported values are : </br>
115118
**&#x2022;** `cloud_init`: user_data will be interpreted according to the cloud-init standard.</br>

website/docs/d/is_images.html.markdown

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,15 @@ You can access the following attribute references after your data source is crea
111111
- `more_info` - (String) Link to documentation about this status reason
112112
- `visibility` - (String) The visibility of the image public or private.
113113
- `source_volume` - The source volume id of the image.
114-
- `remote` - (Optional, List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable.
115-
Nested schema for **remote**:
116-
- `account` - (Optional, List) If present, this property indicates that the referenced resource is remote to thisaccount, and identifies the owning account.
117-
Nested schema for **account**:
118-
- `id` - (Computed, String) The unique identifier for this account.
119-
- `resource_type` - (Computed, String) The resource type.
114+
- `remote` - (Optional, List) If present, this property indicates that the resource associated with this reference is remote and therefore may not be directly retrievable.
115+
116+
**Nested schema for `remote`:**
117+
- `account` - (Optional, List) Indicates that the referenced resource is remote to this account, and identifies the owning account.
118+
119+
**Nested schema for `account`:**
120+
- `id` – (Computed, String) The unique identifier for this account.
121+
- `resource_type` – (Computed, String) The resource type.
122+
123+
120124
121125

0 commit comments

Comments
 (0)