Apply changes
Describe an infrastructure change as a small, typed mutation of your branch.
The change contract
Every mutation identifies the branch, operation, resource type, and resource ID. fields contains the properties to add or modify. Omit it for a delete.
| Parameter | Type | Meaning |
|---|---|---|
| branch_id | string | ID of an open branch |
| op | add | modify | delete | Operation in the model |
| resource_type | string | Supported resource type |
| resource_id | string | Resource identifier |
| fields | object · optional | Schema fields for the mutation |
Supported resources
The current mutation engine supports these five resource types. Collection coverage is broader than mutation coverage; a collected resource is not automatically editable.
| Resource type | Identity |
|---|---|
| ec2_instance | Instance ID |
| security_group | Security group ID |
| rds_instance | Database ID |
| s3_bucket | Bucket name |
| lambda_function | Function name |
Modify a resource
For example, disable the public-access flag on an existing database in the model. Use field names from Emfirge’s resource schema, not arbitrary AWS or Terraform property names.
emfirge_apply_change({
branch_id: "<branch_id>",
op: "modify",
resource_type: "rds_instance",
resource_id: "<database_id>",
fields: { publicly_accessible: false }
})
Add or delete a resource
An add needs the fields required by the resource schema. A delete identifies an existing resource and removes it from the branch model. Review the resulting edges and findings before drawing conclusions.
A removed model relationship does not fully describe application-level dependencies. Dependency breakage beyond the graph needs separate validation.
emfirge_apply_change({
branch_id: "<branch_id>",
op: "delete",
resource_type: "ec2_instance",
resource_id: "<instance_id>"
})