summaryrefslogtreecommitdiff
path: root/terraform/oci.tf
blob: 9801e3b194b5a59e887a0a622852c7854897005f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Create everything from an existing tenancy

resource "oci_identity_compartment" "borealis" {
  compartment_id = var.oracle_tenancy_ocid
  description    = "For my personal infra"
  name           = "borealis"
}

data "oci_identity_availability_domains" "borealis" {
  compartment_id = oci_identity_compartment.borealis.id
}

output "borealis-first-availability-domain" {
  value = data.oci_identity_availability_domains.borealis.availability_domains[0].name
}

resource "oci_core_vcn" "borealis" {
  compartment_id = oci_identity_compartment.borealis.id
  display_name   = "borealis"
}

resource "oci_core_subnet" "borealis_global" {
  cidr_block     = "10.0.0.0/24"
  compartment_id = oci_core_vcn.borealis.compartment_id
  vcn_id         = oci_core_vcn.borealis.id

  display_name = "global"
}

resource "oci_core_security_list" "borealis_global" {
  compartment_id = oci_core_vcn.borealis.compartment_id
  vcn_id         = oci_core_vcn.borealis.id

  display_name = "default"

  egress_security_rules {
    destination = "0.0.0.0/0"
    protocol    = "all"
  }

  ingress_security_rules {
    icmp_options {
      code = "4"
      type = "3"
    }
    protocol = "1"
    source   = "0.0.0.0/0"
  }

  ingress_security_rules {
    icmp_options {
      code = "-1"
      type = "3"
    }
    protocol = "1"
    source   = "10.0.0.0/16"
  }

  ingress_security_rules {
    description = "Allow HTTP traffic"

    protocol = "6"
    source   = "0.0.0.0/0"

    tcp_options {
      min = 80
      max = 80
    }
  }

  ingress_security_rules {
    description = "Allow HTTPS traffic"

    protocol = "6"
    source   = "0.0.0.0/0"

    tcp_options {
      min = 443
      max = 443
    }
  }
}