Skip to content

Commit 66a3bad

Browse files
authored
Update policy definition in databricks_aws_crossaccount_policy data source (#2262)
The policy definition was updated with new permissions as per [Databricks documentation](https://docs.databricks.com/administration-guide/account-settings-e2/credentials.html#step-2-create-an-access-policy). Entries are also sorted to match documentation. This fixes #2255 We need to look if we need the following permissions that aren't mentioned in the documentation, but present in the data source ``` "ec2:CreateKeyPair", "ec2:CreatePlacementGroup", "ec2:DeleteKeyPair", "ec2:DeletePlacementGroup", "ec2:DescribeNetworkAcls", "ec2:DescribePlacementGroups", "ec2:DescribeVpcAttribute", "ec2:DetachVolume", ```
1 parent 554e362 commit 66a3bad

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

aws/data_aws_crossaccount_policy.go

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func DataAwsCrossaccountPolicy() *schema.Resource {
1818
{
1919
Effect: "Allow",
2020
Actions: []string{
21+
"ec2:AllocateAddress",
22+
"ec2:AssignPrivateIpAddresses",
2123
"ec2:AssociateDhcpOptions",
2224
"ec2:AssociateIamInstanceProfile",
2325
"ec2:AssociateRouteTable",
@@ -27,30 +29,49 @@ func DataAwsCrossaccountPolicy() *schema.Resource {
2729
"ec2:AuthorizeSecurityGroupIngress",
2830
"ec2:CancelSpotInstanceRequests",
2931
"ec2:CreateDhcpOptions",
32+
"ec2:CreateFleet",
3033
"ec2:CreateInternetGateway",
3134
"ec2:CreateKeyPair",
35+
"ec2:CreateLaunchTemplate",
36+
"ec2:CreateLaunchTemplateVersion",
37+
"ec2:CreateNatGateway",
38+
"ec2:CreatePlacementGroup",
3239
"ec2:CreateRoute",
40+
"ec2:CreateRouteTable",
3341
"ec2:CreateSecurityGroup",
3442
"ec2:CreateSubnet",
3543
"ec2:CreateTags",
3644
"ec2:CreateVolume",
3745
"ec2:CreateVpc",
46+
"ec2:CreateVpcEndpoint",
47+
"ec2:DeleteDhcpOptions",
48+
"ec2:DeleteFleets",
3849
"ec2:DeleteInternetGateway",
3950
"ec2:DeleteKeyPair",
51+
"ec2:DeleteLaunchTemplate",
52+
"ec2:DeleteLaunchTemplateVersions",
53+
"ec2:DeleteNatGateway",
54+
"ec2:DeletePlacementGroup",
4055
"ec2:DeleteRoute",
4156
"ec2:DeleteRouteTable",
4257
"ec2:DeleteSecurityGroup",
4358
"ec2:DeleteSubnet",
4459
"ec2:DeleteTags",
4560
"ec2:DeleteVolume",
4661
"ec2:DeleteVpc",
62+
"ec2:DeleteVpcEndpoints",
4763
"ec2:DescribeAvailabilityZones",
48-
"ec2:DescribeNetworkAcls",
49-
"ec2:DescribeInternetGateways",
50-
"ec2:DescribeVpcAttribute",
64+
"ec2:DescribeFleetHistory",
65+
"ec2:DescribeFleetInstances",
66+
"ec2:DescribeFleets",
5167
"ec2:DescribeIamInstanceProfileAssociations",
5268
"ec2:DescribeInstanceStatus",
5369
"ec2:DescribeInstances",
70+
"ec2:DescribeInternetGateways",
71+
"ec2:DescribeLaunchTemplates",
72+
"ec2:DescribeNatGateways",
73+
"ec2:DescribeNetworkAcls",
74+
"ec2:DescribePlacementGroups",
5475
"ec2:DescribePrefixLists",
5576
"ec2:DescribeReservedInstancesOfferings",
5677
"ec2:DescribeRouteTables",
@@ -59,30 +80,24 @@ func DataAwsCrossaccountPolicy() *schema.Resource {
5980
"ec2:DescribeSpotPriceHistory",
6081
"ec2:DescribeSubnets",
6182
"ec2:DescribeVolumes",
83+
"ec2:DescribeVpcAttribute",
6284
"ec2:DescribeVpcs",
6385
"ec2:DetachInternetGateway",
86+
"ec2:DetachVolume",
6487
"ec2:DisassociateIamInstanceProfile",
88+
"ec2:DisassociateRouteTable",
89+
"ec2:GetLaunchTemplateData",
90+
"ec2:GetSpotPlacementScores",
91+
"ec2:ModifyFleet",
92+
"ec2:ModifyLaunchTemplate",
6593
"ec2:ModifyVpcAttribute",
94+
"ec2:ReleaseAddress",
6695
"ec2:ReplaceIamInstanceProfileAssociation",
6796
"ec2:RequestSpotInstances",
6897
"ec2:RevokeSecurityGroupEgress",
6998
"ec2:RevokeSecurityGroupIngress",
7099
"ec2:RunInstances",
71100
"ec2:TerminateInstances",
72-
"ec2:CreatePlacementGroup",
73-
"ec2:DeletePlacementGroup",
74-
"ec2:DescribePlacementGroups",
75-
"ec2:AllocateAddress",
76-
"ec2:CreateNatGateway",
77-
"ec2:CreateRouteTable",
78-
"ec2:CreateVpcEndpoint",
79-
"ec2:DeleteDhcpOptions",
80-
"ec2:DeleteNatGateway",
81-
"ec2:DeleteVpcEndpoints",
82-
"ec2:DescribeNatGateways",
83-
"ec2:DisassociateRouteTable",
84-
"ec2:ReleaseAddress",
85-
"ec2:DetachVolume",
86101
},
87102
Resources: "*",
88103
},

aws/data_aws_crossaccount_policy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestDataAwsCrossAccountPolicy(t *testing.T) {
1616
}.Apply(t)
1717
assert.NoError(t, err)
1818
j := d.Get("json")
19-
assert.Lenf(t, j, 2759, "Strange length for policy: %s", j)
19+
assert.Lenf(t, j, 3294, "Strange length for policy: %s", j)
2020
}
2121

2222
func TestDataAwsCrossAccountPolicy_WithPassRoles(t *testing.T) {
@@ -29,5 +29,5 @@ func TestDataAwsCrossAccountPolicy_WithPassRoles(t *testing.T) {
2929
}.Apply(t)
3030
assert.NoError(t, err)
3131
j := d.Get("json")
32-
assert.Lenf(t, j, 2895, "Strange length for policy: %s", j)
32+
assert.Lenf(t, j, 3430, "Strange length for policy: %s", j)
3333
}

0 commit comments

Comments
 (0)