Skip to content

Commit

Permalink
feat(managedinstance/aws): add support for block device mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
guyalt3 authored and liranp committed Apr 5, 2021
1 parent acce1c2 commit 0966e3a
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 41 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased

ENHANCEMENTS:
* resource/spotinst_managed_instance_aws: added support for `block_device_mappings`

## 1.36.0 (March 18, 2021)

FEATURES:
Expand Down
21 changes: 20 additions & 1 deletion docs/resources/managed_instance_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ resource "spotinst_managed_instance_aws" "default-managed-instance" {
key = "explicit2"
value = "value2"
}
block_device_mappings {
device_name = "/dev/xvdcz"
ebs {
delete_on_termination = "true"
volume_type = "gp3"
volume_size = 50
iops = 100
throughput = 125
}
}
}
```

Expand Down Expand Up @@ -122,7 +133,7 @@ Default: false
* `placement_tenancy` - (Optional) Valid values: `"default"`, `"dedicated"`.
Default: default
* `iam_instance_profile` - (Optional) Set IAM profile to instance. Set only one of ARN or Name.
* `security_group_ids` - (Optional) One or more security group IDs.
* `security_group_ids` - (Optional) One or more security group IDs.
* `image_id` - (Required) The ID of the image used to launch the instance.
* `key_pair` - (Optional) Specify a Key Pair to attach to the instances.
* `tags` - (Optional) Set tags for the instance. Items should be unique.
Expand All @@ -131,6 +142,14 @@ Default: default
* `user_data` - (Optional) The Base64-encoded MIME user data to make available to the instances.
* `shutdown_script` - (Optional) The Base64-encoded shutdown script to execute prior to instance termination.
* `cpu_credits` - (Optional) cpuCredits can have one of two values: `"unlimited"`, `"standard"`.
* `block_device_mappings` - (Optional) Attributes controls a portion of the AWS:
* `device_name` - (Required) The name of the device to mount.
* `volume_type` - (Optional, Default: `"standard"`) The type of volume. Can be `"standard"`, `"gp2"`, `"gp3"`, `"io1"`, `"st1"` or `"sc1"`.
* `volume_size` - (Optional) The size of the volume in gigabytes.
* `iops` - (Optional) The amount of provisioned [IOPS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html). This must be set with a `volume_type` of `"io1"`.
* `delete_on_termination` - (Optional) Whether the volume should be destroyed on instance termination.
* `throughput`- (Optional) The amount of data transferred to or from a storage device per second. Valid only if `volume_type` is set to `"gp3"`.

Default: unlimited

<a id="network-interface"></a>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ require (
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/terraform-plugin-docs v0.4.0
github.com/hashicorp/terraform-plugin-sdk v1.16.1
github.com/spotinst/spotinst-sdk-go v1.83.0
github.com/spotinst/spotinst-sdk-go v1.84.0
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spotinst/spotinst-sdk-go v1.83.0 h1:P0jqiWBqB74MH1+KqEb4jURp3TXdU4IA5A7UACqqNBo=
github.com/spotinst/spotinst-sdk-go v1.83.0/go.mod h1:tJtl0XQCi8YaZnCQfC/y3qHB9OpaxADH/N7EPa0hkt8=
github.com/spotinst/spotinst-sdk-go v1.84.0 h1:F6A+wvfu7fQ1Ubsj3YL0BdTtCfqg9/CMOmB4NW3xDNM=
github.com/spotinst/spotinst-sdk-go v1.84.0/go.mod h1:tJtl0XQCi8YaZnCQfC/y3qHB9OpaxADH/N7EPa0hkt8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@ const (
)

const (
EBSOptimized commons.FieldName = "ebs_optimized"
EnableMonitoring commons.FieldName = "enable_monitoring"
PlacementTenancy commons.FieldName = "placement_tenancy"
IamInstanceProfile commons.FieldName = "iam_instance_profile"
SecurityGroupIds commons.FieldName = "security_group_ids"
ImageId commons.FieldName = "image_id"
KeyPair commons.FieldName = "key_pair"
Tags commons.FieldName = "tags"
UserData commons.FieldName = "user_data"
ShutdownScript commons.FieldName = "shutdown_script"
CPUCredits commons.FieldName = "cpu_credits"
EBSOptimized commons.FieldName = "ebs_optimized"
EnableMonitoring commons.FieldName = "enable_monitoring"
PlacementTenancy commons.FieldName = "placement_tenancy"
IAMInstanceProfile commons.FieldName = "iam_instance_profile"
SecurityGroupIDs commons.FieldName = "security_group_ids"
ImageID commons.FieldName = "image_id"
KeyPair commons.FieldName = "key_pair"
Tags commons.FieldName = "tags"
UserData commons.FieldName = "user_data"
ShutdownScript commons.FieldName = "shutdown_script"
CPUCredits commons.FieldName = "cpu_credits"
BlockDeviceMappings commons.FieldName = "block_device_mappings"
)

const (
DeviceName commons.FieldName = "device_name"
EBS commons.FieldName = "ebs"
DeleteOnTermination commons.FieldName = "delete_on_termination"
IOPS commons.FieldName = "iops"
VolumeSize commons.FieldName = "volume_size"
VolumeType commons.FieldName = "volume_type"
Throughput commons.FieldName = "throughput"
)
Loading

0 comments on commit 0966e3a

Please sign in to comment.