Skip to content

Commit

Permalink
Add support for VPCS, closes #75
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Fitzgerald committed May 18, 2020
1 parent 042f1e3 commit d0ab71b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.11.0 / 2020-05-18

- Add support for VPC, closes issue #75

# 0.10.7 / 2020-05-18

- [@vsingh-msys] [PR #77] Remove unsupported default image mapping
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,25 @@ ocean API:
curl -X GET https://api.digitalocean.com/v2/firewalls -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN"
```

# VPCS

To create the droplet with a VPC (Virtual Private Cloud), provide a pre-existing VPC ID as a
string.

``` ruby
driver:
vpcs:
- 3a92ae2d-f1b7-4589-81b8-8ef144374453
```

Note that your 'vpc_uuid' must be the numeric ids of your vpc. To get the
numeric ID, use something like the following command to get them from the digital
ocean API:

``` bash
curl -X GET https://api.digitalocean.com/v2/vpcs -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN"
```


# Development

Expand Down
2 changes: 1 addition & 1 deletion kitchen-digitalocean.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).grep(/LICENSE|^lib/)
spec.require_paths = ['lib']

spec.add_dependency 'droplet_kit', '>= 2.8', '< 4.0'
spec.add_dependency 'droplet_kit', '>= 3.7', '< 4.0'
spec.add_dependency 'test-kitchen', '>= 1.17', '< 3'

spec.add_development_dependency 'bundler'
Expand Down
3 changes: 3 additions & 0 deletions lib/kitchen/driver/digitalocean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class Digitalocean < Kitchen::Driver::SSHBase
default_config :user_data, nil
default_config :tags, nil
default_config :firewalls, nil
default_config :vpcs, nil


default_config :region do
ENV['DIGITALOCEAN_REGION'] || 'nyc1'
Expand Down Expand Up @@ -194,6 +196,7 @@ def create_server
private_networking: config[:private_networking],
ipv6: config[:ipv6],
user_data: config[:user_data],
vpc_uuid: config[:vpcs],
tags: if config[:tags].is_a?(String)
config[:tags].split(/\s+|,\s+|,+/)
else
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/digitalocean_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
module Kitchen
module Driver
# Version string for Digital Ocean Kitchen driver
DIGITALOCEAN_VERSION = '0.10.7'
DIGITALOCEAN_VERSION = '0.11.0'
end
end

Expand Down
3 changes: 2 additions & 1 deletion spec/kitchen/driver/digitalocean_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
username: 'admin',
port: '2222',
server_name: 'puppy',
region: 'ams1'
region: 'ams1',
vpcs: '3a92ae2d-f1b7-4589-81b8-8ef144374453'
}

let(:config) { config }
Expand Down

0 comments on commit d0ab71b

Please sign in to comment.