Comments (9)
Example snippet:
resource "baremetal_core_subnet" "baston-subnet" {
availability_domain = "${var.ADs[0]}"
cidr_block = "${var.CIDR-baston-subnet}"
display_name = "Bastion Subnet"
compartment_id = "${var.compartment_services_ocid}"
vcn_id = "${baremetal_core_virtual_network.sandbox-vcn-1.id}"
route_table_id = "${baremetal_core_route_table.sandbox-route-1.id}"
security_list_ids = [
"${baremetal_core_security_list.SEC-tools-all-Internet.id}",
"${baremetal_core_security_list.VCN-wide-EXTERNAL-security-list.id}",
"${baremetal_core_security_list.VCN-wide-INTERNAL-security-list.id}",
]
}
from terraform-provider-oci.
One other note, we are currently on Terraform v0.8.8, not sure if we should be on a newer version.
from terraform-provider-oci.
from terraform-provider-oci.
Just FYI, I've reproduced this issue. @craigcarl-oracle there is no facility immediately apparent to me in terraform to handle list ordering issues like this. I think ideally the security_list_ids attribute is always ordered consistently in API responses (both from creation (POST) and fetching (GET).
There is a diff suppression function, but it receives each key individually, e.g.
security_list_ids.0
security_list_ids.1
security_list_ids.2
And the order is inconsistent. We can access the entire state from that function, so we could see if the ids are already represented in the state and suppress the diff in that case, but that is pretty hacky IMO.
from terraform-provider-oci.
@mikejihbe It's a fairly serious issue, it can lead to data loss when an instance gets terminated unexpectedly. We're going to need a fix in the provider even if it's temporary and hacky. I'm still not completely clear on what dimension TF needs the list of SLs ordered in, is it creation date? Ascending or descending?
I think there are two different situations we're going to need to deal with -
- No changes to the SLs attached to a subnets (as reported here).
- SL(s) attached/detached from a subnet.
I don't think your proposed fix will deal with the second situation, if we always suppress the diff wouldn't that prevent changes to the SLs attached to a subnets?
Can we can get the order SLs were created in from the state and use that to order the list of SLs appropriately?
I'll file a ticket against the API once we've determined exactly what needs to change.
from terraform-provider-oci.
It doesn't matter what the order is as long as it's consistent. You're right, this change will not cause adding or removing security lists to not destroy and re-create the subnet. That is an API limitation though, there is no security_list_ids parameter in the update api
from terraform-provider-oci.
@mikejihbe We're not supporting the addition/removal of SLs yet, ignore that case.
Can we internally add
lifecycle {
ignore_changes = ["security_list_ids"]
}
to every baremetal_core_subnets
resource? That wouldn't require understanding the state, would it solve the problem?
from terraform-provider-oci.
It looks like the lifecycle attributes are only presented in the parsing, so there are actually no schema attributes we could update to influence the lifecycle in this fashion. I tried for a few hours to get DiffSuppressFunc to do what we want, but it's not working. I also looked for but couldn't find an example of a list being "internally" suppressed like we want here.
from terraform-provider-oci.
I had another thought here. The problem may not be unstable sorting on the API, the problem may be that stable sorting from the API is different than the order presented in the TF statefile by the user. We could probably mitigate this problem by altering our GET function to order the subnet ids in the same order as what exists in the tf state (if any) if possible.
from terraform-provider-oci.
Related Issues (20)
- 400-InvalidParameter, Unable to process JSON input
- Announcement subscription filter group docs are incorrect/incomplete re: importing HOT 1
- Import is not working for oci_identity_domains_identity_providers HOT 2
- Oci data science UpdateNotebookSession update fails without privateEndpointId HOT 2
- OKE nodepool scaling doesn't work as expected HOT 5
- unable to open file "lb.sql"
- Add missing oci_core_instance variables to oci_containerengine_node_pool
- Oci data science UpdateNotebookSession update fails without privateEndpointId Ticket2 HOT 5
- Bring back the provider documentation on registry.terraform.io
- os_version attribute not exported by the oci_database_db_system resource HOT 2
- oci_core_instance import sets assign_private_dns_record to false HOT 2
- oci_apigateway_deployment: does not support dynamic parameter in urls in the in route HOT 3
- Imported oci_stack_monitoring_discovery_job fails on plan/apply because system_tags "doesn't support update" HOT 1
- Identity compartment resource documentation
- oci_log_analytics_namespaces attributes are wrong HOT 1
- resource oci_log_analytics_namespace doesn't support import HOT 1
- '400-InvalidParameter Unable to process JSON input' Error When Creating One-Time Budgets with start_date and end_date HOT 3
- Change OKE app autoscaler config not working HOT 2
- Plugin Crashed: oci_database_autonomous_database_saas_admin_user HOT 1
- affected_resources = oci_database_oneoff_patch HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-oci.