Skip to content

Conversation

daemitus
Copy link
Contributor

So there's a number of problems that cropped up.

  • When an integration is uninstalled outside of terraform, the change is not picked up. A 404 is not returned. Instead, a 200 item.status="not_installed" is. Requiring a switch to ReadPackageWithResponse and updating getschema (again).
  • The schema was wrong (again). The entirety of allOf.1 needs to be under .item which is present in allOf.0. All the more reason to get the Pull newer fleet schema #834 to a satisfactory state.
  • Uninstall does not return a 404 like most other delete methods, but a 400 message="name is not installed". So switch to DeletePackageWithResponse.
  • Since there's only one non-WithResponse method left at this point in all of fleet, switch InstallPackage to it as well. Does all the body reading for us.
  • fleet_integration create and update pass respDiags by value instead of pointer, so if a diag is actually added, it doesn't end up back in the caller.
    Actual:
    resource_test.go:76: Step 1/2 error: Error running apply: exit status 1
        Error: Missing Resource State After Create

Expected (using ti_abusech on one of the older stack versions):

    resource_test.go:76: Step 1/2 error: Error running apply: exit status 1
        Error: Unexpected status code from server: got HTTP 500

@daemitus
Copy link
Contributor Author

Additionally, I need to check if the diags by value issue is also in all the utils/tfsdk.go helper methods.

type ListMeta struct {
	Index int
	Path  path.Path
	Diags diag.Diagnostics
}

type MapMeta struct {
	Key   string
	Path  path.Path
	Diags diag.Diagnostics
}

@daemitus daemitus marked this pull request as ready for review October 17, 2024 15:25
Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 couple of minor comments on the code.

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it, 🎉

@tobio tobio merged commit f2d5a9e into elastic:main Oct 23, 2024
20 checks passed
@daemitus daemitus deleted the epm branch October 24, 2024 15:34
kjwardy pushed a commit to kjwardy/terraform-provider-elasticstack that referenced this pull request Nov 19, 2024
* fix epm

* changelog

* Update internal/fleet/integration/resource_test.go

Co-authored-by: Toby Brain <[email protected]>

* Update internal/fleet/integration/resource_test.go

Co-authored-by: Toby Brain <[email protected]>

* Update internal/fleet/integration/resource_test.go

Co-authored-by: Toby Brain <[email protected]>

* Update internal/clients/fleet/fleet.go

Co-authored-by: Toby Brain <[email protected]>

* import and formatting

* i should really fmt locally first

---------

Co-authored-by: Toby Brain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants