Skip to content
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

fix: agent id change requires recreate #81

Merged
merged 1 commit into from
Apr 29, 2024
Merged

fix: agent id change requires recreate #81

merged 1 commit into from
Apr 29, 2024

Conversation

johanneswuerbach
Copy link
Contributor

Changing the agent id requires the agent resource to be recreated.

@@ -57,6 +59,9 @@ func (*Agent) Schema(ctx context.Context, req resource.SchemaRequest, resp *reso
"id": schema.StringAttribute{
MarkdownDescription: "The ID of the Agent.",
Required: true,
PlanModifiers: []planmodifier.String{
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that the agent with the old id is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, RequiresReplace indicates that this attribute can't be updated in-place and instead the old one needs to be deleted and a new resource needs to be created.

We also use this for example for applications: https://github.com/humanitec/terraform-provider-humanitec/blob/main/internal/provider/resource_application.go#L69

Copy link
Contributor

@delca85 delca85 left a comment

Choose a reason for hiding this comment

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

👍

@johanneswuerbach johanneswuerbach merged commit b832b94 into main Apr 29, 2024
2 checks passed
@johanneswuerbach johanneswuerbach deleted the agent-id branch April 29, 2024 13:09
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