diff --git a/datadog/fwprovider/data_source_datadog_connection.go b/datadog/fwprovider/data_source_datadog_connection.go index 8c139ead8b..c726ff8aca 100644 --- a/datadog/fwprovider/data_source_datadog_connection.go +++ b/datadog/fwprovider/data_source_datadog_connection.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/terraform-providers/terraform-provider-datadog/datadog/internal/utils" ) var _ datasource.DataSource = &connectionDatasource{} @@ -22,8 +21,7 @@ func NewDatadogConnectionDataSource() datasource.DataSource { } type datadogConnectionDatasourceModel struct { - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` + ID types.String `tfsdk:"id"` } func (d *connectionDatasource) Configure(_ context.Context, request datasource.ConfigureRequest, response *datasource.ConfigureResponse) { @@ -38,9 +36,12 @@ func (d *connectionDatasource) Metadata(_ context.Context, request datasource.Me func (d *connectionDatasource) Schema(_ context.Context, request datasource.SchemaRequest, response *datasource.SchemaResponse) { response.Schema = schema.Schema{ - Description: "Use this data source to retrieve information about an existing connection, for use in other resources.", + Description: "Use this data source to retrieve information about an existing connection.", Attributes: map[string]schema.Attribute{ - "id": utils.ResourceIDAttribute(), + "id": schema.StringAttribute{ + Description: "ID for Connection.", + Required: true, + }, }, } } @@ -53,7 +54,6 @@ func (d *connectionDatasource) Read(ctx context.Context, request datasource.Read return } - state.ID = types.StringValue("hi") diags = response.State.Set(ctx, &state) response.Diagnostics.Append(diags...) } diff --git a/datadog/fwprovider/resource_datadog_connection.go b/datadog/fwprovider/resource_datadog_connection.go index ff84fae481..fade647387 100644 --- a/datadog/fwprovider/resource_datadog_connection.go +++ b/datadog/fwprovider/resource_datadog_connection.go @@ -394,8 +394,10 @@ func (r *connectionResource) Create(ctx context.Context, request resource.Create } state.ID = types.StringValue("created ID") - state.AWS.AssumeRole.ExternalID = types.StringValue("extid") - state.AWS.AssumeRole.PrincipalID = types.StringValue("princid") + if state.AWS != nil { + state.AWS.AssumeRole.ExternalID = types.StringValue("extid") + state.AWS.AssumeRole.PrincipalID = types.StringValue("princid") + } diags = response.State.Set(ctx, &state) response.Diagnostics.Append(diags...)