Skip to content

Commit f4978e7

Browse files
authored
Merge pull request #331 from rosmo/add-resource-manager-tags
Add support for Secure Tags
2 parents 4cfecca + c257efd commit f4978e7

7 files changed

Lines changed: 18 additions & 2 deletions

File tree

.web-docs/components/builder/googlecompute/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ builder.
312312

313313
- `tags` ([]string) - Assign network tags to apply firewall rules to VM instance.
314314

315+
- `resource_manager_tags` (map[string]string) - Assign Secure Tags to apply firewall rules to VM instance.
316+
315317
- `use_internal_ip` (bool) - If true, use the instance's internal IP instead of its external IP
316318
during building.
317319

builder/googlecompute/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ type Config struct {
310310
Subnetwork string `mapstructure:"subnetwork" required:"false"`
311311
// Assign network tags to apply firewall rules to VM instance.
312312
Tags []string `mapstructure:"tags" required:"false"`
313+
// Assign Secure Tags to apply firewall rules to VM instance.
314+
ResourceManagerTags map[string]string `mapstructure:"resource_manager_tags" required:"false"`
313315
// If true, use the instance's internal IP instead of its external IP
314316
// during building.
315317
UseInternalIP bool `mapstructure:"use_internal_ip" required:"false"`

builder/googlecompute/config.hcl2spec.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/googlecompute/step_create_instance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag)
211211
Scopes: c.Scopes,
212212
Subnetwork: c.Subnetwork,
213213
Tags: c.Tags,
214+
ResourceManagerTags: c.ResourceManagerTags,
214215
Zone: c.Zone,
215216
NetworkIP: c.NetworkIP,
216217
})

docs-partials/builder/googlecompute/Config-not-required.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@
258258

259259
- `tags` ([]string) - Assign network tags to apply firewall rules to VM instance.
260260

261+
- `resource_manager_tags` (map[string]string) - Assign Secure Tags to apply firewall rules to VM instance.
262+
261263
- `use_internal_ip` (bool) - If true, use the instance's internal IP instead of its external IP
262264
during building.
263265

lib/common/driver_gce.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,11 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
742742
Items: c.Tags,
743743
},
744744
}
745+
if len(c.ResourceManagerTags) > 0 {
746+
instance.Params = &compute.InstanceParams{
747+
ResourceManagerTags: c.ResourceManagerTags,
748+
}
749+
}
745750

746751
if c.MaxRunDurationInSeconds > 0 {
747752
log.Printf("[DEBUG] setting max run duration to %d seconds", c.MaxRunDurationInSeconds)

lib/common/instance.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ type InstanceConfig struct {
3737
Scopes []string
3838
Subnetwork string
3939
Tags []string
40-
Zone string
41-
NetworkIP string
40+
ResourceManagerTags map[string]string
41+
42+
Zone string
43+
NetworkIP string
4244
}

0 commit comments

Comments
 (0)