Skip to content

Commit 4ec48f8

Browse files
Terraform Team AutomationNishtha Goel
authored andcommitted
Added - Support for Email Delivery: Custom Return Path API
1 parent eb2776e commit 4ec48f8

21 files changed

+1420
-26
lines changed

examples/email/emailreturnpath.tf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
5+
variable "email_return_path_state" {
6+
default = "ACTIVE"
7+
}
8+
9+
variable "domain_verification_id" {
10+
11+
}
12+
13+
variable "email_domain" {
14+
default = "objdomain.email.ap-mumbai-1.oci.oc-test.com"
15+
}
16+
17+
variable "description" {
18+
default = "description2"
19+
}
20+
21+
variable "department" {
22+
default = "Accounting"
23+
}
24+
25+
26+
data "oci_email_email_return_paths" "test_email_return_paths" {
27+
compartment_id = var.compartment_ocid
28+
filter {
29+
name = "id"
30+
values = ["${oci_email_email_return_path.test_email_return_path.id}"]
31+
}
32+
id = "${oci_email_email_return_path.test_email_return_path.id}"
33+
name = "tfrp.${oci_email_email_domain.test_email_domain_rp.name}"
34+
parent_resource_id = "${oci_email_email_domain.test_email_domain_rp.id}"
35+
state = var.email_return_path_state
36+
}
37+
38+
resource "oci_email_email_domain" "test_email_domain_rp" {
39+
compartment_id = var.compartment_ocid
40+
domain_verification_id = var.domain_verification_id
41+
name = var.email_domain
42+
}
43+
44+
resource "oci_email_email_return_path" "test_email_return_path" {
45+
description = var.description
46+
freeform_tags = {
47+
"Department" = var.department
48+
}
49+
name = "tfrp.${oci_email_email_domain.test_email_domain_rp.name}"
50+
parent_resource_id = "${oci_email_email_domain.test_email_domain_rp.id}"
51+
}

examples/email/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ variable "compartment_ocid" {
2222
}
2323

2424
variable "region" {
25-
default = "us-ashburn-1"
25+
default = "ap-mumbai-1"
2626
}
2727

2828
provider "oci" {

internal/integrationtest/email_email_domain_test.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import (
2626
)
2727

2828
var (
29+
ignoreEmailDomainDefinedTagsChangesRep = map[string]interface{}{
30+
"ignore_changes": acctest.Representation{RepType: acctest.Required, Create: []string{`defined_tags`}},
31+
}
2932
EmailEmailDomainRequiredOnlyResource = EmailEmailDomainResourceDependencies +
3033
acctest.GenerateResourceFromRepresentationMap("oci_email_email_domain", "test_email_domain", acctest.Required, acctest.Create, EmailEmailDomainRepresentation)
3134

@@ -50,11 +53,13 @@ var (
5053
}
5154

5255
EmailEmailDomainRepresentation = map[string]interface{}{
53-
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
54-
"name": acctest.Representation{RepType: acctest.Required, Create: randomDomain},
55-
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
56-
"description": acctest.Representation{RepType: acctest.Optional, Create: `description`, Update: `description2`},
57-
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
56+
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
57+
"name": acctest.Representation{RepType: acctest.Required, Create: randomDomain},
58+
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
59+
"description": acctest.Representation{RepType: acctest.Optional, Create: `description`, Update: `description2`},
60+
"domain_verification_id": acctest.Representation{RepType: acctest.Optional, Create: `NONE`},
61+
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
62+
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Required, Group: ignoreEmailDomainDefinedTagsChangesRep},
5863
}
5964

6065
EmailEmailDomainResourceDependencies = DefinedTagsDependencies
@@ -108,6 +113,7 @@ func TestEmailEmailDomainResource_basic(t *testing.T) {
108113
Check: resource.ComposeAggregateTestCheckFunc(
109114
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
110115
resource.TestCheckResourceAttr(resourceName, "description", "description"),
116+
resource.TestCheckResourceAttrSet(resourceName, "domain_verification_id"),
111117
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
112118
resource.TestCheckResourceAttrSet(resourceName, "id"),
113119
resource.TestCheckResourceAttr(resourceName, "name", randomDomain),
@@ -134,6 +140,7 @@ func TestEmailEmailDomainResource_basic(t *testing.T) {
134140
Check: resource.ComposeAggregateTestCheckFunc(
135141
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentIdU),
136142
resource.TestCheckResourceAttr(resourceName, "description", "description"),
143+
resource.TestCheckResourceAttrSet(resourceName, "domain_verification_id"),
137144
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
138145
resource.TestCheckResourceAttrSet(resourceName, "id"),
139146
resource.TestCheckResourceAttr(resourceName, "name", randomDomain),
@@ -155,6 +162,7 @@ func TestEmailEmailDomainResource_basic(t *testing.T) {
155162
Check: resource.ComposeAggregateTestCheckFunc(
156163
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
157164
resource.TestCheckResourceAttr(resourceName, "description", "description2"),
165+
resource.TestCheckResourceAttrSet(resourceName, "domain_verification_id"),
158166
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
159167
resource.TestCheckResourceAttrSet(resourceName, "id"),
160168
resource.TestCheckResourceAttr(resourceName, "name", randomDomain),

0 commit comments

Comments
 (0)