Skip to content

Add GenerateConfig testing mode to ImportState testing#638

Merged
SBGoods merged 6 commits intomainfrom
SBGoods/generate-config-mode
Apr 8, 2026
Merged

Add GenerateConfig testing mode to ImportState testing#638
SBGoods merged 6 commits intomainfrom
SBGoods/generate-config-mode

Conversation

@SBGoods
Copy link
Copy Markdown
Contributor

@SBGoods SBGoods commented Mar 25, 2026

Description

Adds a GenerateConfig testing mode to import mode testing. This mode runs an import plan with -generate-config-out flag and throws an error if there is a diff produced in the plan when compared to the state in the previous step.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
N/A

@SBGoods SBGoods requested a review from a team as a code owner March 25, 2026 14:25
Copy link
Copy Markdown
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

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

Looks good to me! Only one small question but that can be followed-up / your choice whether to address :)

})
if err != nil {
t.Fatalf("removing resource %s from copied state: %s", resourceName, err)
if !step.GenerateConfig {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add a command why we don't delete the resource in this case? Is it deleted later through some cleanup or something instead?

Comment on lines +534 to +535
// GenerateResourceConfig RPC is unimplemented, returning a null generated
// config to Terraform Core.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good comment!

@SBGoods SBGoods merged commit 2699d69 into main Apr 8, 2026
46 checks passed
@SBGoods SBGoods deleted the SBGoods/generate-config-mode branch April 8, 2026 14:57
@SBGoods SBGoods added this to the v1.16.0 milestone Apr 8, 2026
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.

3 participants