diff --git a/docs/plugins/crowdstrike/data-sources/falcon_cspm_ioms.md b/docs/plugins/crowdstrike/data-sources/falcon_cspm_ioms.md index b66fe9ac..bafe03ba 100644 --- a/docs/plugins/crowdstrike/data-sources/falcon_cspm_ioms.md +++ b/docs/plugins/crowdstrike/data-sources/falcon_cspm_ioms.md @@ -80,8 +80,8 @@ The data source supports the following execution arguments: data falcon_cspm_ioms { # limit the number of queried items # - # Required integer. - # For example: - size = 42 + # Optional integer. + # Default value: + limit = 10 } ``` \ No newline at end of file diff --git a/docs/plugins/plugins.json b/docs/plugins/plugins.json index ca7d0479..c5c9f4e5 100644 --- a/docs/plugins/plugins.json +++ b/docs/plugins/plugins.json @@ -148,7 +148,7 @@ "member_cid" ], "arguments": [ - "size" + "limit" ] }, { diff --git a/internal/crowdstrike/data_falcon_cspm_ioms.go b/internal/crowdstrike/data_falcon_cspm_ioms.go index 405aecc4..7d230b79 100644 --- a/internal/crowdstrike/data_falcon_cspm_ioms.go +++ b/internal/crowdstrike/data_falcon_cspm_ioms.go @@ -23,9 +23,10 @@ func makeFalconCspmIomsDataSource(loader ClientLoaderFn) *plugin.DataSource { Args: &dataspec.RootSpec{ Attrs: []*dataspec.AttrSpec{ { - Name: "size", + Name: "limit", Type: cty.Number, - Constraints: constraint.Integer | constraint.RequiredNonNull, + Constraints: constraint.Integer, + DefaultVal: cty.NumberIntVal(10), Doc: "limit the number of queried items", }, }, @@ -43,7 +44,7 @@ func fetchFalconCspmIomsData(loader ClientLoaderFn) plugin.RetrieveDataFunc { Detail: err.Error(), }} } - size, _ := params.Args.GetAttrVal("size").AsBigFloat().Int64() + size, _ := params.Args.GetAttrVal("limit").AsBigFloat().Int64() apiParams := cspm_registration.NewGetConfigurationDetectionsParams().WithDefaults() apiParams.SetLimit(&size) apiParams.Context = ctx diff --git a/internal/crowdstrike/data_falcon_cspm_ioms_test.go b/internal/crowdstrike/data_falcon_cspm_ioms_test.go index 1dd419c3..275916ab 100644 --- a/internal/crowdstrike/data_falcon_cspm_ioms_test.go +++ b/internal/crowdstrike/data_falcon_cspm_ioms_test.go @@ -91,7 +91,7 @@ func (s *CrowdstrikeCspmIomsTestSuite) TestBasic() { SetAttr("client_secret", cty.StringVal("test")). Decode(), Args: plugintest.NewTestDecoder(s.T(), s.plugin.DataSources["falcon_cspm_ioms"].Args). - SetAttr("size", cty.NumberIntVal(10)). + SetAttr("limit", cty.NumberIntVal(10)). Decode(), }) s.Require().Nil(diags) @@ -131,7 +131,7 @@ func (s *CrowdstrikeCspmIomsTestSuite) TestPayloadErrors() { SetAttr("client_secret", cty.StringVal("test")). Decode(), Args: plugintest.NewTestDecoder(s.T(), s.plugin.DataSources["falcon_cspm_ioms"].Args). - SetAttr("size", cty.NumberIntVal(10)). + SetAttr("limit", cty.NumberIntVal(10)). Decode(), }) diagtest.Asserts{{ @@ -153,7 +153,7 @@ func (s *CrowdstrikeCspmIomsTestSuite) TestError() { SetAttr("client_secret", cty.StringVal("test")). Decode(), Args: plugintest.NewTestDecoder(s.T(), s.plugin.DataSources["falcon_cspm_ioms"].Args). - SetAttr("size", cty.NumberIntVal(10)). + SetAttr("limit", cty.NumberIntVal(10)). Decode(), }) diagtest.Asserts{{ @@ -162,14 +162,3 @@ func (s *CrowdstrikeCspmIomsTestSuite) TestError() { diagtest.DetailContains("something went wrong"), }}.AssertMatch(s.T(), diags, nil) } - -func (s *CrowdstrikeCspmIomsTestSuite) TestMissingArgs() { - plugintest.NewTestDecoder( - s.T(), - s.plugin.DataSources["falcon_cspm_ioms"].Args, - ).Decode([]diagtest.Assert{ - diagtest.IsError, - diagtest.SummaryEquals("Missing required attribute"), - diagtest.DetailContains("size"), - }) -} diff --git a/internal/crowdstrike/data_falcon_discover_host_details_test.go b/internal/crowdstrike/data_falcon_discover_host_details_test.go index cf43bce9..ef361ddd 100644 --- a/internal/crowdstrike/data_falcon_discover_host_details_test.go +++ b/internal/crowdstrike/data_falcon_discover_host_details_test.go @@ -163,14 +163,3 @@ func (s *CrowdstrikeDiscoverHostDetailsTestSuite) TestError() { diagtest.DetailContains("something went wrong"), }}.AssertMatch(s.T(), diags, nil) } - -func (s *CrowdstrikeDiscoverHostDetailsTestSuite) TestMissingArgs() { - plugintest.NewTestDecoder( - s.T(), - s.Datasource().Args, - ).Decode([]diagtest.Assert{ - diagtest.IsError, - diagtest.SummaryEquals("Missing required attribute"), - diagtest.DetailContains("limit"), - }) -}