-
Notifications
You must be signed in to change notification settings - Fork 700
Difficulty importing network resources within VCN #379
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
Comments
There is bug in OCI provider because of which we are not setting vcn_id during import https://github.com/oracle/terraform-provider-oci/blob/master/provider/core_internet_gateway_resource.go#L167-L173 |
Thank you for the quick fix. I should note that the Internet Gateway was one example, I was having the same issue with route tables. I kinda stopped trying after that, so I don't know if there are other resources with the same problem. Another edit: Quickly looking through the code for the other resources on my list, it seems dhcp_options also has the problem in addition to route tables and internet gateways- https://github.com/oracle/terraform-provider-oci/blob/master/provider/core_dhcp_options_resource.go#L169 |
#388 Addresses this issue for the route_tables and dhcp_options. |
I have encountered another case of this bug. When importing the default route table, the attribute "manage_default_resource_id" is not set so after importing it, the plan wants to delete and recreate it. Adding this attribute manually prevents that. I set it to the same ID as the resource itself. |
Thanks for the feedback @KnightOfNight. We will look at addressing this. One possible fix is to change ResourceImporter for default resources, to set the "manage_default_resource_id" attribute to the given ID. |
@briangustafson also brought up a good point that default resources don't need to be imported in most cases. You could just add the default resource to your config with all the values you want it to have and Terraform would apply them to your existing resource (without deleting/recreating it). That being said, there are cases where one may want to import the resource without modifying it and without having to supply all required resource values. In this case, import would help you get all the values of that resource since you only need to specify the ID. The fix for this should be pretty simple and so we should go ahead with fixing it. |
True rarely needed, except in the case of a loss of state, which is what I'm working on, which is to say it's actually two use cases: regaining lost state, and brining previously unmanaged resources under control. |
The |
All the related issues were fixed. No new reports of this issue. |
Terraform Version
OCI Provider Version
Description:
I am having difficulties importing existing network resources that reside within a VCN, I'm not sure if this is an issue with the OCI provider or with Terraform itself. The import succeeds, but it looks like the import action does not associate the vcn_id with the imported resource so any subsequent terraform plan/apply wants to recreate everything. Details / steps to reproduce:
Manually create the "test1" VCN.
Manually create the "test1-IG" Internet gateway inside the VCN, in the same container.
Import the VCN-
Import the IG-
Make sure the resources in your terraform file match what you imported-
Then run a terraform plan-
The text was updated successfully, but these errors were encountered: