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

Support Private IP for Instance create #210

Merged
merged 2 commits into from
May 7, 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
11 changes: 10 additions & 1 deletion civo/instances/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ func ResourceInstance() *schema.Resource {
Computed: true,
Description: "Timestamp when the instance was created",
},
"private_ipv4": {
Type: schema.TypeString,
Optional: true,
Description: "The private IPv4 address for the instance (optional)",
},
"reserved_ipv4": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -216,6 +221,10 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, m inter
config.PublicIPRequired = attr.(string)
}

if privateIPv4, ok := d.GetOk("private_ipv4"); ok {
config.PrivateIPv4 = privateIPv4.(string)
}

if v, ok := d.GetOk("reserved_ipv4"); ok {
config.ReservedIPv4 = v.(string)
}
Expand Down Expand Up @@ -471,7 +480,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, m inter
func resourceInstanceDelete(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
apiClient := m.(*civogo.Client)

// overwrite the region if is define in the datasource
// overwrite the region if is defined in the datasource
if region, ok := d.GetOk("region"); ok {
apiClient.Region = region.(string)
}
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/civo/terraform-provider-civo

require (
github.com/civo/civogo v0.3.68
github.com/civo/civogo v0.3.69
github.com/google/uuid v1.3.1
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.18.0
golang.org/x/crypto v0.21.0
k8s.io/api v0.29.1
)

Expand Down Expand Up @@ -59,8 +59,8 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
Expand Down
Loading
Loading