Skip to content

Commit

Permalink
Merging branch for migrated resource tagging.
Browse files Browse the repository at this point in the history
Tagging of migrated resources.
  • Loading branch information
lgabriel-oracle authored Apr 19, 2023
2 parents ba33718 + 3c853f5 commit 85876a6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ This Terraform implements the [prerequisites](https://docs.oracle.com/en-us/iaas
- Compartments - The recommended Migration and MigrationSecrets [compartments](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-get-started.htm#cloud-migration-recommendations-compartments).
- OCI Vault and Key - The vault used to store [vCenter credentials](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-remote-agent-appliance.htm#cloud-migration-vsphere-privileges).
- Object Storage Bucket - The Object Storage [bucket](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-understand-vm-replication.htm#cloud-migration-replication-bucket) used for transferring vSphere snapshot data into OCI.
- Mandatory Serivce Policies - The mandatory [service policies](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-servicepolicies.htm) and assoicated dynamic groups needed for OCM serivce components to function.
- Mandatory Service Policies - The mandatory [service policies](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-servicepolicies.htm) and associated dynamic groups needed for OCM service components to function.
- Oracle Cloud Bridge Inventory - The [Inventory](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-inventory.htm) used to store discovered assets for migration.
- Tag Namespace and Tags - The tag namespace and tags used by Oracle Cloud Migrations to keep track of [migrated resources](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-get-started.htm#cloud-migration-prerequisites-ocm).
7 changes: 7 additions & 0 deletions cloudbridge.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Copyright (c) 2019-2022 Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "oci_cloud_bridge_inventory" "Inventory" {
compartment_id = var.tenancy_ocid
display_name = "Inventory"
}
39 changes: 37 additions & 2 deletions identity.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ resource "oci_identity_policy" "MigrationServicePolicy" {
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} { CAPACITY_RESERVATION_READ } in tenancy where any { request.operation='GetComputeCapacityReservation' }",
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} { ORGANIZATIONS_SUBSCRIPTION_INSPECT } in tenancy where any { request.operation='ListSubscriptions' }",
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} to read rate-cards in tenancy",
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} to use metrics in tenancy where target.metrics.namespace='ocb_asset'"

"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} to use metrics in tenancy where target.metrics.namespace='ocb_asset'",
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} to read tag-namespaces in tenancy",
"Allow dynamic-group ${oci_identity_dynamic_group.MigrationDynamicGroup.name} to use tag-namespaces in tenancy where target.tag-namespace.name='CloudMigrations'"
]
}

Expand Down Expand Up @@ -160,3 +161,37 @@ resource "oci_identity_policy" "HydrationAgentPolicy" {
]
}

resource "oci_identity_tag_namespace" "CloudMigrations" {
name = "CloudMigrations"
description = "Used to track resources created by Oracle Cloud Migrations service."
compartment_id = var.tenancy_ocid
}

resource "oci_identity_tag" "ServiceUse" {
name = "ServiceUse"
description = "Oracle Cloud Migrations service"
tag_namespace_id = oci_identity_tag_namespace.CloudMigrations.id
}

resource "oci_identity_tag" "SourceEnvironmentId" {
name = "SourceEnvironmentId"
description = "Source Environment OCID"
tag_namespace_id = oci_identity_tag_namespace.CloudMigrations.id
}
resource "oci_identity_tag" "SourceEnvironmentType" {
name = "SourceEnvironmentType"
description = "Source Environment Type"
tag_namespace_id = oci_identity_tag_namespace.CloudMigrations.id
}

resource "oci_identity_tag" "SourceAssetId" {
name = "SourceAssetId"
description = "Asset Source OCID"
tag_namespace_id = oci_identity_tag_namespace.CloudMigrations.id
}

resource "oci_identity_tag" "MigrationProject" {
name = "MigrationProject"
description = "Migration Project OCID"
tag_namespace_id = oci_identity_tag_namespace.CloudMigrations.id
}

0 comments on commit 85876a6

Please sign in to comment.