Skip to content

Commit

Permalink
Add missing webhook url field (#525)
Browse files Browse the repository at this point in the history
* Add missing webhook url field

* endpoint test checks webhook_url field exists

---------

Co-authored-by: David Bloss <david@opslevel.com>
  • Loading branch information
rocktavious and davidbloss authored Oct 25, 2024
1 parent b25d4fc commit 3ddb840
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions opslevel/resource_opslevel_integration_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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,
},
},
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/integration_endpoint.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3ddb840

Please sign in to comment.