fix (builder/oracle-oci): remove subnet from LaunchInstanceDetails
Deprecated use. Use subnet in CreateVnicDetails instead.
This commit is contained in:
parent
c3ffb3dc22
commit
ba6173b84c
|
@ -276,11 +276,18 @@ func (c *Config) Prepare(raws ...interface{}) error {
|
||||||
errs, errors.New("'shape' must be specified"))
|
errs, errors.New("'shape' must be specified"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.SubnetID == "" {
|
if (c.SubnetID == "") && (c.CreateVnicDetails.SubnetId == nil) {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs, errors.New("'subnet_ocid' must be specified"))
|
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{}) {
|
if (c.BaseImageID == "") && (c.BaseImageFilter == ListImagesRequest{}) {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs, errors.New("'base_image_ocid' or 'base_image_filter' must be specified"))
|
errs, errors.New("'base_image_ocid' or 'base_image_filter' must be specified"))
|
||||||
|
|
|
@ -124,7 +124,6 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
|
||||||
FreeformTags: d.cfg.InstanceTags,
|
FreeformTags: d.cfg.InstanceTags,
|
||||||
Shape: &d.cfg.Shape,
|
Shape: &d.cfg.Shape,
|
||||||
SourceDetails: InstanceSourceDetails,
|
SourceDetails: InstanceSourceDetails,
|
||||||
SubnetId: &d.cfg.SubnetID,
|
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue