Skip to content
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

Changed type of CategoryID to resolve read issues #64

Merged
merged 3 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jira/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type ProjectRequest struct {
IssueSecurityScheme int `json:"issueSecurityScheme,omitempty" structs:"issueSecurityScheme,omitempty"`
PermissionScheme int `json:"permissionScheme,omitempty" structs:"permissionScheme,omitempty"`
NotificationScheme int `json:"notificationScheme,omitempty" structs:"notificationScheme,omitempty"`
CategoryID int `json:"categoryId,omitempty" structs:"categoryId,omitempty"`
CategoryID string `json:"categoryId,omitempty" structs:"categoryId,omitempty"`
}

type SharedConfigurationProjectResponse struct {
Expand Down Expand Up @@ -154,7 +154,7 @@ func resourceProject() *schema.Resource {
Optional: true,
},
"category_id": &schema.Schema{
Type: schema.TypeInt,
Type: schema.TypeString,
Optional: true,
},
},
Expand Down Expand Up @@ -207,7 +207,7 @@ func resourceProjectCreate(d *schema.ResourceData, m interface{}) error {
IssueSecurityScheme: d.Get("issue_security_scheme").(int),
PermissionScheme: d.Get("permission_scheme").(int),
NotificationScheme: d.Get("notification_scheme").(int),
CategoryID: d.Get("category_id").(int),
CategoryID: d.Get("category_id").(string),
}

returnedProject := new(IDResponse)
Expand Down Expand Up @@ -289,7 +289,7 @@ func resourceProjectUpdate(d *schema.ResourceData, m interface{}) error {
IssueSecurityScheme: d.Get("issue_security_scheme").(int),
PermissionScheme: d.Get("permission_scheme").(int),
NotificationScheme: d.Get("notification_scheme").(int),
CategoryID: d.Get("category_id").(int),
CategoryID: d.Get("category_id").(string),
}
urlStr := fmt.Sprintf("%s/%s", projectAPIEndpoint, d.Id())

Expand Down
12 changes: 12 additions & 0 deletions jira/resource_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,18 @@ resource "jira_user" "foo" {
email = "[email protected]"
}

resource "jira_project_category" "category" {
name = "Managed"
description = "Managed Projects"
}

resource "jira_project" "foo" {
name = "foo-name-%d"
key = "PX%d"
lead = "${jira_user.foo.name}"
project_type_key = "business"
project_template_key = "com.atlassian.jira-core-project-templates:jira-core-project-management"
category_id = "${jira_project_category.category.id}"
}`, rInt, rInt, rInt%100000)
}

Expand All @@ -125,12 +131,18 @@ resource "jira_user" "foo" {
email = "[email protected]"
}

resource "jira_project_category" "category" {
name = "Managed"
description = "Managed Projects"
}

resource "jira_project" "foo" {
name = "foo-changed-name-%d"
key = "PX%d"
lead = "${jira_user.foo.name}"
project_type_key = "software"
project_template_key = "com.atlassian.jira-core-project-templates:jira-core-project-management"
category_id = "${jira_project_category.category.id}"
}`, rInt, rInt, rInt%100000)
}

Expand Down