Skip to content

Commit db686be

Browse files
committed
updates application pool with managed_runtime_version parameter
1 parent b7238ce commit db686be

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

iis/resource_application_pool.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
const NameKey = "name"
11+
const ManagedRuntimeKey = "runtime"
1112
const StatusKey = "status"
1213

1314
func resourceApplicationPool() *schema.Resource {
@@ -22,6 +23,11 @@ func resourceApplicationPool() *schema.Resource {
2223
Type: schema.TypeString,
2324
Required: true,
2425
},
26+
ManagedRuntimeKey: {
27+
Type: schema.TypeString,
28+
Optional: true,
29+
Default: "",
30+
},
2531
StatusKey: {
2632
Type: schema.TypeString,
2733
Optional: true,
@@ -34,7 +40,8 @@ func resourceApplicationPool() *schema.Resource {
3440
func resourceApplicationPoolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
3541
client := m.(*iis.Client)
3642
name := d.Get(NameKey).(string)
37-
pool, err := client.CreateAppPool(ctx, name)
43+
runtime := d.Get(ManagedRuntimeKey).(string)
44+
pool, err := client.CreateAppPool(ctx, name, runtime)
3845
if err != nil {
3946
return diag.FromErr(err)
4047
}
@@ -54,6 +61,9 @@ func resourceApplicationPoolRead(ctx context.Context, d *schema.ResourceData, m
5461
if err = d.Set(NameKey, appPool.Name); err != nil {
5562
return diag.FromErr(err)
5663
}
64+
if err = d.Set(ManagedRuntimeKey, appPool.ManagedRuntimeKey); err != nil {
65+
return diag.FromErr(err)
66+
}
5767
if err = d.Set(StatusKey, appPool.Status); err != nil {
5868
return diag.FromErr(err)
5969
}
@@ -62,8 +72,8 @@ func resourceApplicationPoolRead(ctx context.Context, d *schema.ResourceData, m
6272

6373
func resourceApplicationPoolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
6474
client := m.(*iis.Client)
65-
if d.HasChange(NameKey) {
66-
applicationPool, err := client.UpdateAppPool(ctx, d.Id(), d.Get(NameKey).(string))
75+
if d.HasChange(NameKey) || d.HasChange(ManagedRuntimeKey) {
76+
applicationPool, err := client.UpdateAppPool(ctx, d.Id(), d.Get(NameKey).(string), d.Get(ManagedRuntimeKey).(string))
6777
if err != nil {
6878
return diag.FromErr(err)
6979
}

0 commit comments

Comments
 (0)