Mark instance security groups as replaces
Altering an instance's security group list used to imply a replace, but it must have gotten broken somewhere along the line during the IDL updates. (We desperately need those test cases...) For now, we will mark the groups as `replaces, and when we get around to pulumi/lumi#187, we'll fix this.
This commit is contained in:
parent
4ec2745fc1
commit
8de9411697
4 changed files with 7 additions and 4 deletions
|
@ -28,7 +28,7 @@ type Instance struct {
|
|||
// The instance type, such as t2.micro. The default type is "m3.medium".
|
||||
InstanceType *InstanceType `lumi:"instanceType,optional"`
|
||||
// A list that contains the Amazon EC2 security groups to assign to the Amazon EC2 instance.
|
||||
SecurityGroups *[]*SecurityGroup `lumi:"securityGroups,optional"`
|
||||
SecurityGroups *[]*SecurityGroup `lumi:"securityGroups,optional,replaces"`
|
||||
// Provides the name of the Amazon EC2 key pair.
|
||||
KeyName *string `lumi:"keyName,optional"`
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export class Instance extends lumi.Resource implements InstanceArgs {
|
|||
public readonly name: string;
|
||||
public imageId: string;
|
||||
public instanceType?: InstanceType;
|
||||
public securityGroups?: SecurityGroup[];
|
||||
public readonly securityGroups?: SecurityGroup[];
|
||||
public keyName?: string;
|
||||
@lumi.out public availabilityZone: string;
|
||||
@lumi.out public privateDNSName?: string;
|
||||
|
@ -94,7 +94,7 @@ export class Instance extends lumi.Resource implements InstanceArgs {
|
|||
export interface InstanceArgs {
|
||||
imageId: string;
|
||||
instanceType?: InstanceType;
|
||||
securityGroups?: SecurityGroup[];
|
||||
readonly securityGroups?: SecurityGroup[];
|
||||
keyName?: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ func (p *instanceProvider) Get(ctx context.Context, id resource.ID) (*ec2.Instan
|
|||
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
|
||||
func (p *instanceProvider) InspectChange(ctx context.Context, id resource.ID,
|
||||
old *ec2.Instance, new *ec2.Instance, diff *resource.ObjectDiff) ([]string, error) {
|
||||
// TODO: we should permit changes to security groups for non-EC2-classic VMs that are in VPCs.
|
||||
// TODO[pulumi/lumi#187]: we should permit changes to security groups for non-EC2-classic VMs that are in VPCs.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,9 @@ func (p *InstanceProvider) InspectChange(
|
|||
if diff.Changed("name") {
|
||||
replaces = append(replaces, "name")
|
||||
}
|
||||
if diff.Changed("securityGroups") {
|
||||
replaces = append(replaces, "securityGroups")
|
||||
}
|
||||
}
|
||||
more, err := p.ops.InspectChange(ctx, id, old, new, diff)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue