From 7f791a491078d50a7c6d543cfd62bfb7bcd0f4fa Mon Sep 17 00:00:00 2001 From: Komal Date: Mon, 18 Dec 2023 15:17:41 -0800 Subject: [PATCH] Support import for Team (#207) Fixes: https://github.com/pulumi/pulumi-pulumiservice/issues/181 --- CHANGELOG_PENDING.md | 2 ++ provider/pkg/provider/team.go | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 26655e9b..76418b77 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -1,5 +1,7 @@ ### Improvements +- Support `import` for the `Team` resource. [#207](https://github.com/pulumi/pulumi-pulumiservice/pull/207) + ### Bug Fixes - Fix `Read` for TeamStackPermission so resources are not deleted from state on refresh. Note: TeamStackPermission resources created before v0.17.0 will now return an error if attempting a refresh, but those (re)created with the new version will support `refresh`. [#205](https://github.com/pulumi/pulumi-pulumiservice/pull/205) diff --git a/provider/pkg/provider/team.go b/provider/pkg/provider/team.go index 3ec2e9bb..e2955bb0 100644 --- a/provider/pkg/provider/team.go +++ b/provider/pkg/provider/team.go @@ -44,11 +44,17 @@ func (i *PulumiServiceTeamInput) ToPropertyMap() resource.PropertyMap { pm := resource.PropertyMap{} pm["teamType"] = resource.NewPropertyValue(i.Type) pm["name"] = resource.NewPropertyValue(i.Name) - pm["displayName"] = resource.NewPropertyValue(i.DisplayName) - pm["description"] = resource.NewPropertyValue(i.Description) pm["members"] = resource.NewPropertyValue(i.Members) pm["organizationName"] = resource.NewPropertyValue(i.OrganizationName) - pm["githubTeamId"] = resource.NewPropertyValue(i.GitHubTeamID) + if i.Description != "" { + pm["description"] = resource.NewPropertyValue(i.Description) + } + if i.GitHubTeamID != 0 { + pm["githubTeamId"] = resource.NewPropertyValue(i.GitHubTeamID) + } + if i.DisplayName != "" { + pm["displayName"] = resource.NewPropertyValue(i.DisplayName) + } return pm } @@ -216,6 +222,7 @@ func (t *PulumiServiceTeamResource) Read(req *pulumirpc.ReadRequest) (*pulumirpc return &pulumirpc.ReadResponse{ Id: req.Id, Properties: props, + Inputs: props, }, nil }