terraform-provider-sumologic icon indicating copy to clipboard operation
terraform-provider-sumologic copied to clipboard

INVS-0: upgrade the provider to v2 SDK.

Open pdziedzic-sumo opened this issue 1 year ago • 0 comments

golang version is updated to 1.22.

Upgrade was performed semi-automatically with the tf-sdk-migrator tool.

Manual changes:

  • Manual changes had to be made afterwards in the provider.go and provider_test.go files per Removal of terraform.ResourceProvider interface section.

  • sumologic/resource_sumologic_cse_entity_normalization_configuration.go - fixed field names (typo)

Other file changes are boiling down to updating module import paths.

The v1 provider SDK is no longer maintained by Terraform.

This upgrade was triggered by the investigation of INVS-2114 showing that v1 SDK has limited capabilities in terms of verifying the plan generated in tests. V2 SDK has better support for running the tests from IDE + debugging.

V2 plugin SDK will by default print out the plan as seen in user environment:

    Terraform used the selected providers to generate the following execution
    plan. Resource actions are indicated with the following symbols:
      ~ update in-place

    Terraform will perform the following actions:

      # sumologic_cse_match_list.match_list will be updated in-place
      ~ resource "sumologic_cse_match_list" "match_list" {
            id              = "183"
            name            = "Terraform Test Match List 4d5da4fa-a7e9-4710-9722-66b0d88fff01"
            # (7 unchanged attributes hidden)

          - items {
              - description = "Match List Item Description 0" -> null
              - expiration  = "2122-02-27T04:00:00+00:00" -> null
              - id          = "1ff1de77400538da93f42943881c655f6faeb48c34bb36c2a4846474894e15685465727261666f726d2054657374204d61746368204c6973742034643564613466612d613765392d343731302d393732322d363662306438386666663031" -> null
              - value       = "value 0" -> null
            }
          - items {
              - description = "Match List Item Description 1" -> null
              - expiration  = "2122-02-27T04:00:00+00:00" -> null
              - id          = "1ff1de77400538da93f42943881c655ff979463b0b4e3f91a3cda7ee49c8cb825465727261666f726d2054657374204d61746368204c6973742034643564613466612d613765392d343731302d393732322d363662306438386666663031" -> null
              - value       = "value 1" -> null
            }
          - items {
              - description = "Match List Item Description 2" -> null
              - expiration  = "2122-02-27T04:00:00+00:00" -> null
              - id          = "1ff1de77400538da93f42943881c655fff40575ddd0c39b4b60d9885cd070d325465727261666f726d2054657374204d61746368204c6973742034643564613466612d613765392d343731302d393732322d363662306438386666663031" -> null
              - value       = "value 2" -> null
            }
          + items {
              + description = "Match List Item Description 0"
              + expiration  = "2122-02-27T04:00:00"
              + id          = (known after apply)
              + value       = "value 0"
            }
          + items {
              + description = "Match List Item Description 1"
              + expiration  = "2122-02-27T04:00:00"
              + id          = (known after apply)
              + value       = "value 1"
            }
          + items {
              + description = "Match List Item Description 2"
              + expiration  = "2122-02-27T04:00:00"
              + id          = (known after apply)
              + value       = "value 2"
            }
        }

pdziedzic-sumo avatar Apr 24 '24 10:04 pdziedzic-sumo