-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/opsgenie: Descriptions for Teams #11391
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,10 @@ import ( | |
"fmt" | ||
"strings" | ||
|
||
"regexp" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/opsgenie/opsgenie-go-sdk/team" | ||
"regexp" | ||
) | ||
|
||
func resourceOpsGenieTeam() *schema.Resource { | ||
|
@@ -26,6 +27,10 @@ func resourceOpsGenieTeam() *schema.Resource { | |
Required: true, | ||
ValidateFunc: validateOpsGenieTeamName, | ||
}, | ||
"description": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
}, | ||
"member": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
|
@@ -53,10 +58,12 @@ func resourceOpsGenieTeamCreate(d *schema.ResourceData, meta interface{}) error | |
client := meta.(*OpsGenieClient).teams | ||
|
||
name := d.Get("name").(string) | ||
description := d.Get("description").(string) | ||
|
||
createRequest := team.CreateTeamRequest{ | ||
Name: name, | ||
Members: expandOpsGenieTeamMembers(d), | ||
Name: name, | ||
Description: description, | ||
Members: expandOpsGenieTeamMembers(d), | ||
} | ||
|
||
log.Printf("[INFO] Creating OpsGenie team '%s'", name) | ||
|
@@ -118,6 +125,7 @@ func resourceOpsGenieTeamRead(d *schema.ResourceData, meta interface{}) error { | |
} | ||
|
||
d.Set("name", getResponse.Name) | ||
d.Set("description", getResponse.Description) | ||
d.Set("member", flattenOpsGenieTeamMembers(getResponse.Members)) | ||
|
||
return nil | ||
|
@@ -126,11 +134,13 @@ func resourceOpsGenieTeamRead(d *schema.ResourceData, meta interface{}) error { | |
func resourceOpsGenieTeamUpdate(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*OpsGenieClient).teams | ||
name := d.Get("name").(string) | ||
description := d.Get("description").(string) | ||
|
||
updateRequest := team.UpdateTeamRequest{ | ||
Id: d.Id(), | ||
Name: name, | ||
Members: expandOpsGenieTeamMembers(d), | ||
Id: d.Id(), | ||
Name: name, | ||
Description: description, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we pass an empty string, is this ok? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's caught by the HCL (which picks it up as a null value) |
||
Members: expandOpsGenieTeamMembers(d), | ||
} | ||
|
||
log.Printf("[INFO] Updating OpsGenie team '%s'", name) | ||
|
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass an empty string here is this ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep - it's caught by the HCL (which picks it up as a null value) - there's also tests for omitting/empty/completed values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep - it's caught by the HCL (which picks it up as a null value) - there's also tests for omitting/empty/completed values