From 6c3d43ef78bff8734142885fad9217698fd153cb Mon Sep 17 00:00:00 2001 From: xuzhang3 Date: Thu, 1 Feb 2024 15:08:15 +0800 Subject: [PATCH 1/3] elastic pool support project_id --- .../service/taskagent/resource_elastic_pool.go | 15 +++++++++++++++ website/docs/r/elastic_pool.html.markdown | 2 ++ 2 files changed, 17 insertions(+) diff --git a/azuredevops/internal/service/taskagent/resource_elastic_pool.go b/azuredevops/internal/service/taskagent/resource_elastic_pool.go index a446bf1b0..d78cfcc10 100644 --- a/azuredevops/internal/service/taskagent/resource_elastic_pool.go +++ b/azuredevops/internal/service/taskagent/resource_elastic_pool.go @@ -96,6 +96,11 @@ func ResourceAgentPoolVMSS() *schema.Resource { Optional: true, Default: true, }, + + "project_id": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -115,6 +120,15 @@ func resourceAzureAgentPoolVMSSCreate(d *schema.ResourceData, m interface{}) err PoolName: converter.String(d.Get("name").(string)), } + if v, ok := d.GetOk("project_id"); ok { + projectId, err := uuid.Parse(v.(string)) + if err != nil { + return fmt.Errorf(" parse Project Id: %s. Error: %+v", v, err) + } + args.ProjectId = &projectId + + } + seId := d.Get("service_endpoint_id").(string) seUUId, err := uuid.Parse(seId) if err != nil { @@ -196,6 +210,7 @@ func resourceAzureAgentPoolVMSSRead(d *schema.ResourceData, m interface{}) error d.Set("recycle_after_each_use", elasticPool.RecycleAfterEachUse) d.Set("agent_interactive_ui", elasticPool.AgentInteractiveUI) d.Set("time_to_live_minutes", elasticPool.TimeToLiveMinutes) + d.Set("project_id", d.Get("project_id").(string)) d.Set("auto_provision", agentPool.AutoProvision) d.Set("auto_update", agentPool.AutoUpdate) diff --git a/website/docs/r/elastic_pool.html.markdown b/website/docs/r/elastic_pool.html.markdown index 75d9ea7b6..6b9357a8f 100644 --- a/website/docs/r/elastic_pool.html.markdown +++ b/website/docs/r/elastic_pool.html.markdown @@ -71,6 +71,8 @@ The following arguments are supported: - `auto_update` - (Optional) Specifies whether or not agents within the pool should be automatically updated. Defaults to `true`. +- `project_id` - (Optional) The ID of the project where a new Elastic Pool will be created. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: From bf61d53233ff96c4189facc0c7f2de680faeb3f7 Mon Sep 17 00:00:00 2001 From: xuzhang3 Date: Thu, 1 Feb 2024 15:39:50 +0800 Subject: [PATCH 2/3] bump golang-ci version --- GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 6d797cb6e..5c487d85a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -22,7 +22,7 @@ tools: go install github.com/client9/misspell/cmd/misspell@latest go install github.com/bflad/tfproviderlint/cmd/tfproviderlint@latest go install github.com/bflad/tfproviderdocs@latest - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(GOPATH)/bin" v1.45.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(GOPATH)/bin" v1.55.2 build: fmtcheck check-vendor-vs-mod go install From 7ab9a3708d2b8d381c7e391656614cf8727fea0b Mon Sep 17 00:00:00 2001 From: xuzhang3 Date: Thu, 1 Feb 2024 15:51:55 +0800 Subject: [PATCH 3/3] fix lint --- GNUmakefile | 2 +- azuredevops/internal/service/taskagent/resource_elastic_pool.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 5c487d85a..6d797cb6e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -22,7 +22,7 @@ tools: go install github.com/client9/misspell/cmd/misspell@latest go install github.com/bflad/tfproviderlint/cmd/tfproviderlint@latest go install github.com/bflad/tfproviderdocs@latest - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(GOPATH)/bin" v1.55.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(GOPATH)/bin" v1.45.2 build: fmtcheck check-vendor-vs-mod go install diff --git a/azuredevops/internal/service/taskagent/resource_elastic_pool.go b/azuredevops/internal/service/taskagent/resource_elastic_pool.go index d78cfcc10..6a92d1486 100644 --- a/azuredevops/internal/service/taskagent/resource_elastic_pool.go +++ b/azuredevops/internal/service/taskagent/resource_elastic_pool.go @@ -126,7 +126,6 @@ func resourceAzureAgentPoolVMSSCreate(d *schema.ResourceData, m interface{}) err return fmt.Errorf(" parse Project Id: %s. Error: %+v", v, err) } args.ProjectId = &projectId - } seId := d.Get("service_endpoint_id").(string)