Skip to content

Commit b259452

Browse files
ECI-201 Update README and remove compartment creation (#821)
* Update README.md * Remove compartment creation from the setup
1 parent a9eb823 commit b259452

File tree

10 files changed

+28
-41
lines changed

10 files changed

+28
-41
lines changed

oci/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# Overview
22

33
Repository 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+

oci/datadog-oci-orm/metrics-setup/compartment.tf

Lines changed: 0 additions & 9 deletions
This file was deleted.

oci/datadog-oci-orm/metrics-setup/function_setup.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff 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
2121
resource "null_resource" "FnImagePushToOCIR" {

oci/datadog-oci-orm/metrics-setup/functions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "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
]

oci/datadog-oci-orm/metrics-setup/locals.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
locals {
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

99
locals {
1010
# Names for the service connector
11-
connector_name = "${var.datadog_compartment}-connector"
11+
connector_name = "${var.resource_name_prefix}-connector"
1212
}
1313

1414
locals {
@@ -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}"

oci/datadog-oci-orm/metrics-setup/outputs.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff 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-
1911
output "vcn_network_details" {
2012
depends_on = [module.vcn]
2113
description = "Output of the created network infra"

oci/datadog-oci-orm/metrics-setup/schema.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ variableGroups:
2929
- ${oci_docker_password}
3030

3131
variables:
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

oci/datadog-oci-orm/metrics-setup/serviceconnector.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "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
}

oci/datadog-oci-orm/metrics-setup/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

oci/datadog-oci-orm/metrics-setup/vcn.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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"]

0 commit comments

Comments
 (0)