From 0dd75a853de00b9afa3983f426ecc8715cb16253 Mon Sep 17 00:00:00 2001 From: magodo Date: Mon, 25 Nov 2024 15:40:48 +1100 Subject: [PATCH 1/2] `azurerm_container_registry_task`: Add schema validations for `agent_pool_name` and `agent_setting` --- .../containers/container_registry_task_resource.go | 13 ++++++++----- .../docs/r/container_registry_task.html.markdown | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/services/containers/container_registry_task_resource.go b/internal/services/containers/container_registry_task_resource.go index fc6474b75cac..3c56e416e673 100644 --- a/internal/services/containers/container_registry_task_resource.go +++ b/internal/services/containers/container_registry_task_resource.go @@ -574,16 +574,19 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Elem: &pluginsdk.Resource{ Schema: map[string]*schema.Schema{ "cpu": { - Type: pluginsdk.TypeInt, - Required: true, + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{2}), }, }, }, + ConflictsWith: []string{"agent_pool_name"}, }, "agent_pool_name": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + ConflictsWith: []string{"agent_setting"}, }, "enabled": { Type: pluginsdk.TypeBool, diff --git a/website/docs/r/container_registry_task.html.markdown b/website/docs/r/container_registry_task.html.markdown index 18d262f3d757..a96e94c99614 100644 --- a/website/docs/r/container_registry_task.html.markdown +++ b/website/docs/r/container_registry_task.html.markdown @@ -55,6 +55,8 @@ The following arguments are supported: * `agent_setting` - (Optional) A `agent_setting` block as defined below. +~> **NOTE:** `agent_pool_name` and `agent_setting` are in conflict. Only one of them can be specified. + * `enabled` - (Optional) Should this Container Registry Task be enabled? Defaults to `true`. * `identity` - (Optional) An `identity` block as defined below. @@ -93,7 +95,7 @@ The following arguments are supported: A `agent_setting` block supports the following: -* `cpu` - (Required) The number of cores required for the Container Registry Task. +* `cpu` - (Required) The number of cores required for the Container Registry Task. Possible value is `2`. --- From 1bc09135319f4726be46b1e51f60204bbe697c01 Mon Sep 17 00:00:00 2001 From: magodo Date: Tue, 26 Nov 2024 20:00:46 +1100 Subject: [PATCH 2/2] Update website/docs/r/container_registry_task.html.markdown Co-authored-by: stephybun --- website/docs/r/container_registry_task.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/container_registry_task.html.markdown b/website/docs/r/container_registry_task.html.markdown index a96e94c99614..58e396428e0e 100644 --- a/website/docs/r/container_registry_task.html.markdown +++ b/website/docs/r/container_registry_task.html.markdown @@ -55,7 +55,7 @@ The following arguments are supported: * `agent_setting` - (Optional) A `agent_setting` block as defined below. -~> **NOTE:** `agent_pool_name` and `agent_setting` are in conflict. Only one of them can be specified. +~> **NOTE:** Only one of `agent_pool_name` and `agent_setting` can be specified. * `enabled` - (Optional) Should this Container Registry Task be enabled? Defaults to `true`.