From 3ddb840b91b7b6e9fb209d663575f66d5d41ee6f Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 25 Oct 2024 13:58:42 -0500 Subject: [PATCH] Add missing webhook url field (#525) * Add missing webhook url field * endpoint test checks webhook_url field exists --------- Co-authored-by: David Bloss --- .../resource_opslevel_integration_endpoint.go | 18 ++++++++++++------ tests/integration_endpoint.tftest.hcl | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/opslevel/resource_opslevel_integration_endpoint.go b/opslevel/resource_opslevel_integration_endpoint.go index e6ddf339..6e866baa 100644 --- a/opslevel/resource_opslevel_integration_endpoint.go +++ b/opslevel/resource_opslevel_integration_endpoint.go @@ -32,16 +32,18 @@ type IntegrationEndpointResource struct { // IntegrationEndpointResourceModel describes the Integration Endpoint managed resource. type IntegrationEndpointResourceModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Type types.String `tfsdk:"type"` + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Type types.String `tfsdk:"type"` + WebhookURL types.String `tfsdk:"webhook_url"` } func NewIntegrationEndpointResourceModel(integrationEndpoint opslevel.Integration, givenModel IntegrationEndpointResourceModel) IntegrationEndpointResourceModel { return IntegrationEndpointResourceModel{ - Id: ComputedStringValue(string(integrationEndpoint.Id)), - Name: RequiredStringValue(integrationEndpoint.Name), - Type: RequiredStringValue(givenModel.Type.ValueString()), + Id: ComputedStringValue(string(integrationEndpoint.Id)), + Name: RequiredStringValue(integrationEndpoint.Name), + Type: RequiredStringValue(givenModel.Type.ValueString()), + WebhookURL: ComputedStringValue(*integrationEndpoint.WebhookURL), } } @@ -79,6 +81,10 @@ func (r *IntegrationEndpointResource) Schema(ctx context.Context, req resource.S stringplanmodifier.RequiresReplace(), }, }, + "webhook_url": schema.StringAttribute{ + Description: "The endpoint to send events via webhook (if applicable).", + Computed: true, + }, }, } } diff --git a/tests/integration_endpoint.tftest.hcl b/tests/integration_endpoint.tftest.hcl index d1af3bc1..625f7023 100644 --- a/tests/integration_endpoint.tftest.hcl +++ b/tests/integration_endpoint.tftest.hcl @@ -240,6 +240,7 @@ run "resource_integration_endpoint_create_deploy_type" { can(opslevel_integration_endpoint.this.id), can(opslevel_integration_endpoint.this.name), can(opslevel_integration_endpoint.this.type), + can(opslevel_integration_endpoint.this.webhook_url), ]) error_message = replace(var.error_unexpected_resource_fields, "TYPE", var.resource_name) }