Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit dd76c86

Browse files
committed
gcp-project: enable VM Manager
See: https://appsembler.atlassian.net/wiki/spaces/ORANGE/blog/2022/03/17/2459926695/VM+Manager+quick+demo This will be handy for vulnerability/patch management and should be enabled on all of our projects. (Not every VM will immediately work though; the setup also requires that VMs have service agents associated with them and not all of our existing ones do, but this will let us start working through them and make sure that it's all set up for new infrastructure). To work out what was needed for this, I created a fresh test project and kept track of exactly which services and attributes had to be enabled before I could start up an instance and have it work with VM Manager, so this should be a pretty minimal set of changes.
1 parent bcbffd2 commit dd76c86

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

gcp_project/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ we will consider auto-generating this.
5555

5656
## Releases
5757

58+
* `gcp_project-1.3.0` - enable VM Manager / OS Config by default
5859
* `gcp_project-1.2.0` - enable vanta required services by default
5960
* `gcp_project-1.1.0` - add `folder_id` parameter to allow support placing projects in folders.
6061
* `gcp_project-1.0.0` - Terraform 1.0.0 support

gcp_project/vm_manager.tf

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# these services are required for VM Manager, which we want to
2+
# enable on all projects.
3+
4+
resource "google_project_service" "compute_service" {
5+
project = var.project_id
6+
service = "compute.googleapis.com"
7+
disable_dependent_services = false
8+
disable_on_destroy = false
9+
}
10+
11+
resource "google_project_service" "containeranalysis_service" {
12+
project = var.project_id
13+
service = "containeranalysis.googleapis.com"
14+
disable_dependent_services = false
15+
disable_on_destroy = false
16+
}
17+
18+
resource "google_project_service" "osconfig_service" {
19+
project = var.project_id
20+
service = "osconfig.googleapis.com"
21+
disable_dependent_services = false
22+
disable_on_destroy = false
23+
}
24+
25+
resource "google_project_service" "oslogin_service" {
26+
project = var.project_id
27+
service = "oslogin.googleapis.com"
28+
disable_dependent_services = false
29+
disable_on_destroy = false
30+
}
31+
32+
# and we need to set some project metadata to actually enable it
33+
34+
resource "google_compute_project_metadata_item" "guestattributes" {
35+
project = var.project_id
36+
key = "enable-guest-attributes"
37+
value = "TRUE"
38+
}
39+
40+
resource "google_compute_project_metadata_item" "osconfig" {
41+
project = var.project_id
42+
key = "enable-osconfig"
43+
value = "TRUE"
44+
}

0 commit comments

Comments
 (0)