Skip to content

Commit

Permalink
Don't modify shared subnets
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Dec 1, 2021
1 parent 1e1a148 commit ad29ed4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions upup/pkg/fi/cloudup/awstasks/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,20 @@ func (s *Subnet) CheckChanges(a, e, changes *Subnet) error {
return nil
}

func (_ *Subnet) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *Subnet) error {
func (_ *Subnet) ShouldCreate(a, e, changes *Subnet) (bool, error) {
shared := fi.BoolValue(e.Shared)
if shared {
// Verify the subnet was found
if a == nil {
return fmt.Errorf("Subnet with id %q not found", fi.StringValue(e.ID))
return false, fmt.Errorf("subnet with id %q not found", fi.StringValue(e.ID))
}

return false, nil
}
return true, nil
}

func (_ *Subnet) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *Subnet) error {
if strings.HasPrefix(aws.StringValue(e.IPv6CIDR), "/") {
vpcIPv6CIDR := e.VPC.IPv6CIDR
if vpcIPv6CIDR == nil {
Expand Down

0 comments on commit ad29ed4

Please sign in to comment.