1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

さあ、Landing Zoneを学びに行こう

Last updated at Posted at 2025-07-25

新しいOCIランディングゾーンのブログが公開されたので、試してみました。

この話のゴール

Landing Zoneの導入手順を確認したいと思います。

それでは検証開始!

れっつごー!

まずはGitHubからダウンロード

みんな大好きCloudShellの出番です。え?そんな好きじゃないって?
リソースマネージャを使ったやり方だと、説明がめんどくさいじゃないですか。
そういや、ORM(Oracle Resource Manager)って略すんですね。知らなかった。

$ git clone https://github.com/oci-landing-zones/terraform-oci-core-landingzone.git
Cloning into 'terraform-oci-core-landingzone'...
remote: Enumerating objects: 4254, done.
remote: Counting objects: 100% (1034/1034), done.
remote: Compressing objects: 100% (181/181), done.
remote: Total 4254 (delta 890), reused 941 (delta 852), pack-reused 3220 (from 1)
Receiving objects: 100% (4254/4254), 12.55 MiB | 24.52 MiB/s, done.
Resolving deltas: 100% (2842/2842), done.
$ cd terraform-oci-core-landingzone
$ ls
ARCH-MAPPING-CIS.md      images                      net_exacs_vcn_2.tf                  net_three_tier_vcn_1.tf  SECURITY.md                  variables_net_oke_vcns.tf
CONTRIBUTING.md          LICENSE.txt                 net_exacs_vcn_3.tf                  net_three_tier_vcn_2.tf  sec_vault.tf                 variables_net_on_premises.tf
cost_budget.tf           locals.tf                   net_fastconnect_virtual_circuit.tf  net_three_tier_vcn_3.tf  sec_vss.tf                   variables_net_three_tier_vcns.tf
data_sources.tf          mon_alarms.tf               net_hub_drg.tf                      outputs.tf               SPEC.md                      variables_security.tf
DEPLOYMENT-GUIDE.md      mon_flow_logs.tf            net_hub_vcn.tf                      providers.tf             templates                    zpr_exacs_vcn_1.tf
extensions               mon_logging_analytics.tf    net_ipsec_vpn.tf                    README.md                variables_general.tf         zpr_exacs_vcn_2.tf
iam_compartments.tf      mon_notifications.tf        net_logging.tf                      RELEASE-NOTES.md         variables_governance.tf      zpr_exacs_vcn_3.tf
iam_dynamic_groups.tf    mon_service_connector.tf    net_main.tf                         release.txt              variables_iam.tf             zpr_hub_vcn.tf
iam_groups.tf            mon_tags.tf                 net_nfw.tf                          schema.yml               VARIABLES.md                 zpr_main.tf
iam_identity_domain.tf   mon_topics.tf               net_oke_vcn_1.tf                    sec_bastion.tf           variables_monitoring.tf      zpr_three_tier_vcn_1.tf
iam_policies.tf          net_additional_networks.tf  net_oke_vcn_2.tf                    sec_cloud_guard.tf       variables_net_exacs_vcns.tf  zpr_three_tier_vcn_2.tf
iam_service_policies.tf  net_exacs_vcn_1.tf          net_oke_vcn_3.tf                    sec_security_zones.tf    variables_net_hub.tf         zpr_three_tier_vcn_3.tf
$ 

むむむ。ZPRのものと思われるものがいっぱいあるw
今回はZPRを扱わないので、また、そのうち。

デプロイ前の準備

templatesフォルダにあるREADME.mdを見ると以下のように書いてあります。

  1. Rename file main.tf.template to main.tf.
  2. Provide/review the variable assignments in main.tf.
  3. In this folder, execute the typical Terraform workflow:
    • $ terraform init
    • $ terraform plan
    • $ terraform apply

簡単ですね。今回は、templates/new-identity-domainを使ってみましょう。

$ cd templates/new-identity-domain
$ cp -i main.tf.template main.tf
$ vi main.tf 

設定する項目少ない!
user_ocidとかfingerprintとか指定するところありますが、CloudShellの場合はインスタンスプリンシパルになるので、気にしなくて良いです。修正が必要なのは以下ぐらいでしょうか。

  • tenancy_ocid
  • region
  • service_label
  • network_admin_email_endpoints
  • security_admin_email_endpoints
  • new_identity_domain_name

service_labelは変えなくても良いんですけど、デフォルトの「existingID」だと違和感ありまくりだったので、、、。

トップレベルにいろいろリソース作られるのがちょっと嫌だったので、囲みコンパートメントを作ってそちらに作成されるようにしました。詳細はDEPLOYMENT-GUIDE.md参照。

main.tf
enclosing_compartment_options = "Yes, use existing"
existing_enclosing_compartment_ocid = "ocid1.compartment.oc1..XXXXX"

あと、CloudGuardも有効化されるみたいなので、無効化した状態で試してみます。CloudGuard用のポリシーも念のため削除。

では、terraform init/planして確認してみましょう。

$ terraform init
$ terraform plan -no-color | tee tfplan.log
(中略)
Plan: 60 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
$

さすがにCloudShellだとログが流れてしまうので、-no-colorを付けてファイル出力してログ確認です。だいたいこれで何が作られるのか分かりますね。

そして、デプロイ!

有償リソースが作られるわけではなさそうなので、applyを実行してみましょう。

$ terraform apply -no-color | tee tfapply.log
(中略)
Error: 404-NotAuthorizedOrNotFound, Compartment ocid1.tenancy.oc1..XXXXX is missing required permissions to read following resource types : [tenancies]
Suggestion: Either the resource has been deleted or service Cloud Guard Configuration need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/cloud_guard_cloud_guard_configuration 
API Reference: https://docs.oracle.com/iaas/api/#/en/cloud-guard/20200131/Configuration/UpdateConfiguration 
Request Target: PUT https://cloudguard-cp-api.ap-tokyo-1.oci.oraclecloud.com/20200131/configuration?compartmentId=ocid1.tenancy.oc1..XXXXX 
Provider version: 7.11.0, released on 2025-07-28.  
Service: Cloud Guard Configuration 
Operation Name: UpdateConfiguration 
OPC request ID: XXXXX/XXXXX/XXXXX 


  with module.core_lz.module.lz_cloud_guard[0].oci_cloud_guard_cloud_guard_configuration.this[0],
  on .terraform/modules/core_lz.lz_cloud_guard/cloud-guard/main.tf line 32, in resource "oci_cloud_guard_cloud_guard_configuration" "this":
  32: resource "oci_cloud_guard_cloud_guard_configuration" "this" {

むむむ。調べてみたら、README.mdに以下の記述が。

11. Cloud Guard 404-NotAuthorizedOrNotFound Error

During terraform apply, Terraform fails with an error message like the one below. This typically happens in scenarios where Cloud Guard is not enabled in the tenancy. The error is due to a timing issue, as enabling Cloud Guard depends on IAM policies that are not available and may have not yet been deployed in the same apply. Unfortunately, in this particular scenario, it is not possible to introduce a depends_on clause on Cloud Guard module to delay it a bit.

This problem is solved by re-executing the plan, followed by an apply.

再実行すればよさそっすね。

$ terraform apply -no-color | tee tfapply2.log
(中略)
Apply complete! Resources: 6 added, 15 changed, 0 destroyed.
$

うん。ばっちり!

確認してみよう

作ったのものは確認しないとね。

タグ

なんか作られてます。使ってるところはなさそう? ちなみに、service_labelは「lz」にしてます。
image.png

Landing Zoneで作られる各種リソースには、フリーフォームタグが付与されてます。
image.png

ドメイン

囲みコンパートメントを作ったので、囲みコンパートメント内にドメインが作成されてますね。
ユーザは誰もいません。グループは以下の通り。
image.png

コンパートメント

コンパートメントは4つ。ここはまだRedwoodじゃないんだなあ。
image.png

ポリシー

まずは、ルートコンパートメントに作られるものはこちら。
image.png

囲みコンパートメントはこちら。
image.png

中の設定も詳しく見ようと思ったのですが、思ったよりもボリュームがあったので、断念。
というか、どう見ても全部で200ステートメント以上あるんですけど、これって大丈夫なんでしたっけ。

個人的には、ここが興味深かったです。
ネットワーク管理者なのに、to manage instance-family?と思ったのですが、ORM系もあるところを見ると、マーケットプレイスからネットワーク系のアプライアンスをデプロイできるように、ですかね。

lz-network-admin-policy
allow group lz-network-admin-group to read all-resources in compartment lz-network-cmp
allow group lz-network-admin-group to manage virtual-network-family in compartment lz-network-cmp
allow group lz-network-admin-group to manage dns in compartment lz-network-cmp
allow group lz-network-admin-group to manage load-balancers in compartment lz-network-cmp
allow group lz-network-admin-group to manage alarms in compartment lz-network-cmp
allow group lz-network-admin-group to manage metrics in compartment lz-network-cmp
allow group lz-network-admin-group to manage ons-family in compartment lz-network-cmp
allow group lz-network-admin-group to manage orm-stacks in compartment lz-network-cmp
allow group lz-network-admin-group to manage orm-jobs in compartment lz-network-cmp
allow group lz-network-admin-group to manage orm-config-source-providers in compartment lz-network-cmp
allow group lz-network-admin-group to read audit-events in compartment lz-network-cmp
allow group lz-network-admin-group to read work-requests in compartment lz-network-cmp
allow group lz-network-admin-group to manage instance-family in compartment lz-network-cmp
allow group lz-network-admin-group to manage volume-family in compartment lz-network-cmp where all{request.permission != 'VOLUME_BACKUP_DELETE', request.permission != 'VOLUME_DELETE', request.permission != 'BOOT_VOLUME_BACKUP_DELETE'}
allow group lz-network-admin-group to manage object-family in compartment lz-network-cmp where all{request.permission != 'OBJECT_DELETE', request.permission != 'BUCKET_DELETE'}
allow group lz-network-admin-group to manage file-family in compartment lz-network-cmp where all{request.permission != 'FILE_SYSTEM_DELETE', request.permission != 'MOUNT_TARGET_DELETE', request.permission != 'EXPORT_SET_DELETE', request.permission != 'FILE_SYSTEM_DELETE_SNAPSHOT', request.permission != 'FILE_SYSTEM_NFSv3_UNEXPORT'}
allow group lz-network-admin-group to manage bastion-session in compartment lz-network-cmp
allow group lz-network-admin-group to manage cloudevents-rules in compartment lz-network-cmp
allow group lz-network-admin-group to manage alarms in compartment lz-network-cmp
allow group lz-network-admin-group to manage metrics in compartment lz-network-cmp
allow group lz-network-admin-group to read instance-agent-plugins in compartment lz-network-cmp
allow group lz-network-admin-group to manage keys in compartment lz-network-cmp
allow group lz-network-admin-group to use key-delegate in compartment lz-network-cmp
allow group lz-network-admin-group to manage secret-family in compartment lz-network-cmp
allow group lz-network-admin-group to manage network-firewall-family in compartment lz-network-cmp
allow group lz-network-admin-group to read vss-family in compartment lz-security-cmp
allow group lz-network-admin-group to use bastion in compartment lz-security-cmp
allow group lz-network-admin-group to manage bastion-session in compartment lz-security-cmp
allow group lz-network-admin-group to use vaults in compartment lz-security-cmp
allow group lz-network-admin-group to read logging-family in compartment lz-security-cmp

CloudGuard

有効化されてますねー。
image.png

レシピもなんか作られてます。
image.png

ログ

VCNフローログが格納されるんだろうなっていうロググループだけ作られてました。
今回はVCN作ってないので何もログ設定はされてません。
image.png

イベント

ネットワーク設定やIAM設定が変更された時の通知が追加されてます。CloudGuardのイベントはチェックしてなさそう?
image.png
ネットワーク変更の時は、network_admin_email_endpointsで指定したアドレスに、IAM変更の時はsecurity_admin_email_endpointsで指定したアドレスに飛ぶようです。

アラーム

FastConnectやVPNの状態をチェックするアラームが作られてます。今回はネットワーク系のリソースは作ってないから、無効なのかしら?
image.png

通知

イベントで検知したものを通知するためのトピックが作成されています。
以下はネットワーク変更通知のトピック。FastConnectとかのアラームもこのトピック使ってます。
image.png

最後に

すでに作っているリソースをこれに寄せるのはちょっと大変そうですが、これから新しく作るのであれば、Landing Zoneでベース作って、その上でいろいろ作るのが良さそうですね。

さーて。これからIAMポリシー解読していくかー。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?