Skip to content

Commit d34d54e

Browse files
Merge pull request openshift#7589 from r4f4/aws-sg-default-platform
OCPBUGS-20525: aws: use security groups from defaultMachinePlatform
2 parents 7aa6941 + c0912e7 commit d34d54e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/asset/cluster/tfvars.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,19 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
280280
workerIAMRoleName = awsMP.IAMRole
281281
}
282282

283+
var securityGroups []string
284+
if mp := installConfig.Config.AWS.DefaultMachinePlatform; mp != nil {
285+
securityGroups = mp.AdditionalSecurityGroupIDs
286+
}
283287
masterIAMRoleName := ""
284288
if mp := installConfig.Config.ControlPlane; mp != nil {
285289
awsMP := &aws.MachinePool{}
286290
awsMP.Set(installConfig.Config.AWS.DefaultMachinePlatform)
287291
awsMP.Set(mp.Platform.AWS)
288292
masterIAMRoleName = awsMP.IAMRole
293+
if len(awsMP.AdditionalSecurityGroupIDs) > 0 {
294+
securityGroups = awsMP.AdditionalSecurityGroupIDs
295+
}
289296
}
290297

291298
// AWS Zones is used to determine which route table the edge zone will be associated.
@@ -294,13 +301,6 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
294301
return err
295302
}
296303

297-
var securityGroups []string
298-
if mp := installConfig.Config.ControlPlane; mp != nil {
299-
if mp.Platform.AWS != nil {
300-
securityGroups = append(securityGroups, mp.Platform.AWS.AdditionalSecurityGroupIDs...)
301-
}
302-
}
303-
304304
data, err := awstfvars.TFVars(awstfvars.TFVarsSources{
305305
VPC: vpc,
306306
PrivateSubnets: privateSubnets,

0 commit comments

Comments
 (0)