diff --git a/docs/resources/connector.md b/docs/resources/connector.md index 8754a145..fcafcc75 100644 --- a/docs/resources/connector.md +++ b/docs/resources/connector.md @@ -24,6 +24,7 @@ resource "twingate_remote_network" "aws_network" { resource "twingate_connector" "aws_connector" { remote_network_id = twingate_remote_network.aws_network.id + status_updates_enabled = true } ``` @@ -37,7 +38,7 @@ resource "twingate_connector" "aws_connector" { ### Optional - `name` (String) Name of the Connector, if not provided one will be generated. -- `status_updates_enabled` (Boolean) Determines whether status notifications are enabled for the Connector. +- `status_updates_enabled` (Boolean) Determines whether status notifications are enabled for the Connector. Default is `true`. ### Read-Only diff --git a/examples/resources/twingate_connector/resource.tf b/examples/resources/twingate_connector/resource.tf index 1fceaed3..49bd461c 100644 --- a/examples/resources/twingate_connector/resource.tf +++ b/examples/resources/twingate_connector/resource.tf @@ -9,4 +9,5 @@ resource "twingate_remote_network" "aws_network" { resource "twingate_connector" "aws_connector" { remote_network_id = twingate_remote_network.aws_network.id + status_updates_enabled = true } \ No newline at end of file diff --git a/twingate/internal/provider/resource/connector.go b/twingate/internal/provider/resource/connector.go index f22f4f95..e9337368 100644 --- a/twingate/internal/provider/resource/connector.go +++ b/twingate/internal/provider/resource/connector.go @@ -91,7 +91,7 @@ func (r *connector) Schema(_ context.Context, _ resource.SchemaRequest, resp *re attr.StatusUpdatesEnabled: schema.BoolAttribute{ Optional: true, Computed: true, - Description: "Determines whether status notifications are enabled for the Connector.", + Description: "Determines whether status notifications are enabled for the Connector. Default is `true`.", }, // computed attr.ID: schema.StringAttribute{ @@ -115,8 +115,9 @@ func (r *connector) Create(ctx context.Context, req resource.CreateRequest, resp } conn, err := r.client.CreateConnector(ctx, &model.Connector{ - Name: plan.Name.ValueString(), - NetworkID: plan.RemoteNetworkID.ValueString(), + Name: plan.Name.ValueString(), + NetworkID: plan.RemoteNetworkID.ValueString(), + StatusUpdatesEnabled: getOptionalBool(plan.StatusUpdatesEnabled), }) r.helper(ctx, conn, &plan, &resp.State, &resp.Diagnostics, err, operationCreate) diff --git a/twingate/internal/test/acctests/resource/connector_test.go b/twingate/internal/test/acctests/resource/connector_test.go index 3b2e1acf..83d3bc91 100644 --- a/twingate/internal/test/acctests/resource/connector_test.go +++ b/twingate/internal/test/acctests/resource/connector_test.go @@ -282,3 +282,23 @@ func terraformResourceTwingateConnectorWithNotificationStatus(terraformRemoteNet } `, terraformResourceRemoteNetwork(terraformRemoteNetworkName, remoteNetworkName), terraformConnectorName, terraformRemoteNetworkName, notificationStatus) } + +func TestAccRemoteConnectorCreateWithNotificationStatusFalse(t *testing.T) { + const terraformResourceName = "test_c8" + theResource := acctests.TerraformConnector(terraformResourceName) + remoteNetworkName := test.RandomName() + + sdk.Test(t, sdk.TestCase{ + ProtoV6ProviderFactories: acctests.ProviderFactories, + PreCheck: func() { acctests.PreCheck(t) }, + CheckDestroy: acctests.CheckTwingateConnectorAndRemoteNetworkDestroy, + Steps: []sdk.TestStep{ + { + Config: terraformResourceTwingateConnectorWithNotificationStatus(terraformResourceName, terraformResourceName, remoteNetworkName, false), + Check: acctests.ComposeTestCheckFunc( + sdk.TestCheckResourceAttr(theResource, attr.StatusUpdatesEnabled, "false"), + ), + }, + }, + }) +}