File tree Expand file tree Collapse file tree 5 files changed +30
-6
lines changed
examples/workload_metadata_config
fixtures/workload_metadata_config
integration/workload_metadata_config Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,9 @@ module "gke" {
40
40
subnetwork = var. subnetwork
41
41
ip_range_pods = var. ip_range_pods
42
42
ip_range_services = var. ip_range_services
43
- create_service_account = false
44
- service_account = var. compute_engine_service_account
43
+ create_service_account = true
44
+ grant_registry_access = true
45
+ registry_project_id = var. registry_project_id
45
46
enable_private_endpoint = true
46
47
enable_private_nodes = true
47
48
master_ipv4_cidr_block = " 172.16.0.0/28"
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ variable "ip_range_services" {
48
48
description = " The secondary ip range to use for pods"
49
49
}
50
50
51
- variable "compute_engine_service_account " {
52
- description = " Service account to associate to the nodes in the cluster "
51
+ variable "registry_project_id " {
52
+ description = " Project name for the GCR registry "
53
53
}
54
-
Original file line number Diff line number Diff line change @@ -25,5 +25,5 @@ module "example" {
25
25
subnetwork = google_compute_subnetwork. main . name
26
26
ip_range_pods = google_compute_subnetwork. main . secondary_ip_range [0 ]. range_name
27
27
ip_range_services = google_compute_subnetwork. main . secondary_ip_range [1 ]. range_name
28
- compute_engine_service_account = var. compute_engine_service_account
28
+ registry_project_id = var. registry_project_id
29
29
}
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
project_id = attribute ( 'project_id' )
16
+ registry_project_id = attribute ( 'registry_project_id' )
16
17
location = attribute ( 'location' )
17
18
cluster_name = attribute ( 'cluster_name' )
19
+ service_account = attribute ( 'service_account' )
18
20
19
21
control "gcloud" do
20
22
title "Google Compute Engine GKE configuration"
55
57
end
56
58
end
57
59
end
60
+
61
+ describe command ( "gcloud projects get-iam-policy #{ registry_project_id } --format=json" ) do
62
+ its ( :exit_status ) { should eq 0 }
63
+ its ( :stderr ) { should eq '' }
64
+
65
+ let! ( :iam ) do
66
+ if subject . exit_status == 0
67
+ JSON . parse ( subject . stdout )
68
+ else
69
+ { }
70
+ end
71
+ end
72
+ it "has expected registry roles" do
73
+ expect ( iam [ 'bindings' ] ) . to include ( "members" => [ "serviceAccount:#{ service_account } " ] , "role" => "roles/storage.objectViewer" )
74
+ end
75
+ end
58
76
end
Original file line number Diff line number Diff line change @@ -9,3 +9,9 @@ attributes:
9
9
- name : project_id
10
10
required : true
11
11
type : string
12
+ - name : service_account
13
+ required : true
14
+ type : string
15
+ - name : registry_project_id
16
+ required : false
17
+ type : string
You can’t perform that action at this time.
0 commit comments