Incorporate review comments

This commit is contained in:
xxx 2018-07-17 17:41:19 +02:00
parent 22e5523faa
commit 7630268e1d
4 changed files with 11 additions and 6 deletions

View File

@ -48,8 +48,12 @@ type Config struct {
// Instance
InstanceName string `mapstructure:"instance_name"`
// MetaData is optional but will be constructed to include UserData or UserDataFile under the "user_data" key
MetaData map[string]string `mapstructure:"metadata"`
// Metadata optionally contains custom metadata key/value pairs provided in the
// configuration. While this can be used to set metadata["user_data"] the explicit
// "user_data" and "user_data_file" values will have precedence.
// An instance's metadata can be obtained from at http://169.254.169.254 on the
// launched instance.
Metadata map[string]string `mapstructure:"metadata"`
// UserData and UserDataFile file are both optional and mutually exclusive.
UserData string `mapstructure:"user_data"`

View File

@ -238,7 +238,6 @@ func TestConfig(t *testing.T) {
t.Errorf("Expected ConfigProvider.KeyFingerprint: %s, got %s", expected, fingerprint)
}
})
}
// BaseTestConfig creates the base (DEFAULT) config including a temporary key

View File

@ -42,8 +42,8 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
metadata := map[string]string{
"ssh_authorized_keys": publicKey,
}
if d.cfg.MetaData != nil {
for key, value := range d.cfg.MetaData {
if d.cfg.Metadata != nil {
for key, value := range d.cfg.Metadata {
metadata[key] = value
}
}

View File

@ -125,7 +125,9 @@ builder.
- `use_private_ip` (boolean) - Use private ip addresses to connect to the instance via ssh.
- `metadata` (map of strings) - Metadata to be injected in the build instance.
- `metadata` (map of strings) - Metadata optionally contains custom metadata key/value pairs provided in the
configuration. While this can be used to set metadata["user_data"] the explicit "user_data" and "user_data_file" values will have precedence. An instance's metadata can be obtained from at http://169.254.169.254 on the
launched instance.
- `user_data` (string) - user_data to be used by cloud
init. See [the Oracle docs](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails) for more details. Generally speaking, it is easier to use the `user_data_file`,