Skip to content

feat(azure): Chaos Studio experiments (Microsoft.Chaos) - #1256

Merged
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-chaosstudio
Sep 7, 2026
Merged

feat(azure): Chaos Studio experiments (Microsoft.Chaos)#1256
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-chaosstudio

Conversation

@NitinKumar004

Copy link
Copy Markdown
Collaborator

Summary

Adds a greenfield ARM control-plane emulation of Azure Chaos Studio experiments (Microsoft.Chaos/experiments), the primary parity target for Terraform's azurerm_chaos_studio_experiment. Control plane only — no faults are injected (this is unrelated to CloudEmu's features/chaos fault-injection engine).

Operations: CreateOrUpdate (PUT), Get, Delete, List by RG, List by subscription, Update (PATCH). Synchronous completion with provisioningState=Succeeded. Status codes 201/200/200-then-204/404.

Design

  • Explicit top-level identity (echo_properties cannot reach top-level fields): type plus service-minted principalId/tenantId for SystemAssigned, and minted principalId/clientId per UserAssigned id. Minted once from a deterministic seed (idgen.SyntheticGUID), stored, and stable across every GET/PATCH and snapshot/restore.
  • selectors / steps carried verbatim as raw JSON (json.RawMessage passthrough) so the deeply-nested branch/actions blocks — including the type:"List" and type:"continuous" discriminators Terraform's typed unmarshal requires — round-trip byte-for-byte and cannot drift. Bare creates default both to a valid [].
  • provisioningState modeled explicitly under properties.
  • PATCH merges only provided fields; location is immutable; resource-level tag update is a REPLACE.
  • Resource-group delete cascades into experiments (purge).
  • Resource-graph + discovery wired additively with unique keys: ServiceChaosStudio/TypeChaosExperiment, plus BOTH forward (microsoft.chaos/experiments -> {chaosstudio, Experiment}) and inverse (chaosstudio/Experiment -> microsoft.chaos/experiments) type-map entries.

E2E (raw ARM against cloudemu serve, api-version 2023-11-01)

  • PUT create -> 201, provisioningState=Succeeded, identity ids minted, selectors/steps echoed verbatim.
  • GET x2 -> byte-identical.
  • PATCH tags -> 200, tags replaced, identity + selectors + steps all stable (no drift).
  • DELETE -> 200, DELETE again -> 204, GET -> 404.
  • Resource Graph where type =~ "microsoft.chaos/experiments" -> 1 row, inverse type emitted correctly.

Gates

go build ./..., full go vet ./..., gofmt clean, golangci-lint on new packages = 0 issues, go test -race on new packages, full go test of server/azure/... + providers/azure/... + services/resourcediscovery/... + server/azure/resourcegraph/... (128 pkgs), persist/... incl. completeness, root ., and go generate idempotency — all green.

Deferred

The nested targets/capabilities resource types (Microsoft.Chaos/targets, under other resources) are separate resource types and out of scope for this experiments-focused build.

Add ARM control-plane emulation of Azure Chaos Studio experiments
(azurerm_chaos_studio_experiment): CreateOrUpdate/Get/Delete/List/PATCH,
explicit top-level identity with stable minted principalId/tenantId,
provisioningState=Succeeded, and verbatim raw-JSON round-trip of the
nested selectors/steps blocks so IaC sees no drift. Wires resource-graph
and discovery (forward + inverse type maps). Control plane only; no fault
injection (unrelated to features/chaos); targets/capabilities deferred.
@NitinKumar004
NitinKumar004 merged commit b8b8695 into development Sep 7, 2026
23 checks passed
@NitinKumar004
NitinKumar004 deleted the feat/azure-chaosstudio branch September 7, 2026 06:36
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

Successfully merging this pull request may close these issues.

1 participant