Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ To this end, this provider supports the following extra specs schema:
"properties": {
"subnet_id": {
"type": "string",
"pattern": "^subnet-[0-9a-fA-F]{17}$"
"pattern": "^subnet-(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{17})$"
},
"ssh_key_name": {
"type": "string",
Expand Down
4 changes: 2 additions & 2 deletions internal/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func newExtraSpecsFromBootstrapData(data params.BootstrapInstance) (*extraSpecs,
}

type extraSpecs struct {
SubnetID *string `json:"subnet_id,omitempty" jsonschema:"pattern=^subnet-[0-9a-fA-F]{17}$,description=The ID of the subnet formatted as subnet-xxxxxxxxxxxxxxxxx."`
SubnetID *string `json:"subnet_id,omitempty" jsonschema:"pattern=^subnet-(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{17})$,description=The ID of the subnet formatted as subnet-xxxxxxxxxxxxxxxxx."`
SSHKeyName *string `json:"ssh_key_name,omitempty" jsonschema:"description=The name of the Key Pair to use for the instance."`
IAMInstanceProfile *string `json:"iam_instance_profile,omitempty jsonschema:"description=The IAM instance profile to associate with the instance."`
IAMInstanceProfile *string `json:"iam_instance_profile,omitempty" jsonschema:"description=The IAM instance profile to associate with the instance."`
Iops *int32 `json:"iops,omitempty" jsonschema:"description=Specifies the number of IOPS (Input/Output Operations Per Second) provisioned for the volume. Required for io1 and io2 volumes. Optional for gp3 volumes."`
Throughput *int32 `json:"throughput,omitempty" jsonschema:"description=Specifies the throughput (MiB/s) provisioned for the volume. Valid only for gp3 volumes.,minimum=125,maximum=1000"`
VolumeSize *int32 `json:"volume_size,omitempty" jsonschema:"description=Specifies the size of the volume in GiB. Required unless a snapshot ID is provided."`
Expand Down
12 changes: 11 additions & 1 deletion internal/spec/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ func TestExtraSpecsFromBootstrapData(t *testing.T) {
},
errString: "",
},
{
name: "specs just with older version of subnet_id",
input: params.BootstrapInstance{
ExtraSpecs: json.RawMessage(`{"subnet_id": "subnet-12345678"}`),
},
expectedOutput: &extraSpecs{
SubnetID: aws.String("subnet-12345678"),
},
errString: "",
},
{
name: "specs just with ssh_key_name",
input: params.BootstrapInstance{
Expand Down Expand Up @@ -171,7 +181,7 @@ func TestExtraSpecsFromBootstrapData(t *testing.T) {
ExtraSpecs: json.RawMessage(`{"subnet_id": "subnet-1"}`),
},
expectedOutput: nil,
errString: "subnet_id: Does not match pattern '^subnet-[0-9a-fA-F]{17}$'",
errString: "subnet_id: Does not match pattern '^subnet-(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{17})$'",
},
{
name: "invalid type for subnet_id",
Expand Down