Skip to content

Commit

Permalink
Merge pull request #11 from yohane-su/fix-all
Browse files Browse the repository at this point in the history
Fix all
  • Loading branch information
sksat authored Dec 18, 2021
2 parents cbd35cd + 48bb93b commit 5b369bf
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 20 deletions.
96 changes: 87 additions & 9 deletions terraform/instance.tf
Original file line number Diff line number Diff line change
@@ -1,47 +1,125 @@
resource "oci_core_instance" "generated_oci_core_instance" {
resource "oci_core_instance" "a1flex_instance01" {
compartment_id = var.OCID_COMPARTMENT
availability_domain = "dhYs:AP-TOKYO-1-AD-1"
fault_domain = "FAULT-DOMAIN-2"

display_name = "arm-ubuntu-01"
shape = "VM.Standard.A1.Flex"

shape_config {
memory_in_gbs = "6"
ocpus = "1"
}

source_details {
source_type = "image"
boot_volume_size_in_gbs = "50"

# Ubuntu 20.04
# https://docs.oracle.com/en-us/iaas/images/image/51111a15-54e5-4af7-adb9-cea542248147/
source_id = "ocid1.image.oc1.ap-tokyo-1.aaaaaaaaxmfmyofygv4bmv533zrkpt5suie2cl5s5ajfx4f3dqv23c3vccpa"
}

agent_config {
is_management_disabled = "false"
is_monitoring_disabled = "false"

plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}

plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}

plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}

availability_config {
recovery_action = "RESTORE_INSTANCE"
}
availability_domain = "dhYs:AP-TOKYO-1-AD-1"
compartment_id = var.OCID_COMPARTMENT

create_vnic_details {
assign_private_dns_record = "true"
assign_public_ip = "true"
subnet_id = oci_core_subnet.ubuntu_subnet.id
}
display_name = "ubuntu-01"

instance_options {
are_legacy_imds_endpoints_disabled = "false"
}

is_pv_encryption_in_transit_enabled = "true"

metadata = {
"ssh_authorized_keys" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAs3X141dqN0IgcRzUo/0j1XVmy5/BcDD8RrXwygxdaX sksat@yohanesu"
}
shape = "VM.Standard.A1.Flex"
}

resource "oci_core_instance" "x86_test_instance" {
compartment_id = var.OCID_COMPARTMENT
availability_domain = "dhYs:AP-TOKYO-1-AD-1"
fault_domain = "FAULT-DOMAIN-2"

display_name = "x86-ubuntu-01"
shape = "VM.Standard.E2.1.Micro"

shape_config {
memory_in_gbs = "6"
memory_in_gbs = "1"
ocpus = "1"
}

source_details {
boot_volume_size_in_gbs = "50"
source_id = var.OCID_SOURCE
source_type = "image"
boot_volume_size_in_gbs = "50"

# Ubuntu 20.04 Minimal
# https://docs.oracle.com/en-us/iaas/images/image/cc6e4086-515b-4254-99ea-171acc5e7460/
source_id = "ocid1.image.oc1.ap-tokyo-1.aaaaaaaato55by5l2yabyitrv62utowyisopehtvqbjrui6vympbi5b57k7q"
}
}

agent_config {
is_management_disabled = "false"
is_monitoring_disabled = "false"

plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}

plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}

plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}

availability_config {
recovery_action = "RESTORE_INSTANCE"
}

create_vnic_details {
assign_private_dns_record = "true"
assign_public_ip = "true"
subnet_id = oci_core_subnet.ubuntu_subnet.id
}

instance_options {
are_legacy_imds_endpoints_disabled = "false"
}

is_pv_encryption_in_transit_enabled = "true"

metadata = {
"ssh_authorized_keys" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAs3X141dqN0IgcRzUo/0j1XVmy5/BcDD8RrXwygxdaX sksat@yohanesu"
}
}
42 changes: 31 additions & 11 deletions terraform/network.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
resource "oci_core_vcn" "ubuntu_vcn" {
compartment_id = var.OCID_COMPARTMENT

display_name = "ubuntu VCN"
dns_label = "defaultvcn"
is_ipv6enabled = false

cidr_blocks = [
"10.0.0.0/16"
]
}

resource "oci_core_subnet" "ubuntu_subnet" {
compartment_id = var.OCID_COMPARTMENT

vcn_id = oci_core_vcn.ubuntu_vcn.id
cidr_block = "10.0.0.0/24"
ipv6cidr_block = ""
display_name = "ubuntu subnet"
dns_label = "defaultsubnet24"

vcn_id = oci_core_vcn.ubuntu_vcn.id
cidr_block = "10.0.0.0/24"
#ipv6cidr_block = ""
route_table_id = oci_core_vcn.ubuntu_vcn.default_route_table_id

dns_label = "subnet08240556"
prohibit_internet_ingress = false
prohibit_public_ip_on_vnic = false

Expand All @@ -16,13 +31,18 @@ resource "oci_core_subnet" "ubuntu_subnet" {
]
}

resource "oci_core_vcn" "ubuntu_vcn" {
resource "oci_core_internet_gateway" "default_oci_core_internet_gateway" {
compartment_id = var.OCID_COMPARTMENT
display_name = "Internet Gateway Default OCI core vcn"
enabled = "true"
vcn_id = oci_core_vcn.ubuntu_vcn.id
}

dns_label = "vcn08240556"
is_ipv6enabled = false

cidr_blocks = [
"10.0.0.0/16"
]
resource "oci_core_default_route_table" "default_oci_core_default_route_table" {
route_rules {
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
network_entity_id = oci_core_internet_gateway.default_oci_core_internet_gateway.id
}
manage_default_resource_id = oci_core_vcn.ubuntu_vcn.default_route_table_id
}

0 comments on commit 5b369bf

Please sign in to comment.