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

Handle resources with "miss-target" gracefully #81

Open
camrossi opened this issue Jul 28, 2022 · 0 comments
Open

Handle resources with "miss-target" gracefully #81

camrossi opened this issue Jul 28, 2022 · 0 comments

Comments

@camrossi
Copy link

I had this issues with a aci_epg_to_contract but can happen for other resources as well.

Importing an EPG with contracts deployed with "miss-target" states result in the generation of a broken config:
For example assume this config:
image

Will generate a broken state config:

resource "aci_epg_to_contract" "tfer--fvRsCons_IN-alltraffic_43" {
  annotation         = ""
  application_epg_dn = "${data.terraform_remote_state.local.outputs.aci_application_epg_tfer--fvAEPg_mpc-sPBR-clients_75_id}"
  contract_type      = "consumer"
  prio               = "unspecified"
} 

Missing the mandatory contract_dn attribute that won't deploy:

Error: Missing required argument
 on resources.tf line 1069, in resource "aci_epg_to_contract" "tfer--fvRsCons_IN-alltraffic_43":
1069: resource "aci_epg_to_contract" "tfer--fvRsCons_IN-alltraffic_43" {

The argument "contract_dn" is required, but no definition was found.

We should:

  1. Alert the user with a warning that an non existing contract is being used
  2. Skip importing the aci_epg_to_contract for such contract

The warning should be very visible, ideally as a summary at the end of the import operation. for example something like this:

2022/07/28 21:07:20 aci Connecting....
2022/07/28 21:07:20 aci save
2022/07/28 21:07:20 aci save tfstate
2022/07/28 21:07:20 Import Completed with the following warnings:
   The following resources have not being imported due to 'miss-target'
    - x
    - y
    - z
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

No branches or pull requests

1 participant