Merge pull request #4896 from remijouannet/f-amazon_builder_custom_endpoint

add an option custom_endpoint_ec2 for amazon builder, add a condition…
pull/4816/merge
Matthew Hooker 9 years ago committed by GitHub
commit 710010fbe0

@ -17,12 +17,13 @@ import (
// AccessConfig is for common configuration related to AWS access
type AccessConfig struct {
AccessKey string `mapstructure:"access_key"`
SecretKey string `mapstructure:"secret_key"`
RawRegion string `mapstructure:"region"`
SkipValidation bool `mapstructure:"skip_region_validation"`
Token string `mapstructure:"token"`
ProfileName string `mapstructure:"profile"`
AccessKey string `mapstructure:"access_key"`
SecretKey string `mapstructure:"secret_key"`
RawRegion string `mapstructure:"region"`
SkipValidation bool `mapstructure:"skip_region_validation"`
Token string `mapstructure:"token"`
ProfileName string `mapstructure:"profile"`
CustomEndpointEc2 string `mapstructure:"custom_endpoint_ec2"`
}
// Config returns a valid aws.Config object for access to AWS services, or
@ -35,6 +36,11 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
return nil, err
}
config := aws.NewConfig().WithRegion(region).WithMaxRetries(11)
if c.CustomEndpointEc2 != "" {
config.Endpoint = &c.CustomEndpointEc2
}
if c.ProfileName != "" {
profile, err := NewFromProfile(c.ProfileName)
if err != nil {

@ -55,8 +55,12 @@ func (s *StepSecurityGroup) Run(state multistep.StateBag) multistep.StepAction {
group := &ec2.CreateSecurityGroupInput{
GroupName: &groupName,
Description: aws.String("Temporary group for Packer"),
VpcId: &s.VpcId,
}
if s.VpcId != "" {
group.VpcId = &s.VpcId
}
groupResp, err := ec2conn.CreateSecurityGroup(group)
if err != nil {
ui.Error(err.Error())

@ -278,6 +278,9 @@ each category, the available configuration keys are alphabetized.
`BuildRegion` variable is replaced with name of the region where this
is built.
- `custom_endpoint_ec2` (string) - this option is useful if you use
another cloud provider that provide a compatible API with aws EC2,
specify another endpoint like this "https://ec2.another.endpoint..com"
## Basic Example

@ -334,6 +334,10 @@ builder.
- `windows_password_timeout` (string) - The timeout for waiting for a Windows
password for Windows instances. Defaults to 20 minutes. Example value: `10m`
- `custom_endpoint_ec2` (string) - this option is useful if you use
another cloud provider that provide a compatible API with aws EC2,
specify another endpoint like this "https://ec2.another.endpoint..com"
## Basic Example
Here is a basic example. You will need to provide access keys, and may need to

@ -326,6 +326,10 @@ builder.
- `windows_password_timeout` (string) - The timeout for waiting for a Windows
password for Windows instances. Defaults to 20 minutes. Example value: `10m`
- `custom_endpoint_ec2` (string) - this option is useful if you use
another cloud provider that provide a compatible API with aws EC2,
specify another endpoint like this "https://ec2.another.endpoint..com"
## Basic Example
```json

@ -226,6 +226,11 @@ builder.
- `windows_password_timeout` (string) - The timeout for waiting for a Windows
password for Windows instances. Defaults to 20 minutes. Example value: `10m`
- `custom_endpoint_ec2` (string) - this option is useful if you use
another cloud provider that provide a compatible API with aws EC2,
specify another endpoint like this "https://ec2.another.endpoint..com"
## Basic Example
```json

@ -336,6 +336,10 @@ builder.
- `windows_password_timeout` (string) - The timeout for waiting for a Windows
password for Windows instances. Defaults to 20 minutes. Example value: `10m`
- `custom_endpoint_ec2` (string) - this option is useful if you use
another cloud provider that provide a compatible API with aws EC2,
specify another endpoint like this "https://ec2.another.endpoint..com"
## Basic Example
Here is a basic example. It is completely valid except for the access keys:

Loading…
Cancel
Save