diff --git a/internal/services/springcloud/spring_cloud_configuration_service_resource.go b/internal/services/springcloud/spring_cloud_configuration_service_resource.go index 2378d0f38c6a..4cdd9daa2b8f 100644 --- a/internal/services/springcloud/spring_cloud_configuration_service_resource.go +++ b/internal/services/springcloud/spring_cloud_configuration_service_resource.go @@ -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"` } @@ -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, @@ -221,6 +228,7 @@ func (s SpringCloudConfigurationServiceResource) Create() sdk.ResourceFunc { GitProperty: &appplatform.ConfigurationServiceGitProperty{ Repositories: expandConfigurationServiceConfigurationServiceGitRepositoryArray(model.Repository), }, + RefreshIntervalInSeconds: pointer.To(model.RefreshInterval), }, }, } @@ -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, } @@ -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) } } } diff --git a/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go b/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go index 4a862ee615f1..d2eec9f3a6f6 100644 --- a/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go +++ b/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go @@ -215,6 +215,7 @@ resource "azurerm_spring_cloud_configuration_service" "test" { username = "adminuser" password = "H@Sh1CoR3!" } + refresh_interval_in_seconds = 10 } `, template) } diff --git a/website/docs/r/spring_cloud_configuration_service.html.markdown b/website/docs/r/spring_cloud_configuration_service.html.markdown index 57e1fd7e40c7..d9144e91ea1c 100644 --- a/website/docs/r/spring_cloud_configuration_service.html.markdown +++ b/website/docs/r/spring_cloud_configuration_service.html.markdown @@ -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. ---