@@ -56,6 +56,41 @@ func TestAccSumologicField_create(t *testing.T) {
5656 })
5757}
5858
59+ func TestAccSumologicField_update (t * testing.T ) {
60+ var field Field
61+ testFieldName := "fields_provider_test"
62+ testDataType := "String"
63+ testState := "Enabled"
64+ updatedState := "Disabled"
65+ resource .Test (t , resource.TestCase {
66+ PreCheck : func () { testAccPreCheck (t ) },
67+ Providers : testAccProviders ,
68+ CheckDestroy : testAccCheckFieldDestroy (field ),
69+ Steps : []resource.TestStep {
70+ {
71+ Config : testAccSumologicField (testFieldName , testDataType , testState ),
72+ Check : resource .ComposeTestCheckFunc (
73+ testAccCheckFieldExists ("sumologic_field.test" , & field , t ),
74+ testAccCheckFieldAttributes ("sumologic_field.test" ),
75+ resource .TestCheckResourceAttr ("sumologic_field.test" , "field_name" , testFieldName ),
76+ resource .TestCheckResourceAttr ("sumologic_field.test" , "data_type" , testDataType ),
77+ resource .TestCheckResourceAttr ("sumologic_field.test" , "state" , testState ),
78+ ),
79+ },
80+ {
81+ Config : testAccSumologicFieldUpdate (testFieldName , testDataType , updatedState ),
82+ Check : resource .ComposeTestCheckFunc (
83+ testAccCheckFieldExists ("sumologic_field.test" , & field , t ),
84+ testAccCheckFieldAttributes ("sumologic_field.test" ),
85+ resource .TestCheckResourceAttr ("sumologic_field.test" , "field_name" , testFieldName ),
86+ resource .TestCheckResourceAttr ("sumologic_field.test" , "data_type" , testDataType ),
87+ resource .TestCheckResourceAttr ("sumologic_field.test" , "state" , updatedState ),
88+ ),
89+ },
90+ },
91+ })
92+ }
93+
5994func testAccCheckFieldDestroy (field Field ) resource.TestCheckFunc {
6095 return func (s * terraform.State ) error {
6196 client := testAccProvider .Meta ().(* Client )
@@ -116,6 +151,16 @@ resource "sumologic_field" "test" {
116151` , fieldName , dataType , state )
117152}
118153
154+ func testAccSumologicFieldUpdate (fieldName string , dataType string , state string ) string {
155+ return fmt .Sprintf (`
156+ resource "sumologic_field" "test" {
157+ field_name = "%s"
158+ data_type = "%s"
159+ state = "%s"
160+ }
161+ ` , fieldName , dataType , state )
162+ }
163+
119164func testAccCheckFieldAttributes (name string ) resource.TestCheckFunc {
120165 return func (s * terraform.State ) error {
121166 f := resource .ComposeTestCheckFunc (
0 commit comments