Skip to content

Commit 3201e37

Browse files
committed
Add oci_general_info.
1 parent a09f2a5 commit 3201e37

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed

oci/oci_general_info/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Terraform : Oracle Cloud Infrastructure (OCI) General Information
2+
3+
Displays information about the following for the specified compartment.
4+
5+
* Availability Domains
6+
* Compute Images
7+
* Compute Shapes
8+
9+
These may be necessary for other scripts.
10+
11+
Usage description.
12+
13+
* [Terraform : Oracle Cloud Infrastructure (OCI) General Information](https://oracle-base.com/articles/misc/terraform-oci-general-info).
14+
15+
Related articles.
16+
17+
* [Terraform : All Articles](https://oracle-base.com/articles/misc/articles-misc#terraform)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Variables
2+
variable "compartment_id" { type = string }
3+
4+
variable "operating_system" {
5+
type = string
6+
default = "Oracle Linux"
7+
}
8+
9+
variable "operating_system_version" {
10+
type = string
11+
default = "8"
12+
}
13+
14+
variable "shape" {
15+
type = string
16+
default = "VM.Standard.E2.1.Micro"
17+
}
18+
19+
20+
# Resources
21+
data "oci_identity_availability_domains" "ads" {
22+
compartment_id = var.compartment_id
23+
}
24+
25+
data "oci_core_images" "tf_images" {
26+
compartment_id = var.compartment_id
27+
operating_system = var.operating_system
28+
operating_system_version = var.operating_system_version
29+
shape = var.shape
30+
}
31+
32+
data "oci_core_shapes" "tf_shapes" {
33+
compartment_id = var.compartment_id
34+
image_id = data.oci_core_images.tf_images.images.0.id
35+
}
36+
37+
38+
# Outputs
39+
output "first_availability_domain_name" {
40+
value = data.oci_identity_availability_domains.ads.availability_domains[0].name
41+
}
42+
43+
output "availability_domain_names" {
44+
value = data.oci_identity_availability_domains.ads.availability_domains[*].name
45+
}
46+
47+
output "latest_image_id" {
48+
value = data.oci_core_images.tf_images.images[0].id
49+
}
50+
51+
output "shape_names" {
52+
value = data.oci_core_shapes.tf_shapes.shapes[*].name
53+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Amend with your details.
2+
compartment_id = "ocid1.compartment.oc1..aaaaaaaa..."
3+
operating_system = "Oracle Linux"
4+
operating_system_version = "8"
5+
shape = "VM.Standard.E2.1.Micro"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Variables.
2+
variable "tenancy_ocid" { type = string }
3+
variable "user_ocid" { type = string }
4+
variable "private_key_path" { type = string }
5+
variable "fingerprint" { type = string }
6+
variable "region" { type = string }
7+
variable "root_compartment_id" { type = string }
8+
9+
10+
# Resources
11+
provider "oci" {
12+
tenancy_ocid = var.tenancy_ocid
13+
user_ocid = var.user_ocid
14+
private_key_path = var.private_key_path
15+
fingerprint = var.fingerprint
16+
region = var.region
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Amend with your details.
2+
tenancy_ocid = "ocid1.tenancy.oc1..aaaaaaaa..."
3+
user_ocid = "ocid1.user.oc1..aaaaaaaa..."
4+
private_key_path = "/path-to-my/.oci/my-oci-key.pem"
5+
fingerprint = "a5:68:0f:46:6d:06:43:5a:38:98:74:??:??:??:??:??"
6+
region = "uk-london-1"
7+
root_compartment_id = "ocid1.tenancy.oc1..aaaaaaaa..."

0 commit comments

Comments
 (0)