-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Tags in Instance, Inst Temp, Inst Vol Attmnt #3993
Conversation
@hkantare we have reviewed internally this feature please find the PR ibm-vpc#162 here.. Can you please review and merge this PR... |
@@ -597,6 +614,9 @@ func dataSourceIBMISInstanceTemplateRead(context context.Context, d *schema.Reso | |||
volProfInst := volProfIntf.(*vpcv1.VolumeProfileIdentity) | |||
bootVol[isInstanceTemplateBootProfile] = volProfInst.Name | |||
} | |||
if instance.BootVolumeAttachment.Volume.UserTags != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check if any
instance.BootVolumeAttachment != nil && instance.BootVolumeAttachment.Volume != nil && instance.BootVolumeAttachment.Volume.UserTags != nil ..just to eliminate possibility of nil pointer expection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the nill checks have happened in the above if lines..
if instance.BootVolumeAttachment != nil {
bootVolList := make([]map[string]interface{}, 0)
bootVol := map[string]interface{}{}
bootVol[isInstanceTemplateDeleteVol] = *instance.BootVolumeAttachment.DeleteVolumeOnInstanceDelete
if instance.BootVolumeAttachment.Volume != nil {
volumeIntf := instance.BootVolumeAttachment.Volume
bootVol[isInstanceTemplateName] = volumeIntf.Name
bootVol[isInstanceTemplateVol] = volumeIntf.Name
bootVol[isInstanceTemplateBootSize] = volumeIntf.Capacity
if instance.BootVolumeAttachment.Volume.Profile != nil {
volProfIntf := instance.BootVolumeAttachment.Volume.Profile
volProfInst := volProfIntf.(*vpcv1.VolumeProfileIdentity)
bootVol[isInstanceTemplateBootProfile] = volProfInst.Name
}
if instance.BootVolumeAttachment.Volume.UserTags != nil {
bootVol[isInstanceTemplateBootVolumeTags] = instance.BootVolumeAttachment.Volume.UserTags
}
}
bootVolList = append(bootVolList, bootVol)
d.Set(isInstanceTemplateBootVolumeAttachment, bootVolList)
}
isInstanceTemplateVolAttTags: { | ||
Type: schema.TypeSet, | ||
Optional: true, | ||
ForceNew: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why forcenew to true we don't have update support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No harini, other fields in the same block has the same structure.
https://pages.github.ibm.com/vpc/vpc-spec-artifacts/branch/master/public/2022-03-29.html#/Instances/update_instance_template
isInstanceTemplateVolAttVolPrototype: {
Type: schema.TypeList,
MaxItems: 1,
MinItems: 1,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
isInstanceTemplateVolAttVolIops: {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Description: "The maximum I/O operations per second (IOPS) for the volume.",
},
.
.
..
.
.
isInstanceTemplateVolAttTags: {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_volume", "tags")},
Set: flex.ResourceIBMVPCHash,
Description: "UserTags for the volume instance",
},
},
},
},
@@ -437,6 +448,14 @@ func ResourceIBMISInstanceTemplate() *schema.Resource { | |||
Optional: true, | |||
Computed: true, | |||
}, | |||
isInstanceTemplateBootVolumeTags: { | |||
Type: schema.TypeSet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have update support here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://pages.github.ibm.com/vpc/vpc-spec-artifacts/branch/master/public/2022-03-29.html#/Instances/update_instance_template
We dont have update support here.. which is similar behaviour with the other fields.
Test existing basic testcases also and share the results |
c018194
to
d2a00b5
Compare
Community Note
Relates OR Closes #0000
Output from acceptance testing:
data "ibm_is_instance_template" "instance_template_data" {
name = "cli-tpl-1"
}
data "ibm_is_instance_templates" "instance_templates_data" {
}