Closed dobarx closed 1 year ago
@adamconnelly
So what if we flipped it slightly:
- Try to invoke the enable/disable mutation. I'm assuming it'll fail if the stack doesn't exist / you don't have access to it (but you'd need to double check that).
- Call
resourceStackActivatorRead
to query for the stack, and set the state based on theIsDisabled
field.Just a thought - feel free to ignore me if that doesn't make sense for some reason.
But how do we know which mutation to invoke? We have two separate mutations stackDisable(id)
& stackEnable(id)
.
I do not know which to call unless I query stack first and compare. It would only be possible if we had something like setStackEnabled(id, value)
.
@adamconnelly
So what if we flipped it slightly:
- Try to invoke the enable/disable mutation. I'm assuming it'll fail if the stack doesn't exist / you don't have access to it (but you'd need to double check that).
- Call
resourceStackActivatorRead
to query for the stack, and set the state based on theIsDisabled
field.Just a thought - feel free to ignore me if that doesn't make sense for some reason.
But how do we know which mutation to invoke? We have two separate mutations
stackDisable(id)
&stackEnable(id)
. I do not know which to call unless I query stack first and compare. It would only be possible if we had something likesetStackEnabled(id, value)
.
I guess I figured you'd know which one to call based on the value of the enabled
Terraform property. But maybe that doesn't handle the situation where the stack is enabled but the Terraform state thinks it's disabled or something like that?
@adamconnelly
So what if we flipped it slightly:
- Try to invoke the enable/disable mutation. I'm assuming it'll fail if the stack doesn't exist / you don't have access to it (but you'd need to double check that).
- Call
resourceStackActivatorRead
to query for the stack, and set the state based on theIsDisabled
field.Just a thought - feel free to ignore me if that doesn't make sense for some reason.
But how do we know which mutation to invoke? We have two separate mutations
stackDisable(id)
&stackEnable(id)
. I do not know which to call unless I query stack first and compare. It would only be possible if we had something likesetStackEnabled(id, value)
.I guess I figured you'd know which one to call based on the value of the
enabled
Terraform property. But maybe that doesn't handle the situation where the stack is enabled but the Terraform state thinks it's disabled or something like that?
I could use this d.GetChange("enabled")
to get old and new values of TF state. But I figured if stack is enabled/disabled by other process then this could lead to the issue when applying changes fail. So retrieving current state before applying these changes seems a bit safer.
@dobarx ok - no worries. Makes sense.
Description of the change
Created a new resource for enabling/disabling Spacelift stacks. Example:
Type of change
Related issues
Checklists
Development
false
.)go generate
to make sure the docs are up to dateCode review