oxid state

Inspect and manipulate resources in the Oxid state database.

Usage

oxid state <subcommand> [args] [flags]

The state command provides subcommands for viewing, filtering, moving, and removing resources from the Oxid state database. These commands operate directly on state without contacting providers.

Subcommands

state list

List all resources tracked in the state database:

$ oxid state list

aws_vpc.main
aws_subnet.public[0]
aws_subnet.public[1]
aws_internet_gateway.main
aws_route_table.public
aws_route_table_association.public[0]
aws_route_table_association.public[1]
aws_security_group.web
aws_instance.api
aws_s3_bucket.logs

10 resources found.

Filter resources by type or name pattern:

$ oxid state list --filter aws_subnet

aws_subnet.public[0]
aws_subnet.public[1]

2 resources found.
FlagDescriptionDefault
--filter <pattern>Filter resources by address pattern (substring match).-

state show

Show the full state of a specific resource, including all attributes:

$ oxid state show aws_vpc.main

Resource: aws_vpc.main
Provider: hashicorp/aws
ID:       vpc-0a1b2c3d4e5f67890

Attributes:
  arn                  = "arn:aws:ec2:us-west-2:123456789:vpc/vpc-0a1b2c3d4e5f67890"
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true
  id                   = "vpc-0a1b2c3d4e5f67890"
  instance_tenancy     = "default"
  tags                 = {
    Name        = "main-vpc"
    Environment = "production"
  }

state rm

Remove a resource from state without destroying it in the cloud. This tells Oxid to stop managing the resource:

$ oxid state rm aws_s3_bucket.logs

Removed aws_s3_bucket.logs from state.
The resource still exists in your cloud provider but is no longer managed by Oxid.
WarningRemoving a resource from state does not delete it from your cloud provider. The resource will continue to exist but Oxid will no longer track or manage it.

state mv

Move a resource to a new address in state. Useful when refactoring your configuration (e.g., renaming a resource):

$ oxid state mv aws_instance.web aws_instance.api

Moved aws_instance.web to aws_instance.api.

This prevents Oxid from destroying the old resource and creating a new one when you rename it in your .tf files.

Examples

Audit all resources of a type

oxid state list --filter aws_iam_role

Inspect a specific instance

oxid state show aws_instance.api

Unmanage a resource before deleting it manually

oxid state rm aws_s3_bucket.legacy
# Now delete the bucket manually in the AWS console

Rename a resource without recreation

# 1. Rename in .tf files: aws_instance.old -> aws_instance.new
# 2. Move in state:
oxid state mv aws_instance.old aws_instance.new
# 3. Verify no changes:
oxid plan