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

resource/aws_route_table: Fix route table import to avoid deleting routes #5657

Merged
merged 2 commits into from
Feb 23, 2019

Commits on Dec 26, 2018

  1. Fix route table importing to avoid route deletion

    Import route tables using inline routes in the resource data. This
    is the same way resource data is structured when routes tables are
    read (and created) which enables imports to line up properly with
    existing resources.
    
    Previously, if you applied a state that included the import of a
    route table, all routes in the route table would be deleted. This
    bug occurred because the import function
    (resourceAwsRouteTableImportState()) would return a target state
    including both a route table resource and separate route resources
    for each route. The route table read function
    (resourceAwsRouteTableRead()) returns a state with a route table
    resource having inline routes. Despite being equivalent, since the
    states did not match, Terraform would delete all routes in the
    route table when applying the change plan.
    
    Fixes hashicorp#5631
    
    Update functions names to comply with convention
    
    This commit is planned to occur after PR hashicorp#5687 which changes the
    names of these functions. In order to avoid merge conflicts at that
    time, this pre-emptively renames the functions.
    YakDriver committed Dec 26, 2018
    Configuration menu
    Copy the full SHA
    3f472eb View commit details
    Browse the repository at this point in the history
  2. Improve acceptance tests for route table import

    Use checks that align with inline routes in the state. Improve
    tests to avoid network values that will conflict with fewer AWS
    accounts.
    
    Previously, route table import acceptance tests only checked the
    length of the state (1 for route table, and 1 for each separate
    route resource). This simple test did not check much, especially
    when checking route tables with inline routes.
    
    Now, the state is checked to make sure it has routes and a route-
    count attribute that matches to expected value.
    YakDriver committed Dec 26, 2018
    Configuration menu
    Copy the full SHA
    68f28fa View commit details
    Browse the repository at this point in the history