File tree Expand file tree Collapse file tree 10 files changed +28
-41
lines changed
datadog-oci-orm/metrics-setup Expand file tree Collapse file tree 10 files changed +28
-41
lines changed Original file line number Diff line number Diff line change 11# Overview
22
33Repository of OCI functions that process OCI metrics and send data to Datadog as metrics events for further processing.
4+
5+ # Deploy to OCI
6+
7+ [ ![ Deploy to Oracle Cloud] ( https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg )] ( https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/kanishktripathi/datadog-serverless-functions/releases/latest/download/datadog-oci-orm.zip )
8+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,16 +6,16 @@ resource "null_resource" "Login2OCIR" {
66}
77
88# ## Repository in the Container Image Registry for the container images underpinning the function
9- # resource "oci_artifacts_container_repository" "function_repo" {
10- # # note: repository = store for all images versions of a specific container image - so it included the function name
11- # depends_on = [null_resource.Login2OCIR]
12- # count = local.user_image_provided ? 0 : 1
13- # compartment_id = oci_identity_compartment.datadog-compartment.id
14- # display_name = local.ocir_repo_name
15- # is_public = false
16- # defined_tags = {}
17- # freeform_tags = local.freeform_tags
18- # }
9+ resource "oci_artifacts_container_repository" "function_repo" {
10+ # note: repository = store for all images versions of a specific container image - so it included the function name
11+ depends_on = [null_resource. Login2OCIR ]
12+ count = local. user_image_provided ? 0 : 1
13+ compartment_id = var . compartment_ocid
14+ display_name = local. ocir_repo_name
15+ is_public = false
16+ defined_tags = {}
17+ freeform_tags = local. freeform_tags
18+ }
1919
2020# ### build the function into a container image and push that image to the repository in the OCI Container Image Registry
2121resource "null_resource" "FnImagePushToOCIR" {
Original file line number Diff line number Diff line change 11resource "oci_functions_application" "metrics_function_app" {
22 depends_on = [data . oci_core_subnet . input_subnet ]
3- compartment_id = oci_identity_compartment . datadog-compartment . id
3+ compartment_id = var . compartment_ocid
44 config = {
55 " DD_API_KEY" = var.datadog_api_key
66 " DD_COMPRESS" = " true"
@@ -10,7 +10,7 @@ resource "oci_functions_application" "metrics_function_app" {
1010 " TENANCY_OCID" = var.tenancy_ocid
1111 }
1212 defined_tags = {}
13- display_name = " ${ var . datadog_compartment } -function-app"
13+ display_name = " ${ var . resource_name_prefix } -function-app"
1414 freeform_tags = local. freeform_tags
1515 network_security_group_ids = [
1616 ]
Original file line number Diff line number Diff line change 11locals {
22 # Names for the network infra
3- vcn_name = " ${ var . datadog_compartment } -vcn"
3+ vcn_name = " ${ var . resource_name_prefix } -vcn"
44 nat_gateway = " ${ local . vcn_name } -natgateway"
55 service_gateway = " ${ local . vcn_name } -servicegateway"
66 subnet = " ${ local . vcn_name } -private-subnet"
77}
88
99locals {
1010 # Names for the service connector
11- connector_name = " ${ var . datadog_compartment } -connector"
11+ connector_name = " ${ var . resource_name_prefix } -connector"
1212}
1313
1414locals {
@@ -33,7 +33,7 @@ locals {
3333 # OCI docker repository
3434 oci_docker_repository = " ${ local . oci_region_key } .ocir.io/${ local . ocir_namespace } "
3535 oci_docker_host = " ${ local . oci_region_key } .ocir.io"
36- ocir_repo_name = " datadog -functions"
36+ ocir_repo_name = " ${ var . resource_name_prefix } -functions"
3737 function_name = " datadog-function-metrics"
3838 docker_image_path = " ${ local . oci_docker_repository } /${ local . ocir_repo_name } /${ local . function_name } :latest"
3939 # custom_image_path = "${local.oci_region_key}.ocir.io/${var.function_image_path}"
Original file line number Diff line number Diff line change @@ -8,14 +8,6 @@ output "tenancy_object_storage_namespace" {
88 value = local. ocir_namespace
99}
1010
11- output "compartment_name" {
12- value = oci_identity_compartment. datadog-compartment . name
13- }
14-
15- output "compartment_OCID" {
16- value = oci_identity_compartment. datadog-compartment . id
17- }
18-
1911output "vcn_network_details" {
2012 depends_on = [module . vcn ]
2113 description = " Output of the created network infra"
Original file line number Diff line number Diff line change @@ -29,11 +29,12 @@ variableGroups:
2929 - ${oci_docker_password}
3030
3131variables :
32- datadog_compartment :
32+ resource_name_prefix :
3333 type : string
34- title : Compartment Name
35- description : The name of the compartment that will be created for the resource .
34+ title : Resource prefix
35+ description : The prefix for the name of all of the resources .
3636 required : true
37+ default : datadog-metrics
3738 create_vcn :
3839 title : Create VCN
3940 description : Optional variable to create virtual network for the setup. Otherwise, choose an existing subnet from VCN
Original file line number Diff line number Diff line change 11resource "oci_sch_service_connector" "metrics_service_connector" {
22 depends_on = [oci_functions_function . metrics_function ]
33 # Required
4- compartment_id = oci_identity_compartment . datadog-compartment . id
4+ compartment_id = var . compartment_ocid
55 display_name = local. connector_name
66 source {
77 # Required
@@ -41,6 +41,4 @@ resource "oci_sch_service_connector" "metrics_service_connector" {
4141 defined_tags = {}
4242 description = " Terraform created connector hub to distribute metrics"
4343 freeform_tags = local. freeform_tags
44- state = " INACTIVE"
45-
4644}
Original file line number Diff line number Diff line change 1- variable "datadog_compartment " {
1+ variable "resource_name_prefix " {
22 type = string
3- description = " The name of the compartment created to hold all of the resources"
3+ description = " The prefix for the name of all of the resources"
44 default = " datadog-metrics"
55}
66
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module "vcn" {
33 source = " oracle-terraform-modules/vcn/oci"
44 version = " 3.6.0"
55 count = var. create_vcn ? 1 : 0
6- compartment_id = oci_identity_compartment . datadog-compartment . id
6+ compartment_id = var . compartment_ocid
77 defined_tags = {}
88 freeform_tags = local. freeform_tags
99 vcn_cidrs = [" 10.0.0.0/16" ]
You can’t perform that action at this time.
0 commit comments