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

Migrate pack of datasources and resources to terraform plugin framework #816

Merged
merged 10 commits into from
May 2, 2024
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/hashicorp/terraform-exec v0.20.0
github.com/hashicorp/terraform-json v0.20.0
github.com/hashicorp/terraform-plugin-framework v1.5.0
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-go v0.20.0
github.com/hashicorp/terraform-plugin-mux v0.13.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ github.com/hashicorp/terraform-json v0.20.0 h1:cJcvn4gIOTi0SD7pIy+xiofV1zFA3hza+
github.com/hashicorp/terraform-json v0.20.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk=
github.com/hashicorp/terraform-plugin-framework v1.5.0 h1:8kcvqJs/x6QyOFSdeAyEgsenVOUeC/IyKpi2ul4fjTg=
github.com/hashicorp/terraform-plugin-framework v1.5.0/go.mod h1:6waavirukIlFpVpthbGd2PUNYaFedB0RwW3MDzJ/rtc=
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 h1:b8vZYB/SkXJT4YPbT3trzE6oJ7dPyMy68+9dEDKsJjE=
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0/go.mod h1:tP9BC3icoXBz72evMS5UTFvi98CiKhPdXF6yLs1wS8A=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg=
github.com/hashicorp/terraform-plugin-go v0.20.0 h1:oqvoUlL+2EUbKNsJbIt3zqqZ7wi6lzn4ufkn/UA51xQ=
Expand Down
76 changes: 0 additions & 76 deletions pagerduty/data_source_pagerduty_extension_schema.go

This file was deleted.

57 changes: 0 additions & 57 deletions pagerduty/data_source_pagerduty_extension_schema_test.go

This file was deleted.

75 changes: 0 additions & 75 deletions pagerduty/data_source_pagerduty_tag.go

This file was deleted.

11 changes: 3 additions & 8 deletions pagerduty/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ func Provider(isMux bool) *schema.Provider {
"pagerduty_user_contact_method": dataSourcePagerDutyUserContactMethod(),
"pagerduty_team": dataSourcePagerDutyTeam(),
"pagerduty_vendor": dataSourcePagerDutyVendor(),
"pagerduty_extension_schema": dataSourcePagerDutyExtensionSchema(),
"pagerduty_service": dataSourcePagerDutyService(),
"pagerduty_service_integration": dataSourcePagerDutyServiceIntegration(),
"pagerduty_business_service": dataSourcePagerDutyBusinessService(),
"pagerduty_priority": dataSourcePagerDutyPriority(),
"pagerduty_ruleset": dataSourcePagerDutyRuleset(),
"pagerduty_tag": dataSourcePagerDutyTag(),
"pagerduty_event_orchestration": dataSourcePagerDutyEventOrchestration(),
"pagerduty_event_orchestrations": dataSourcePagerDutyEventOrchestrations(),
"pagerduty_event_orchestration_integration": dataSourcePagerDutyEventOrchestrationIntegration(),
Expand All @@ -120,16 +118,12 @@ func Provider(isMux bool) *schema.Provider {
"pagerduty_user": resourcePagerDutyUser(),
"pagerduty_user_contact_method": resourcePagerDutyUserContactMethod(),
"pagerduty_user_notification_rule": resourcePagerDutyUserNotificationRule(),
"pagerduty_extension": resourcePagerDutyExtension(),
"pagerduty_extension_servicenow": resourcePagerDutyExtensionServiceNow(),
"pagerduty_event_rule": resourcePagerDutyEventRule(),
"pagerduty_ruleset": resourcePagerDutyRuleset(),
"pagerduty_ruleset_rule": resourcePagerDutyRulesetRule(),
"pagerduty_business_service": resourcePagerDutyBusinessService(),
"pagerduty_service_dependency": resourcePagerDutyServiceDependency(),
"pagerduty_response_play": resourcePagerDutyResponsePlay(),
"pagerduty_tag": resourcePagerDutyTag(),
"pagerduty_tag_assignment": resourcePagerDutyTagAssignment(),
"pagerduty_service_event_rule": resourcePagerDutyServiceEventRule(),
"pagerduty_slack_connection": resourcePagerDutySlackConnection(),
"pagerduty_business_service_subscriber": resourcePagerDutyBusinessServiceSubscriber(),
Expand All @@ -156,6 +150,7 @@ func Provider(isMux bool) *schema.Provider {

if isMux {
delete(p.DataSourcesMap, "pagerduty_business_service")

delete(p.ResourcesMap, "pagerduty_business_service")
}

Expand Down Expand Up @@ -213,7 +208,7 @@ func handleNotFoundError(err error, d *schema.ResourceData) error {
return genError(err, d)
}

func providerConfigureContextFunc(ctx context.Context, data *schema.ResourceData, terraformVersion string) (interface{}, diag.Diagnostics) {
func providerConfigureContextFunc(_ context.Context, data *schema.ResourceData, terraformVersion string) (interface{}, diag.Diagnostics) {
var diags diag.Diagnostics
serviceRegion := strings.ToLower(data.Get("service_region").(string))

Expand Down Expand Up @@ -243,7 +238,7 @@ func providerConfigureContextFunc(ctx context.Context, data *schema.ResourceData
if err := validateAuthMethodConfig(data); err != nil {
diag := diag.Diagnostic{
Severity: diag.Warning,
Summary: fmt.Sprint("`token` and `use_app_oauth_scoped_token` are both configured at the same time"),
Summary: "`token` and `use_app_oauth_scoped_token` are both configured at the same time",
Detail: err.Error(),
}
diags = append(diags, diag)
Expand Down
Loading
Loading