@@ -276,9 +276,14 @@ func TestAccResourceIntegrationPolicySecrets(t *testing.T) {
276276 "policy_name" : config .StringVariable (policyName ),
277277 "secret_key" : config .StringVariable ("updated" ),
278278 },
279- ImportState : true ,
280- ImportStateVerify : true ,
281- ImportStateVerifyIgnore : []string {"vars_json" , "space_ids" },
279+ ImportState : true ,
280+ ImportStateVerify : true ,
281+ ImportStateVerifyIgnore : []string {
282+ "vars_json" ,
283+ "space_ids" ,
284+ "inputs.aws_logs-aws-cloudwatch.defaults" ,
285+ "inputs.aws_logs-aws-s3.defaults" ,
286+ },
282287 Check : resource .ComposeTestCheckFunc (
283288 resource .TestMatchResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "vars_json" , regexp .MustCompile (`{"access_key_id":{"id":"\S+","isSecretRef":true},"default_region":"us-east-2","endpoint":"endpoint","secret_access_key":{"id":"\S+","isSecretRef":true},"session_token":{"id":"\S+","isSecretRef":true}}` )),
284289 ),
@@ -398,6 +403,40 @@ func TestAccIntegrationPolicyInputs(t *testing.T) {
398403 resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-logfile.enabled" , "false" ),
399404 ),
400405 },
406+ {
407+ ProtoV6ProviderFactories : acctest .Providers ,
408+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minVersionIntegrationPolicy ),
409+ ConfigDirectory : acctest .NamedTestCaseDirectory ("minimal" ),
410+ ConfigVariables : config.Variables {
411+ "policy_name" : config .StringVariable (policyName ),
412+ },
413+ Check : resource .ComposeTestCheckFunc (
414+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "name" , policyName ),
415+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "description" , "Kafka Integration Policy - Minimal" ),
416+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "integration_name" , "kafka" ),
417+ // Check specified inputs
418+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-logfile.enabled" , "false" ),
419+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-kafka/metrics.enabled" , "true" ),
420+ // Check unspecified, disabled by default input
421+ resource .TestCheckNoResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-jolokia/metrics" ),
422+ ),
423+ },
424+ {
425+ ProtoV6ProviderFactories : acctest .Providers ,
426+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minVersionIntegrationPolicy ),
427+ ConfigDirectory : acctest .NamedTestCaseDirectory ("unset" ),
428+ ConfigVariables : config.Variables {
429+ "policy_name" : config .StringVariable (policyName ),
430+ },
431+ Check : resource .ComposeTestCheckFunc (
432+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "name" , policyName ),
433+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "description" , "Kafka Integration Policy - Minimal" ),
434+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "integration_name" , "kafka" ),
435+ // Check previously specified inputs
436+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-logfile.enabled" , "false" ),
437+ resource .TestCheckResourceAttr ("elasticstack_fleet_integration_policy.test_policy" , "inputs.kafka-kafka/metrics.enabled" , "true" ),
438+ ),
439+ },
401440 },
402441 })
403442}
0 commit comments