-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fusion auth reactor resource #106
Add fusion auth reactor resource #106
Conversation
b33d365
to
1ede645
Compare
client := i.(Client) | ||
reactor := buildReactor(data) | ||
|
||
resp, faErrs, err := client.FAClient.ActivateReactor(fusionauth.ReactorRequest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the create and update paths use the ActivateReactor
method.
There really is no "create" endpoint for the reactor because it always exists, this endpoint sets the license data (for the first time or any subsequent times).
1ede645
to
1b57c7a
Compare
} | ||
|
||
if err := checkResponse(resp.StatusCode, faErrs); err != nil { | ||
data.Partial(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During local testing we discovered that the terraform state got updated even if the resource failed to update in FusionAuth. This is true of other resources too (we check with the webhook). After a little googling, we discovered this little snippet of code data.Partial(true)
which tells terraform that something went wrong and not to update the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @melm73.
I don't have any strong opinions here, and I am not a Terraform expert, so feel free to ignore my comments.
Since this isn't really a traditional CRUD as @melm73 mentions - would it read better to use function names such as:
activate()
This could in theory replace bothcreateReactor
andupdateReactor
since the only two states are licensed and un-licensed, so updating just re-activates with a different license key.decommission()
Depends on how far we want to go with the Nuclear Reactor theme. 😁Could also usedeactivate
.status()
The read operation currently returns the license status of the FusionAuth instance.
@melm73 thanks for your contributions. Pushing this and building |
This PR adds the FusionAuth reactor as a terraform resource.
The reactor apis aren't standard CRUD apis, so this implementation is a little different:
I've left some comments in the code where things are a little different than for a normal resource.