Skip to content

Commit 8022f89

Browse files
committed
removing shared from tmpl
1 parent 888b269 commit 8022f89

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

castai/policies/policy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ func GetUserInlinePolicy(clusterName, arn, vpc, partition, sharedVPCArn string)
4242
if err != nil {
4343
return "", fmt.Errorf("parsing template: %w", err)
4444
}
45-
45+
var vpcArn string
4646
// If sharedVPCArn is not provided, use the main ARN for VPC/subnet resources
4747
if sharedVPCArn == "" {
48-
sharedVPCArn = arn
48+
vpcArn = arn
4949
}
5050

5151
type tmplValues struct {
5252
ClusterName string
5353
ARN string
5454
VPC string
5555
Partition string
56-
SharedVPCArn string
56+
VPCArn string
5757
}
5858

5959
var buf bytes.Buffer
@@ -63,7 +63,7 @@ func GetUserInlinePolicy(clusterName, arn, vpc, partition, sharedVPCArn string)
6363
ARN: arn,
6464
VPC: vpc,
6565
Partition: partition,
66-
SharedVPCArn: sharedVPCArn,
66+
VPCArn: vpcArn,
6767
}); err != nil {
6868
return "", fmt.Errorf("interpolating template: %w", err)
6969
}

castai/policies/user-policy.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"Sid": "RunInstancesVpcRestriction",
1717
"Effect": "Allow",
1818
"Action": "ec2:RunInstances",
19-
"Resource": "arn:{{ .Partition }}:ec2:{{ .SharedVPCArn }}:subnet/*",
19+
"Resource": "arn:{{ .Partition }}:ec2:{{ .VPCArn }}:subnet/*",
2020
"Condition": {
2121
"StringEquals": {
22-
"ec2:Vpc": "arn:{{ .Partition }}:ec2:{{ .SharedVPCArn }}:vpc/{{ .VPC }}"
22+
"ec2:Vpc": "arn:{{ .Partition }}:ec2:{{ .VPCArn }}:vpc/{{ .VPC }}"
2323
}
2424
}
2525
},

0 commit comments

Comments
 (0)