Skip to content

Commit

Permalink
slight fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
irubnich committed Jan 3, 2025
1 parent 35cea7d commit da31417
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions datadog/fwprovider/data_source_datadog_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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) {
Expand All @@ -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,
},
},
}
}
Expand All @@ -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...)
}
6 changes: 4 additions & 2 deletions datadog/fwprovider/resource_datadog_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit da31417

Please sign in to comment.