fix (builder/oracle-oci): remove subnet from LaunchInstanceDetails

Deprecated use. Use subnet in CreateVnicDetails instead.
This commit is contained in:
js-g 2020-10-20 22:11:29 -04:00
parent c3ffb3dc22
commit ba6173b84c
2 changed files with 8 additions and 2 deletions

View File

@ -276,11 +276,18 @@ func (c *Config) Prepare(raws ...interface{}) error {
errs, errors.New("'shape' must be specified"))
}
if c.SubnetID == "" {
if (c.SubnetID == "") && (c.CreateVnicDetails.SubnetId == nil) {
errs = packer.MultiErrorAppend(
errs, errors.New("'subnet_ocid' must be specified"))
}
if c.CreateVnicDetails.SubnetId == nil {
c.CreateVnicDetails.SubnetId = &c.SubnetID
} else if (*c.CreateVnicDetails.SubnetId != c.SubnetID) && (c.SubnetID != "") {
errs = packer.MultiErrorAppend(
errs, errors.New("'create_vnic_details[subnet]' must match 'subnet_ocid' if both are specified"))
}
if (c.BaseImageID == "") && (c.BaseImageFilter == ListImagesRequest{}) {
errs = packer.MultiErrorAppend(
errs, errors.New("'base_image_ocid' or 'base_image_filter' must be specified"))

View File

@ -124,7 +124,6 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
FreeformTags: d.cfg.InstanceTags,
Shape: &d.cfg.Shape,
SourceDetails: InstanceSourceDetails,
SubnetId: &d.cfg.SubnetID,
Metadata: metadata,
}