Skip to content

create-v2-sg-rule-imports.sh succeeds but does not import correct SG rules #130

@bob-walker-nhs

Description

@bob-walker-nhs

CAVEAT

Raising this for visibility and possible discussion, but it's likely that List Reconciliation are the only consumer likely to experience this issue, and the confusion can be largely attributed to lack of Terraform experience.

Problem

The script mentioned in the CHANGELOG for v2.0.0 caused us some issues when migrating from the old client as it generated import statements that appeared to be correct, and ran without error, but did not import existing state correctly.

Probable cause

I think the root cause was because the imports generated referred to the import target were of the format e.g.

module.mesh.aws_security_group_rule.check_send_endpoints

but needed to be e.g.:

module.mesh[0].aws_security_group_rule.check_send_endpoints

(Note the index placeholder)

Discussion

I'm still not an experienced-enough Terraform user to understand the significance, only that the both forms reported "Import successful", but only the second form actually worked. I'm also not sure if that format with the index is unique to List Rec's use of the client.

We spent a long time re-running and head-scratching trying to understand what was going on here. It's entirely possible that Terraform knowledge-share and training is the real answer to this.

(As an aside, we also needed to add a --var-file= param to the output, which is clearly specific to us, but if this is required more widely, might a useful option addition to the script.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions