Skip to content

Commit 461f694

Browse files
committed
Implement engine_version argument
1 parent 55e4e35 commit 461f694

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/service/opensearch/package.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"log"
99

10+
"github.com/YakDriver/regexache"
1011
"github.com/aws/aws-sdk-go-v2/aws"
1112
"github.com/aws/aws-sdk-go-v2/service/opensearch"
1213
awstypes "github.com/aws/aws-sdk-go-v2/service/opensearch/types"
@@ -39,6 +40,12 @@ func resourcePackage() *schema.Resource {
3940
Type: schema.TypeString,
4041
Computed: true,
4142
},
43+
"engine_version": {
44+
Type: schema.TypeString,
45+
Optional: true,
46+
ForceNew: true,
47+
ValidateFunc: validation.StringMatch(regexache.MustCompile(`^Elasticsearch_[0-9]{1}\.[0-9]{1,2}$|^OpenSearch_[0-9]{1,2}\.[0-9]{1,2}$`), "must be in the format 'Elasticsearch_X.Y' or 'OpenSearch_X.Y'"),
48+
},
4249
"package_description": {
4350
Type: schema.TypeString,
4451
Optional: true,
@@ -94,6 +101,10 @@ func resourcePackageCreate(ctx context.Context, d *schema.ResourceData, meta any
94101
PackageType: awstypes.PackageType(d.Get("package_type").(string)),
95102
}
96103

104+
if v, ok := d.GetOk("engine_version"); ok {
105+
input.EngineVersion = aws.String(v.(string))
106+
}
107+
97108
if v, ok := d.GetOk("package_source"); ok {
98109
input.PackageSource = expandPackageSource(v.([]any)[0].(map[string]any))
99110
}
@@ -126,6 +137,7 @@ func resourcePackageRead(ctx context.Context, d *schema.ResourceData, meta any)
126137
}
127138

128139
d.Set("available_package_version", pkg.AvailablePackageVersion)
140+
d.Set("engine_version", pkg.EngineVersion)
129141
d.Set("package_description", pkg.PackageDescription)
130142
d.Set("package_id", pkg.PackageID)
131143
d.Set("package_name", pkg.PackageName)

0 commit comments

Comments
 (0)