diff --git a/builder/oracle/oci/config.go b/builder/oracle/oci/config.go index d56cb7375..0277518a5 100644 --- a/builder/oracle/oci/config.go +++ b/builder/oracle/oci/config.go @@ -1,4 +1,4 @@ -//go:generate mapstructure-to-hcl2 -type Config,CreateVnicDetailsRaw +//go:generate mapstructure-to-hcl2 -type Config,CreateVNICDetails package oci @@ -22,7 +22,7 @@ import ( ociauth "github.com/oracle/oci-go-sdk/common/auth" ) -type CreateVnicDetailsRaw struct { +type CreateVNICDetails struct { // fields that can be specified under "create_vnic_details" AssignPublicIp *bool `mapstructure:"assign_public_ip" required:"false"` DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags" required:"false"` @@ -90,8 +90,8 @@ type Config struct { UserDataFile string `mapstructure:"user_data_file"` // Networking - SubnetID string `mapstructure:"subnet_ocid"` - CreateVnicDetails CreateVnicDetailsRaw `mapstructure:"create_vnic_details"` + SubnetID string `mapstructure:"subnet_ocid"` + CreateVnicDetails CreateVNICDetails `mapstructure:"create_vnic_details"` // Tagging Tags map[string]string `mapstructure:"tags"` diff --git a/builder/oracle/oci/config.hcl2spec.go b/builder/oracle/oci/config.hcl2spec.go index 39570d46b..21afb0d92 100644 --- a/builder/oracle/oci/config.hcl2spec.go +++ b/builder/oracle/oci/config.hcl2spec.go @@ -1,4 +1,4 @@ -// Code generated by "mapstructure-to-hcl2 -type Config,CreateVnicDetailsRaw"; DO NOT EDIT. +// Code generated by "mapstructure-to-hcl2 -type Config,CreateVNICDetails"; DO NOT EDIT. package oci import ( @@ -85,7 +85,7 @@ type FlatConfig struct { UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"` UserDataFile *string `mapstructure:"user_data_file" cty:"user_data_file" hcl:"user_data_file"` SubnetID *string `mapstructure:"subnet_ocid" cty:"subnet_ocid" hcl:"subnet_ocid"` - CreateVnicDetails *FlatCreateVnicDetailsRaw `mapstructure:"create_vnic_details" cty:"create_vnic_details" hcl:"create_vnic_details"` + CreateVnicDetails *FlatCreateVNICDetails `mapstructure:"create_vnic_details" cty:"create_vnic_details" hcl:"create_vnic_details"` Tags map[string]string `mapstructure:"tags" cty:"tags" hcl:"tags"` DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags" cty:"defined_tags" hcl:"defined_tags"` } @@ -178,16 +178,16 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "user_data": &hcldec.AttrSpec{Name: "user_data", Type: cty.String, Required: false}, "user_data_file": &hcldec.AttrSpec{Name: "user_data_file", Type: cty.String, Required: false}, "subnet_ocid": &hcldec.AttrSpec{Name: "subnet_ocid", Type: cty.String, Required: false}, - "create_vnic_details": &hcldec.BlockSpec{TypeName: "create_vnic_details", Nested: hcldec.ObjectSpec((*FlatCreateVnicDetailsRaw)(nil).HCL2Spec())}, + "create_vnic_details": &hcldec.BlockSpec{TypeName: "create_vnic_details", Nested: hcldec.ObjectSpec((*FlatCreateVNICDetails)(nil).HCL2Spec())}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, "defined_tags": &hcldec.AttrSpec{Name: "defined_tags", Type: cty.Map(cty.String), Required: false}, } return s } -// FlatCreateVnicDetailsRaw is an auto-generated flat version of CreateVnicDetailsRaw. +// FlatCreateVNICDetails is an auto-generated flat version of CreateVNICDetails. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. -type FlatCreateVnicDetailsRaw struct { +type FlatCreateVNICDetails struct { AssignPublicIp *bool `mapstructure:"assign_public_ip" required:"false" cty:"assign_public_ip" hcl:"assign_public_ip"` DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags" required:"false" cty:"defined_tags" hcl:"defined_tags"` DisplayName *string `mapstructure:"display_name" required:"false" cty:"display_name" hcl:"display_name"` @@ -199,17 +199,17 @@ type FlatCreateVnicDetailsRaw struct { SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"` } -// FlatMapstructure returns a new FlatCreateVnicDetailsRaw. -// FlatCreateVnicDetailsRaw is an auto-generated flat version of CreateVnicDetailsRaw. +// FlatMapstructure returns a new FlatCreateVNICDetails. +// FlatCreateVNICDetails is an auto-generated flat version of CreateVNICDetails. // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. -func (*CreateVnicDetailsRaw) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { - return new(FlatCreateVnicDetailsRaw) +func (*CreateVNICDetails) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatCreateVNICDetails) } -// HCL2Spec returns the hcl spec of a CreateVnicDetailsRaw. -// This spec is used by HCL to read the fields of CreateVnicDetailsRaw. -// The decoded values from this spec will then be applied to a FlatCreateVnicDetailsRaw. -func (*FlatCreateVnicDetailsRaw) HCL2Spec() map[string]hcldec.Spec { +// HCL2Spec returns the hcl spec of a CreateVNICDetails. +// This spec is used by HCL to read the fields of CreateVNICDetails. +// The decoded values from this spec will then be applied to a FlatCreateVNICDetails. +func (*FlatCreateVNICDetails) HCL2Spec() map[string]hcldec.Spec { s := map[string]hcldec.Spec{ "assign_public_ip": &hcldec.AttrSpec{Name: "assign_public_ip", Type: cty.Bool, Required: false}, "defined_tags": &hcldec.AttrSpec{Name: "defined_tags", Type: cty.Map(cty.String), Required: false}, diff --git a/builder/oracle/oci/config_test.go b/builder/oracle/oci/config_test.go index 22ac18172..2f85b7a8d 100644 --- a/builder/oracle/oci/config_test.go +++ b/builder/oracle/oci/config_test.go @@ -21,7 +21,6 @@ func testConfig(accessConfFile *os.File) map[string]interface{} { // Image "base_image_ocid": "ocd1...", - "shape": "VM.Standard1.1", "image_name": "HelloWorld", // Networking @@ -36,6 +35,16 @@ func testConfig(accessConfFile *os.File) map[string]interface{} { "defined_tags": map[string]map[string]interface{}{ "namespace": {"key": "value"}, }, + + // Instance Details + "instance_name": "hello-world", + "instance_tags": map[string]string{ + "key": "value", + }, + "create_vnic_details": map[string]interface{}{ + "nsg_ids": []string{"ocd1..."}, + }, + "shape": "VM.Standard1.1", } } diff --git a/website/pages/docs/builders/oracle/oci.mdx b/website/pages/docs/builders/oracle/oci.mdx index f4e7e8c88..d44441efc 100644 --- a/website/pages/docs/builders/oracle/oci.mdx +++ b/website/pages/docs/builders/oracle/oci.mdx @@ -281,7 +281,7 @@ are listed in `nsg_ids` under `create_vnic_details`. "Team": "CostCenter", "Environment": "prod" } - } + }, "create_vnic_details": { "assign_public_ip": "false", "display_name": "testing-123",