Add source AMI owner ID/name to build template.
This commit is contained in:
parent
0649c3f7dc
commit
47e48ebc24
|
@ -10,6 +10,8 @@ type BuildInfoTemplate struct {
|
|||
BuildRegion string
|
||||
SourceAMI string
|
||||
SourceAMIName string
|
||||
SourceAMIOwner string
|
||||
SourceAMIOwnerName string
|
||||
SourceAMITags map[string]string
|
||||
}
|
||||
|
||||
|
@ -31,6 +33,8 @@ func extractBuildInfo(region string, state multistep.StateBag) *BuildInfoTemplat
|
|||
BuildRegion: region,
|
||||
SourceAMI: aws.StringValue(sourceAMI.ImageId),
|
||||
SourceAMIName: aws.StringValue(sourceAMI.Name),
|
||||
SourceAMIOwner: aws.StringValue(sourceAMI.OwnerId),
|
||||
SourceAMIOwnerName: aws.StringValue(sourceAMI.ImageOwnerAlias),
|
||||
SourceAMITags: sourceAMITags,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ func testImage() *ec2.Image {
|
|||
return &ec2.Image{
|
||||
ImageId: aws.String("ami-abcd1234"),
|
||||
Name: aws.String("ami_test_name"),
|
||||
OwnerId: aws.String("ami_test_owner_id"),
|
||||
ImageOwnerAlias: aws.String("ami_test_owner_alias"),
|
||||
Tags: []*ec2.Tag{
|
||||
{
|
||||
Key: aws.String("key-1"),
|
||||
|
@ -52,6 +54,8 @@ func TestInterpolateBuildInfo_extractBuildInfo_withSourceImage(t *testing.T) {
|
|||
BuildRegion: "foo",
|
||||
SourceAMI: "ami-abcd1234",
|
||||
SourceAMIName: "ami_test_name",
|
||||
SourceAMIOwner: "ami_test_owner_id",
|
||||
SourceAMIOwnerName: "ami_test_owner_alias",
|
||||
SourceAMITags: map[string]string{
|
||||
"key-1": "value-1",
|
||||
"key-2": "value-2",
|
||||
|
|
|
@ -287,4 +287,6 @@ variables are available:
|
|||
- `SourceAMIName` - The source AMI Name (for example
|
||||
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
|
||||
build the AMI.
|
||||
- `SourceAMIOwner` - The source AMI owner ID.
|
||||
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
|
||||
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
|
||||
|
|
|
@ -194,6 +194,8 @@ variables are available:
|
|||
- `SourceAMIName` - The source AMI Name (for example
|
||||
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
|
||||
build the AMI.
|
||||
- `SourceAMIOwner` - The source AMI owner ID.
|
||||
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
|
||||
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
|
||||
|
||||
## Tag Example
|
||||
|
|
|
@ -157,6 +157,8 @@ variables are available:
|
|||
- `SourceAMIName` - The source AMI Name (for example
|
||||
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
|
||||
build the AMI.
|
||||
- `SourceAMIOwner` - The source AMI owner ID.
|
||||
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
|
||||
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
|
||||
|
||||
-> **Note:** Packer uses pre-built AMIs as the source for building images.
|
||||
|
|
|
@ -176,6 +176,8 @@ variables are available:
|
|||
- `SourceAMIName` - The source AMI Name (for example
|
||||
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
|
||||
build the AMI.
|
||||
- `SourceAMIOwner` - The source AMI owner ID.
|
||||
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
|
||||
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
|
||||
|
||||
-> **Note:** Packer uses pre-built AMIs as the source for building images.
|
||||
|
|
|
@ -159,6 +159,8 @@ variables are available:
|
|||
- `SourceAMIName` - The source AMI Name (for example
|
||||
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
|
||||
build the AMI.
|
||||
- `SourceAMIOwner` - The source AMI owner ID.
|
||||
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
|
||||
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
|
||||
|
||||
## Custom Bundle Commands
|
||||
|
|
Loading…
Reference in New Issue