> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/iacm-api-reference/module-registry/upsert-module-lifecycle-rule.md).

# Upsert module lifecycle rule

Create or replace the lifecycle rule for a module, atomically replacing all overrides

```json
{"openapi":"3.0.3","info":{"title":"Infrastructure as Code Management","version":"0.1.0"},"tags":[{"name":"module-registry","description":"The module-registry service is a private registry for Terraform/Opentofu modules"}],"servers":[{"url":"http://localhost:80"}],"paths":{"/api/modules/{id}/lifecycle":{"put":{"tags":["module-registry"],"summary":"Upsert module lifecycle rule","description":"Create or replace the lifecycle rule for a module, atomically replacing all overrides","operationId":"module-registry#put-module-lifecycle","parameters":[{"name":"scope_org","in":"query","description":"Org scope of the module","allowEmptyValue":true,"schema":{"type":"string","description":"Org scope of the module"}},{"name":"scope_project","in":"query","description":"Project scope of the module","allowEmptyValue":true,"schema":{"type":"string","description":"Project scope of the module"}},{"name":"id","in":"path","description":"Module ID","required":true,"schema":{"type":"string","description":"Module ID"}},{"name":"Harness-Account","in":"header","description":"Account name","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Account name"}}],"requestBody":{"description":"Lifecycle rule with overrides","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModuleLifecycleRule"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutModuleLifecycleResponse"}}}},"400":{"description":"BadRequestError: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"401":{"description":"UnauthorizedError: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"403":{"description":"ForbiddenError: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"404":{"description":"NotFoundError: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"408":{"description":"TimeoutError: Request Timeout response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"409":{"description":"ConflictError: Conflict response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"423":{"description":"LockedError: Locked response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"499":{"description":"ContextCancelledError:  response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}},"502":{"description":"BadGatewayError: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/RegistryError"}}}}}}}},"components":{"schemas":{"ModuleLifecycleRule":{"type":"object","properties":{"deprecated_action":{"type":"string","description":"Enforcement action for deprecated-tier versions","default":"fail","enum":["no_action","warn","fail"]},"overrides":{"type":"array","items":{"$ref":"#/components/schemas/ModuleLifecycleOverride"},"description":"Manual per-version tier overrides","maxItems":1000},"supported_action":{"type":"string","description":"Enforcement action for supported-tier versions","default":"no_action","enum":["no_action","warn","fail"]},"supported_count":{"type":"integer","description":"Number of most-recent non-pre-release versions classified as supported","format":"int64","minimum":1},"warning_action":{"type":"string","description":"Enforcement action for warning-tier versions","default":"warn","enum":["no_action","warn","fail"]},"warning_count":{"type":"integer","description":"Number of versions immediately after the supported window classified as warning","format":"int64","minimum":0}},"description":"Lifecycle rule configuration for a module registry module","required":["supported_count","warning_count","supported_action","warning_action","deprecated_action"]},"ModuleLifecycleOverride":{"type":"object","properties":{"reason":{"type":"string","description":"Optional reason for this override","maxLength":1000},"tier":{"type":"string","description":"Lifecycle tier to assign to this version","enum":["supported","warning","deprecated"]},"version":{"type":"string","description":"Version string to override","minLength":1}},"description":"Manual lifecycle tier override for a specific module version","required":["version","tier"]},"PutModuleLifecycleResponse":{"type":"object","properties":{"deprecated_action":{"type":"string","description":"Enforcement action for deprecated-tier versions","default":"fail","enum":["no_action","warn","fail"]},"overrides":{"type":"array","items":{"$ref":"#/components/schemas/ModuleLifecycleOverride"},"description":"Manual per-version tier overrides","maxItems":1000},"supported_action":{"type":"string","description":"Enforcement action for supported-tier versions","default":"no_action","enum":["no_action","warn","fail"]},"supported_count":{"type":"integer","description":"Number of most-recent non-pre-release versions classified as supported","format":"int64","minimum":1},"warning_action":{"type":"string","description":"Enforcement action for warning-tier versions","default":"warn","enum":["no_action","warn","fail"]},"warning_count":{"type":"integer","description":"Number of versions immediately after the supported window classified as warning","format":"int64","minimum":0}},"required":["supported_count","warning_count","supported_action","warning_action","deprecated_action"]},"RegistryError":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}}}
```
