// Module included in the following assemblies:
//
// assembly-managing-address-spaces.adoc

[id='replace-address-space-cli-{context}']
= Replacing address spaces using the command line

Address spaces can be replaced in order to change the plan, endpoints, or network policies, or
to replace certificates if using the `certBundle` certificate provider. When changing the plan,
{ProductName} will attempt to apply the new plan if the current set of addresses fits within the new
quota. If it does not, an error is provided on the `AddressSpace` resource.

.Procedure

ifeval::["{cmdcli}" == "oc"]
. Log in as a messaging tenant:
+
[subs="attributes",options="nowrap"]
----
{cmdcli} login -u developer
----

. Select the project for the messaging application:
+
[subs="attributes",options="nowrap"]
----
{cmdcli} project myapp
----
endif::[]

. Update address space definition:
+
[source,yaml,options="nowrap"]
----
include::../common/standard-address-space-replace.yaml[]
----

. Replace the address space:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} replace -f standard-address-space-replace.yaml
----

. Check the status of the address space:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} get addressspace myspace -o jsonpath={.status.isReady}
----
+
The address space is ready for use when the above command outputs `true`.

