Skip to content

Commit cf32794

Browse files
committed
OCPBUGS-31017: fix ec2:DisassociateAddress requirement
We only need this permission when using public IPv4 pool, so change the permissions to reflect that. This is a follow-up to openshift#8247
1 parent 9938156 commit cf32794

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pkg/asset/installconfig/aws/permissions.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const (
4242

4343
// PermissionKMSEncryptionKeys is an additional set of permissions required when the installer uses user provided kms encryption keys.
4444
PermissionKMSEncryptionKeys PermissionGroup = "kms-encryption-keys"
45+
46+
// PermissionPublicIpv4Pool is an additional set of permissions required when the installer uses public IPv4 pools.
47+
PermissionPublicIpv4Pool PermissionGroup = "public-ipv4-pool"
4548
)
4649

4750
var permissions = map[PermissionGroup][]string{
@@ -231,8 +234,6 @@ var permissions = map[PermissionGroup][]string{
231234
"ec2:DeleteVpc",
232235
"ec2:DeleteVpcEndpoints",
233236
"ec2:DetachInternetGateway",
234-
// Needed by terraform when EIPs are created
235-
"ec2:DisassociateAddress",
236237
"ec2:DisassociateRouteTable",
237238
"ec2:ReleaseAddress",
238239
"ec2:ReplaceRouteTableAssociation",
@@ -261,6 +262,10 @@ var permissions = map[PermissionGroup][]string{
261262
"kms:CreateGrant",
262263
"kms:ListGrants",
263264
},
265+
PermissionPublicIpv4Pool: {
266+
// Needed by terraform because of bootstrap EIP created
267+
"ec2:DisassociateAddress",
268+
},
264269
}
265270

266271
// ValidateCreds will try to create an AWS session, and also verify that the current credentials

pkg/asset/installconfig/platformpermscheck.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ func (a *PlatformPermsCheck) Generate(dependencies asset.Parents) error {
9898
}
9999
}
100100

101+
if ic.Config.AWS.PublicIpv4Pool != "" {
102+
permissionGroups = append(permissionGroups, awsconfig.PermissionPublicIpv4Pool)
103+
}
104+
101105
ssn, err := ic.AWS.Session(ctx)
102106
if err != nil {
103107
return err

0 commit comments

Comments
 (0)