Skip to content

Commit ebc2165

Browse files
Himani-oraclejotruon
authored andcommitted
Deployment resource fix
1 parent 422171f commit ebc2165

6 files changed

+12
-34
lines changed

oci/devops_deploy_environment_instance_group_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var (
3535
}
3636
deployComputeInstanceGroupEnvironmentSelectorCollectionItemsRepresentation = map[string]interface{}{
3737
"selector_type": Representation{repType: Required, create: `INSTANCE_IDS`},
38-
"compute_instance_ids": Representation{repType: Required, create: []string{`ocid1.instance.oc1.iad.anuwcljtnsx72macffe5fbkzbj4eerle5ot56g2cexj3jvfsr242pye44ghq`}},
38+
"compute_instance_ids": Representation{repType: Required, create: []string{`ocid1.instance.oc1.phx.anuwcljtnsx72macffe5fbkzbj4eerle5ot56g2cexj3jvfsr242pye44ghq`}},
3939
}
4040
)
4141

oci/devops_deploy_stage_compute_instance_group_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var (
3333
"rollback_policy": RepresentationGroup{Optional, deployStageRollbackPolicyRepresentation},
3434
"load_balancer_config": RepresentationGroup{Optional, deployStageLoadBalancerInstanceGroupConfigRepresentation},
3535
"failure_policy": RepresentationGroup{Optional, deployComputeInstanceStageFailurePolicyRepresentation},
36+
"lifecycle": RepresentationGroup{Required, ignoreDefinedTagsDifferencesRepresentation},
3637
}))
3738

3839
deployComputeInstanceStageRolloutPolicyRepresentation = map[string]interface{}{
@@ -120,7 +121,6 @@ func TestDevopsDeployStageResource_computeInstanceGroup(t *testing.T) {
120121
generateResourceFromRepresentationMap("oci_devops_deploy_stage", "test_deploy_stage", Optional, Create, deployComputeInstanceGroupStageRepresentation),
121122
Check: resource.ComposeAggregateTestCheckFunc(
122123
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
123-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
124124
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
125125
resource.TestCheckResourceAttr(resourceName, "deploy_stage_predecessor_collection.#", "1"),
126126
resource.TestCheckResourceAttr(resourceName, "deploy_stage_predecessor_collection.0.items.#", "1"),
@@ -164,7 +164,6 @@ func TestDevopsDeployStageResource_computeInstanceGroup(t *testing.T) {
164164
generateResourceFromRepresentationMap("oci_devops_deploy_stage", "test_deploy_stage", Optional, Update, deployComputeInstanceGroupStageRepresentation),
165165
Check: resource.ComposeAggregateTestCheckFunc(
166166
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
167-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
168167
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
169168
resource.TestCheckResourceAttr(resourceName, "deploy_stage_predecessor_collection.#", "1"),
170169
resource.TestCheckResourceAttr(resourceName, "deploy_stage_predecessor_collection.0.items.#", "1"),
@@ -220,7 +219,6 @@ func TestDevopsDeployStageResource_computeInstanceGroup(t *testing.T) {
220219
Check: resource.ComposeAggregateTestCheckFunc(
221220
resource.TestCheckResourceAttrSet(singularDatasourceName, "deploy_stage_id"),
222221
resource.TestCheckResourceAttrSet(singularDatasourceName, "compartment_id"),
223-
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "1"),
224222
resource.TestCheckResourceAttr(singularDatasourceName, "deploy_stage_predecessor_collection.#", "1"),
225223
resource.TestCheckResourceAttrSet(singularDatasourceName, "deploy_stage_predecessor_collection.0.items.0.id"),
226224
resource.TestCheckResourceAttr(singularDatasourceName, "deploy_stage_type", "COMPUTE_INSTANCE_GROUP_ROLLING_DEPLOYMENT"),

oci/devops_deployment_pipeline_redployment_test.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ var (
3131
"display_name": Representation{repType: Optional, create: `displayName`},
3232
"id": Representation{repType: Optional, create: `${oci_devops_deployment.test_pipeline_redeployment.id}`},
3333
"project_id": Representation{repType: Optional, create: `${oci_devops_project.test_project.id}`},
34-
"state": Representation{repType: Optional, create: `Accepted`},
3534
"filter": RepresentationGroup{Required, devopsPipelineRedeploymentDataSourceFilterRepresentation}}
3635
devopsPipelineRedeploymentDataSourceFilterRepresentation = map[string]interface{}{
3736
"name": Representation{repType: Required, create: `id`},
3837
"values": Representation{repType: Required, create: []string{`${oci_devops_deployment.test_pipeline_redeployment.id}`}},
3938
}
4039

41-
devopsPipelineRedeploymentRepresentation = getUpdatedRepresentationCopy("deployment_type", Representation{repType: Required, create: `PIPELINE_REDEPLOYMENT`}, devopsDeploymentRepresentation)
40+
devopsPipelineRedeploymentRepresentation = getUpdatedRepresentationCopy("deployment_type", Representation{repType: Required, create: `PIPELINE_REDEPLOYMENT`},
41+
representationCopyWithNewProperties(representationCopyWithRemovedProperties(devopsDeploymentRepresentation, []string{"deployment_arguments"}), map[string]interface{}{
42+
"previous_deployment_id": Representation{repType: Required, create: `${oci_devops_deployment.test_deploy_1.id}`},
43+
}))
4244

4345
DevopsPipelineRedeploymentResourceDependencies = generateResourceFromRepresentationMap("oci_devops_deploy_artifact", "test_deploy_artifact", Required, Create, deployArtifactRepresentation) +
4446
generateResourceFromRepresentationMap("oci_devops_deploy_environment", "test_deploy_environment", Required, Create, deployEnvironmentRepresentation) +
@@ -48,12 +50,7 @@ var (
4850
AvailabilityDomainConfig +
4951
DefinedTagsDependencies +
5052
generateResourceFromRepresentationMap("oci_logging_log_group", "test_log_group", Required, Create, logGroupRepresentation) +
51-
generateResourceFromRepresentationMap("oci_logging_log", "test_log", Optional, Create, getMultipleUpdatedRepresenationCopy(
52-
[]string{"configuration", "is_enabled", "retention_duration"}, []interface{}{
53-
RepresentationGroup{Required, devopLogConfigurationRepresentation},
54-
Representation{repType: Required, create: `true`},
55-
Representation{repType: Required, create: `30`}},
56-
logRepresentation)) +
53+
generateResourceFromRepresentationMap("oci_logging_log", "test_log", Optional, Create, deployLogRepresentation) +
5754
generateResourceFromRepresentationMap("oci_ons_notification_topic", "test_notification_topic", Required, Create, notificationTopicRepresentation)
5855
)
5956

@@ -107,7 +104,6 @@ func TestDevopsDeploymentResource_pipelineRedeployment(t *testing.T) {
107104
generateResourceFromRepresentationMap("oci_devops_deployment", "test_pipeline_redeployment", Optional, Create, devopsPipelineRedeploymentRepresentation),
108105
Check: resource.ComposeAggregateTestCheckFunc(
109106
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
110-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
111107
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
112108
resource.TestCheckResourceAttrSet(resourceName, "previous_deployment_id"),
113109
resource.TestCheckResourceAttr(resourceName, "deployment_type", "PIPELINE_REDEPLOYMENT"),
@@ -134,7 +130,6 @@ func TestDevopsDeploymentResource_pipelineRedeployment(t *testing.T) {
134130
generateResourceFromRepresentationMap("oci_devops_deployment", "test_pipeline_redeployment", Optional, Update, devopsPipelineRedeploymentRepresentation),
135131
Check: resource.ComposeAggregateTestCheckFunc(
136132
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
137-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
138133
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
139134
resource.TestCheckResourceAttrSet(resourceName, "previous_deployment_id"),
140135
resource.TestCheckResourceAttr(resourceName, "deployment_type", "PIPELINE_REDEPLOYMENT"),
@@ -164,7 +159,6 @@ func TestDevopsDeploymentResource_pipelineRedeployment(t *testing.T) {
164159
resource.TestCheckResourceAttr(datasourceName, "display_name", "displayName"),
165160
resource.TestCheckResourceAttrSet(datasourceName, "id"),
166161
resource.TestCheckResourceAttrSet(datasourceName, "project_id"),
167-
resource.TestCheckResourceAttr(datasourceName, "state", "Accepted"),
168162

169163
resource.TestCheckResourceAttr(datasourceName, "deployment_collection.#", "1"),
170164
resource.TestCheckResourceAttr(datasourceName, "deployment_collection.0.items.#", "0"),
@@ -179,14 +173,12 @@ func TestDevopsDeploymentResource_pipelineRedeployment(t *testing.T) {
179173
resource.TestCheckResourceAttrSet(singularDatasourceName, "deployment_id"),
180174

181175
resource.TestCheckResourceAttrSet(singularDatasourceName, "compartment_id"),
182-
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "1"),
183176
resource.TestCheckResourceAttrSet(singularDatasourceName, "previous_deployment_id"),
184177
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_execution_progress.#", "1"),
185178
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_type", "PIPELINE_REDEPLOYMENT"),
186179
resource.TestCheckResourceAttr(singularDatasourceName, "display_name", "displayName"),
187180
resource.TestCheckResourceAttr(singularDatasourceName, "freeform_tags.%", "1"),
188181
resource.TestCheckResourceAttrSet(singularDatasourceName, "id"),
189-
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),
190182
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
191183
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_updated"),
192184
),

oci/devops_deployment_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func DevopsDeploymentResource() *schema.Resource {
324324
},
325325
"deployment_execution_progress": {
326326
Type: schema.TypeList,
327-
Optional: true,
327+
Computed: true,
328328
MaxItems: 1,
329329
MinItems: 1,
330330
Elem: &schema.Resource{

oci/devops_deployment_single_stage_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ func TestDevopsDeploymentResource_singleStageDeployment(t *testing.T) {
164164
generateResourceFromRepresentationMap("oci_devops_deployment", "test_deployment", Optional, Create, devopsSingleStageDeploymentRepresentation),
165165
Check: resource.ComposeAggregateTestCheckFunc(
166166
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
167-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "3"),
168167
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
169168
resource.TestCheckResourceAttrSet(resourceName, "deploy_stage_id"),
170169
resource.TestCheckResourceAttr(resourceName, "deployment_type", "SINGLE_STAGE_DEPLOYMENT"),
@@ -191,7 +190,6 @@ func TestDevopsDeploymentResource_singleStageDeployment(t *testing.T) {
191190
generateResourceFromRepresentationMap("oci_devops_deployment", "test_deployment", Optional, Update, devopsSingleStageDeploymentRepresentation),
192191
Check: resource.ComposeAggregateTestCheckFunc(
193192
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
194-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "3"),
195193
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
196194
resource.TestCheckResourceAttrSet(resourceName, "deploy_stage_id"),
197195
resource.TestCheckResourceAttr(resourceName, "deployment_type", "SINGLE_STAGE_DEPLOYMENT"),
@@ -236,7 +234,6 @@ func TestDevopsDeploymentResource_singleStageDeployment(t *testing.T) {
236234
resource.TestCheckResourceAttrSet(singularDatasourceName, "deployment_id"),
237235

238236
resource.TestCheckResourceAttrSet(singularDatasourceName, "compartment_id"),
239-
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "3"),
240237
resource.TestCheckResourceAttrSet(singularDatasourceName, "deploy_stage_id"),
241238
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_type", "SINGLE_STAGE_DEPLOYMENT"),
242239
resource.TestCheckResourceAttr(singularDatasourceName, "display_name", "displayName"),

oci/devops_deployment_test.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ var (
3131
"display_name": Representation{repType: Optional, create: `displayName`, update: `displayName2`},
3232
"id": Representation{repType: Optional, create: `${oci_devops_deployment.test_deployment.id}`},
3333
"project_id": Representation{repType: Optional, create: `${oci_devops_project.test_project.id}`},
34-
"state": Representation{repType: Optional, create: `Accepted`},
3534
"filter": RepresentationGroup{Required, devopsDeploymentDataSourceFilterRepresentation}}
3635
devopsDeploymentDataSourceFilterRepresentation = map[string]interface{}{
3736
"name": Representation{repType: Required, create: `id`},
@@ -44,7 +43,8 @@ var (
4443
"defined_tags": Representation{repType: 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")}`},
4544
"deployment_arguments": RepresentationGroup{Optional, deploymentDeploymentArgumentsRepresentation},
4645
"display_name": Representation{repType: Optional, create: `displayName`},
47-
"freeform_tags": Representation{repType: Optional, create: map[string]string{"bar-key": "value"}, update: map[string]string{"Department": "Accounting"}},
46+
"freeform_tags": Representation{repType: Optional, create: map[string]string{"bar-key": "value"}},
47+
"lifecycle": RepresentationGroup{Required, ignoreDefinedTagsDifferencesRepresentation},
4848
}
4949
deploymentDeploymentArgumentsRepresentation = map[string]interface{}{
5050
"items": RepresentationGroup{Optional, deploymentDeploymentArgumentsItemsRepresentation},
@@ -71,12 +71,7 @@ var (
7171
AvailabilityDomainConfig +
7272
DefinedTagsDependencies +
7373
generateResourceFromRepresentationMap("oci_logging_log_group", "test_log_group", Required, Create, logGroupRepresentation) +
74-
generateResourceFromRepresentationMap("oci_logging_log", "test_log", Optional, Create, getMultipleUpdatedRepresenationCopy(
75-
[]string{"configuration", "is_enabled", "retention_duration"}, []interface{}{
76-
RepresentationGroup{Required, devopLogConfigurationRepresentation},
77-
Representation{repType: Required, create: `true`},
78-
Representation{repType: Required, create: `30`}},
79-
logRepresentation)) +
74+
generateResourceFromRepresentationMap("oci_logging_log", "test_log", Optional, Create, deployLogRepresentation) +
8075
generateResourceFromRepresentationMap("oci_ons_notification_topic", "test_notification_topic", Required, Create, notificationTopicRepresentation)
8176
)
8277

@@ -130,7 +125,6 @@ func TestDevopsDeploymentResource_basic(t *testing.T) {
130125
generateResourceFromRepresentationMap("oci_devops_deployment", "test_deployment", Optional, Create, devopsDeploymentRepresentation),
131126
Check: resource.ComposeAggregateTestCheckFunc(
132127
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
133-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
134128
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
135129
resource.TestCheckResourceAttr(resourceName, "deployment_arguments.#", "1"),
136130
resource.TestCheckResourceAttr(resourceName, "deployment_arguments.0.items.#", "1"),
@@ -160,7 +154,6 @@ func TestDevopsDeploymentResource_basic(t *testing.T) {
160154
generateResourceFromRepresentationMap("oci_devops_deployment", "test_deployment", Optional, Update, devopsDeploymentRepresentation),
161155
Check: resource.ComposeAggregateTestCheckFunc(
162156
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
163-
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
164157
resource.TestCheckResourceAttrSet(resourceName, "deploy_pipeline_id"),
165158
resource.TestCheckResourceAttr(resourceName, "deployment_arguments.#", "1"),
166159
resource.TestCheckResourceAttr(resourceName, "deployment_arguments.0.items.#", "1"),
@@ -192,9 +185,9 @@ func TestDevopsDeploymentResource_basic(t *testing.T) {
192185
resource.TestCheckResourceAttrSet(datasourceName, "deploy_pipeline_id"),
193186
resource.TestCheckResourceAttr(datasourceName, "display_name", "displayName2"),
194187
resource.TestCheckResourceAttrSet(datasourceName, "project_id"),
195-
resource.TestCheckResourceAttr(datasourceName, "state", "Accepted"),
196188

197189
resource.TestCheckResourceAttr(datasourceName, "deployment_collection.#", "1"),
190+
resource.TestCheckResourceAttr(datasourceName, "deployment_collection.0.items.#", "0"),
198191
),
199192
},
200193
// verify singular datasource
@@ -206,7 +199,6 @@ func TestDevopsDeploymentResource_basic(t *testing.T) {
206199
resource.TestCheckResourceAttrSet(singularDatasourceName, "deployment_id"),
207200

208201
resource.TestCheckResourceAttrSet(singularDatasourceName, "compartment_id"),
209-
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "1"),
210202
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_arguments.#", "1"),
211203
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_arguments.0.items.#", "1"),
212204
resource.TestCheckResourceAttr(singularDatasourceName, "deployment_arguments.0.items.0.name", "name"),
@@ -216,7 +208,6 @@ func TestDevopsDeploymentResource_basic(t *testing.T) {
216208
resource.TestCheckResourceAttr(singularDatasourceName, "display_name", "displayName"),
217209
resource.TestCheckResourceAttr(singularDatasourceName, "freeform_tags.%", "1"),
218210
resource.TestCheckResourceAttrSet(singularDatasourceName, "id"),
219-
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),
220211
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
221212
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_updated"),
222213
),

0 commit comments

Comments
 (0)