Skip to content

Commit c8c1230

Browse files
committed
Launch droplet in a specific project
depends on: digitalocean/godo#881
1 parent a8afd8e commit c8c1230

5 files changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ each category, the available configuration keys are alphabetized.
119119
- `ssh_key_id` (int) - The ID of an existing SSH key on the DigitalOcean account. This should be
120120
used in conjunction with `ssh_private_key_file`.
121121

122+
- `project_id` (string) - The Project ID to launch the droplet in.
123+
122124
<!-- End of code generated from the comments of the Config struct in builder/digitalocean/config.go; -->
123125

124126

builder/digitalocean/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ type Config struct {
116116
// The ID of an existing SSH key on the DigitalOcean account. This should be
117117
// used in conjunction with `ssh_private_key_file`.
118118
SSHKeyID int `mapstructure:"ssh_key_id" required:"false"`
119+
// The Project ID to launch the droplet in.
120+
ProjectID string `mapstructure:"project_id" required:"false"`
119121

120122
ctx interpolate.Context
121123
}

builder/digitalocean/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/digitalocean/step_create_droplet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func (s *stepCreateDroplet) Run(ctx context.Context, state multistep.StateBag) m
2828
state.Put("droplet_size", c.Size)
2929
state.Put("droplet_name", c.DropletName)
3030
state.Put("build_region", c.Region)
31+
state.Put("project_id", c.ProjectID)
3132

3233
// Create the droplet based on configuration
3334
ui.Say("Creating droplet...")
@@ -100,6 +101,7 @@ func (s *stepCreateDroplet) buildDropletCreateRequest(state multistep.StateBag)
100101
UserData: userData,
101102
Tags: c.Tags,
102103
VPCUUID: c.VPCUUID,
104+
ProjectID: c.ProjectID,
103105
}, nil
104106
}
105107

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@
7373
- `ssh_key_id` (int) - The ID of an existing SSH key on the DigitalOcean account. This should be
7474
used in conjunction with `ssh_private_key_file`.
7575

76+
- `project_id` (string) - The Project ID to launch the droplet in.
77+
7678
<!-- End of code generated from the comments of the Config struct in builder/digitalocean/config.go; -->

0 commit comments

Comments
 (0)