Support defined tags for oci builder
This commit is contained in:
parent
2c9615a3e3
commit
70b2d300e6
|
@ -63,7 +63,8 @@ type Config struct {
|
||||||
SubnetID string `mapstructure:"subnet_ocid"`
|
SubnetID string `mapstructure:"subnet_ocid"`
|
||||||
|
|
||||||
// Tagging
|
// Tagging
|
||||||
Tags map[string]string `mapstructure:"tags"`
|
Tags map[string]string `mapstructure:"tags"`
|
||||||
|
DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags"`
|
||||||
|
|
||||||
ctx interpolate.Context
|
ctx interpolate.Context
|
||||||
}
|
}
|
||||||
|
@ -207,6 +208,9 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if c.DefinedTags != nil {
|
||||||
|
// }
|
||||||
|
|
||||||
if c.ImageName == "" {
|
if c.ImageName == "" {
|
||||||
name, err := interpolate.Render("packer-{{timestamp}}", nil)
|
name, err := interpolate.Render("packer-{{timestamp}}", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,6 +32,9 @@ func testConfig(accessConfFile *os.File) map[string]interface{} {
|
||||||
"metadata": map[string]string{
|
"metadata": map[string]string{
|
||||||
"key": "value",
|
"key": "value",
|
||||||
},
|
},
|
||||||
|
"defined_tags": map[string]map[string]interface{}{
|
||||||
|
"namespace": {"key": "value"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ func (d *driverOCI) CreateImage(ctx context.Context, id string) (core.Image, err
|
||||||
InstanceId: &id,
|
InstanceId: &id,
|
||||||
DisplayName: &d.cfg.ImageName,
|
DisplayName: &d.cfg.ImageName,
|
||||||
FreeformTags: d.cfg.Tags,
|
FreeformTags: d.cfg.Tags,
|
||||||
|
DefinedTags: d.cfg.DefinedTags,
|
||||||
}})
|
}})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -161,6 +161,19 @@ builder.
|
||||||
"tag2": "value2"
|
"tag2": "value2"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `defined_tags` (map of map of strings) - Add one or more defined tags for a given namespace to the resulting
|
||||||
|
custom image. See [the Oracle
|
||||||
|
docs](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm)
|
||||||
|
for more details. Example:
|
||||||
|
|
||||||
|
``` {.yaml}
|
||||||
|
"tags":
|
||||||
|
"namespace": {
|
||||||
|
"tag1": "value1",
|
||||||
|
"tag2": "value2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Basic Example
|
## Basic Example
|
||||||
|
|
||||||
Here is a basic example. Note that account specific configuration has been
|
Here is a basic example. Note that account specific configuration has been
|
||||||
|
|
Loading…
Reference in New Issue