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

Tf fixes #219

Merged
merged 4 commits into from
Feb 12, 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
7 changes: 6 additions & 1 deletion internal/resources/resource_dhcp_server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2022 Hewlett Packard Enterprise Development LP
// (C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP

package resources

Expand All @@ -19,6 +19,11 @@ func DhcpServer() *schema.Resource {
Required: true,
Description: "Provide the DHCP server name",
},
"provider_id": {
Type: schema.TypeString,
Computed: true,
Description: "ProviderId of the DHCP Server. Use the provider_id while creating DHCP NSX-T Segment Network",
},
"network_server_id": {
Type: schema.TypeInt,
Description: "NSX-T Integration ID",
Expand Down
33 changes: 20 additions & 13 deletions internal/resources/resource_router_route.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package resources

Expand All @@ -25,47 +25,55 @@ func RouterRoute() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "Name of the route.",
ForceNew: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: "Description for the route.",
ForceNew: true,
},
"enabled": {
Type: schema.TypeBool,
Default: true,
Optional: true,
Description: "If `true` then route will be active/enabled.",
ForceNew: true,
},
"default_route": {
Type: schema.TypeBool,
Default: false,
Optional: true,
Description: "If `true` then the route will considered as the default route.",
ForceNew: true,
},
"network": {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: validations.ValidateCidr,
Description: "Source Network CIDR Address",
ForceNew: true,
},
"next_hop": {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: validations.ValidateIPAddress,
Description: "Next Hop/Destination IPv4 Address",
ForceNew: true,
},
"mtu": {
Type: schema.TypeInt,
Optional: true,
Description: "Network MTU",
ForceNew: true,
},
"priority": {
Type: schema.TypeInt,
Optional: true,
Default: 100,
Description: "Priority for the route",
ValidateDiagFunc: validations.IntAtLeast(1),
ForceNew: true,
},
"is_deprecated": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -95,7 +103,6 @@ func RouterRoute() *schema.Resource {
},
ReadContext: routerRouteReadContext,
CreateContext: routerRouteCreateContext,
UpdateContext: routerRouteUpdateContext,
DeleteContext: routerRouteDeleteContext,
Description: `Router route resource facilitates creating,
updating and deleting NSX-T Network Router routes.`,
Expand Down Expand Up @@ -139,19 +146,19 @@ func routerRouteCreateContext(ctx context.Context, rd *schema.ResourceData, meta
return routerRouteReadContext(ctx, rd, meta)
}

func routerRouteUpdateContext(ctx context.Context, rd *schema.ResourceData, meta interface{}) diag.Diagnostics {
c, err := client.GetClientFromMetaMap(meta)
if err != nil {
return diag.FromErr(err)
}
// func routerRouteUpdateContext(ctx context.Context, rd *schema.ResourceData, meta interface{}) diag.Diagnostics {
// c, err := client.GetClientFromMetaMap(meta)
// if err != nil {
// return diag.FromErr(err)
// }

data := utils.NewData(rd)
if err := c.CmpClient.RouterRoute.Update(ctx, data, meta); err != nil {
return diag.FromErr(err)
}
// data := utils.NewData(rd)
// if err := c.CmpClient.RouterRoute.Update(ctx, data, meta); err != nil {
// return diag.FromErr(err)
// }

return routerRouteReadContext(ctx, rd, meta)
}
// return routerRouteReadContext(ctx, rd, meta)
// }

func routerRouteDeleteContext(ctx context.Context, rd *schema.ResourceData, meta interface{}) diag.Diagnostics {
c, err := client.GetClientFromMetaMap(meta)
Expand Down
Loading