|
| 1 | +// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + |
| 3 | +variable "config" { |
| 4 | + default = { |
| 5 | + "MY_FUNCTION_CONFIG" = "ConfVal" |
| 6 | + } |
| 7 | +} |
| 8 | + |
| 9 | +variable "image" {} |
| 10 | +variable "image_digest" {} |
| 11 | + |
| 12 | +data "oci_identity_availability_domains" "test_availability_domains" { |
| 13 | + compartment_id = "${var.tenancy_ocid}" |
| 14 | +} |
| 15 | + |
| 16 | +resource "oci_core_vcn" "test_vcn" { |
| 17 | + cidr_block = "10.0.0.0/16" |
| 18 | + compartment_id = "${var.compartment_ocid}" |
| 19 | + display_name = "tf-vcn" |
| 20 | + dns_label = "dnslabel" |
| 21 | +} |
| 22 | + |
| 23 | +resource "oci_core_internet_gateway" "test_network_entity" { |
| 24 | + compartment_id = "${var.compartment_ocid}" |
| 25 | + vcn_id = "${oci_core_vcn.test_vcn.id}" |
| 26 | + display_name = "-tf-internet-gateway" |
| 27 | +} |
| 28 | + |
| 29 | +resource "oci_core_route_table" "test_route_table" { |
| 30 | + compartment_id = "${var.compartment_ocid}" |
| 31 | + |
| 32 | + route_rules { |
| 33 | + cidr_block = "0.0.0.0/0" |
| 34 | + network_entity_id = "${oci_core_internet_gateway.test_network_entity.id}" |
| 35 | + } |
| 36 | + |
| 37 | + vcn_id = "${oci_core_vcn.test_vcn.id}" |
| 38 | +} |
| 39 | + |
| 40 | +resource "oci_core_subnet" "test_subnet" { |
| 41 | + availability_domain = "${lower("${data.oci_identity_availability_domains.test_availability_domains.availability_domains.0.name}")}" |
| 42 | + cidr_block = "10.0.0.0/16" |
| 43 | + compartment_id = "${var.compartment_ocid}" |
| 44 | + dhcp_options_id = "${oci_core_vcn.test_vcn.default_dhcp_options_id}" |
| 45 | + display_name = "tf-subnet" |
| 46 | + dns_label = "dnslabel" |
| 47 | + prohibit_public_ip_on_vnic = "false" |
| 48 | + route_table_id = "${oci_core_route_table.test_route_table.id}" |
| 49 | + security_list_ids = ["${oci_core_vcn.test_vcn.default_security_list_id}"] |
| 50 | + vcn_id = "${oci_core_vcn.test_vcn.id}" |
| 51 | +} |
| 52 | + |
| 53 | +resource "oci_functions_application" "test_application" { |
| 54 | + #Required |
| 55 | + compartment_id = "${var.compartment_ocid}" |
| 56 | + display_name = "example-application" |
| 57 | + subnet_ids = ["${oci_core_subnet.test_subnet.id}"] |
| 58 | + |
| 59 | + #Optional |
| 60 | + config = "${var.config}" |
| 61 | +} |
| 62 | + |
| 63 | +resource "oci_functions_function" "test_function" { |
| 64 | + #Required |
| 65 | + application_id = "${oci_functions_application.test_application.id}" |
| 66 | + display_name = "example-function" |
| 67 | + image = "${var.image}" |
| 68 | + memory_in_mbs = "128" |
| 69 | + |
| 70 | + #Optional |
| 71 | + config = "${var.config}" |
| 72 | + image_digest = "${var.image_digest}" |
| 73 | + timeout_in_seconds = "30" |
| 74 | +} |
0 commit comments