Skip to content

Commit

Permalink
azurerm_spring_cloud_configuration_service - support for the `refre…
Browse files Browse the repository at this point in the history
…sh_interval_in_seconds` property (#25009)
  • Loading branch information
ms-henglu authored Feb 26, 2024
1 parent cf94e97 commit 961ab72
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type SpringCloudConfigurationServiceModel struct {
Name string `tfschema:"name"`
SpringCloudServiceId string `tfschema:"spring_cloud_service_id"`
Generation string `tfschema:"generation"`
RefreshInterval int64 `tfschema:"refresh_interval_in_seconds"`
Repository []SpringCloudRepositoryModel `tfschema:"repository"`
}

Expand Down Expand Up @@ -78,6 +79,12 @@ func (s SpringCloudConfigurationServiceResource) Arguments() map[string]*schema.
}, false),
},

"refresh_interval_in_seconds": {
Type: pluginsdk.TypeInt,
Optional: true,
ValidateFunc: validation.IntAtLeast(0),
},

"repository": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -221,6 +228,7 @@ func (s SpringCloudConfigurationServiceResource) Create() sdk.ResourceFunc {
GitProperty: &appplatform.ConfigurationServiceGitProperty{
Repositories: expandConfigurationServiceConfigurationServiceGitRepositoryArray(model.Repository),
},
RefreshIntervalInSeconds: pointer.To(model.RefreshInterval),
},
},
}
Expand Down Expand Up @@ -270,6 +278,10 @@ func (s SpringCloudConfigurationServiceResource) Update() sdk.ResourceFunc {
properties.Settings.GitProperty.Repositories = expandConfigurationServiceConfigurationServiceGitRepositoryArray(model.Repository)
}

if metadata.ResourceData.HasChange("refresh_interval_in_seconds") {
properties.Settings.RefreshIntervalInSeconds = pointer.To(model.RefreshInterval)
}

configurationServiceResource := appplatform.ConfigurationServiceResource{
Properties: properties,
}
Expand Down Expand Up @@ -319,6 +331,7 @@ func (s SpringCloudConfigurationServiceResource) Read() sdk.ResourceFunc {
state.Generation = string(pointer.From(props.Generation))
if props.Settings != nil && props.Settings.GitProperty != nil {
state.Repository = flattenConfigurationServiceConfigurationServiceGitRepositoryArray(props.Settings.GitProperty.Repositories, model.Repository)
state.RefreshInterval = pointer.From(props.Settings.RefreshIntervalInSeconds)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ resource "azurerm_spring_cloud_configuration_service" "test" {
username = "adminuser"
password = "H@Sh1CoR3!"
}
refresh_interval_in_seconds = 10
}
`, template)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ The following arguments are supported:

* `generation` - (Optional) The generation of the Spring Cloud Configuration Service. Possible values are `Gen1` and `Gen2`.

* `refresh_interval_in_seconds` - (Optional) Specifies how often to check repository updates. Minimum value is 0.

* `repository` - (Optional) One or more `repository` blocks as defined below.

---
Expand Down

0 comments on commit 961ab72

Please sign in to comment.