Skip to content

Commit e154b84

Browse files
addressing review comments for HUBS-1695
1 parent 02a452c commit e154b84

File tree

22 files changed

+240
-106
lines changed

22 files changed

+240
-106
lines changed

docs/guides/provider_guide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
## Delphix Provider Guide
44
[We have provided a handful of examples in our GitHub repository to help you get a jump start with our Delphix Provider.](https://github.com/delphix-integrations/terraform-provider-delphix/tree/main/examples) These examples range from Terraform resource templates, quick Terraform examples, and full Jenkins pipelines. We update this repository based on our implementation experience, so be sure to check back for updates!
5-
If you have a suggested template, request, or modification, please submit it in our [GitHub Issues section.](https://github.com/delphix-integrations/terraform-provider-delphix)
5+
6+
If you have a suggested template, request, or modification, please submit it in our [GitHub Issues section.](https://github.com/delphix-integrations/terraform-provider-delphix)

examples/jenkins-integration/jenkinsfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ pipeline {
3131
steps {
3232
script {
3333
echo ('Provisioning VDB...')
34-
git branch: 'main', changelog: false, poll: false, url: 'https://github.com/nick-mathison/delphix-terraform-examples.git'
34+
git branch: 'main', changelog: false, poll: false, url: 'https://github.com/delphix-integrations/terraform-provider-delphix.git'
3535
// sh ('ls -R')
36-
sh ('terraform -chdir=simple-provision init')
36+
sh ('terraform -chdir=examples/simple-provision init')
3737
withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) {
38-
sh ('terraform -chdir=simple-provision apply -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve')
38+
sh ('terraform -chdir=examples/simple-provision apply -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve')
3939
}
40-
vdb_id = sh(script: 'terraform -chdir=simple-provision output vdb_id_1', returnStdout: true)
40+
vdb_id = sh(script: 'terraform -chdir=examples/simple-provision output vdb_id_1', returnStdout: true)
4141
vdb_id = vdb_id.replaceAll('\\"', "").trim()
42-
vdb_name = sh(script: 'terraform -chdir=simple-provision output vdb_name_1', returnStdout: true)
42+
vdb_name = sh(script: 'terraform -chdir=examples/simple-provision output vdb_name_1', returnStdout: true)
4343
echo ("vdb_id:" + vdb_id)
4444
echo ("vdb_name:" + vdb_name)
4545
provision_successful = true
@@ -161,7 +161,7 @@ pipeline {
161161
sleep (60)
162162
echo ('Destroying Test App and VDB...')
163163
withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) {
164-
sh ('terraform -chdir=simple-provision destroy -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve')
164+
sh ('terraform -chdir=examples/simple-provision destroy -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve')
165165
}
166166
} else {
167167
echo ('No App or VDB to destroy...')
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
### Simple Getting Stated
3+
4+
1) Update the dct_hostname and dct_api_key variables in the `variables.tf` or in Terrafrom Cloud with the DCT Server and API Key.
5+
For example:
6+
- DCT: uv123abcfei59h6qajyy.vm.cld.sr
7+
- API Key: 2.ZAAgpjHxljW7A7g...
8+
9+
2) Update `Oracle_QA` with an applicable VDB name and run the following commands.
10+
```
11+
# Create all resources
12+
terraform apply -var="source_data_id_1=Oracle_QA"
13+
14+
# Destroy resources
15+
terraform destroy"
16+
```
17+
18+
19+
### Troubleshoot: Invalid Resource State
20+
21+
If you find that you've lost the sync between DCT and Terraform, use the `terraform state rm` command to help reconfigure without starting over.
22+
```
23+
terraform state rm delphix_vdb.provision_vdb_1
24+
25+
terraform state rm delphix_vdb_group.create_vdb_group
26+
```
27+
28+
[Documentation](https://developer.hashicorp.com/terraform/cli/commands/state/rm)

examples/simple-provision/main.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Configure the connection to Data Control Tower
2+
provider "delphix" {
3+
host = var.dct_hostname
4+
key = var.dct_api_key
5+
tls_insecure_skip = true
6+
}
7+
8+
# Provision a VDB 1
9+
resource "delphix_vdb" "provision_vdb_1" {
10+
name = "tfmtest1"
11+
source_data_id = var.source_data_id_1
12+
auto_select_repository = true
13+
}
14+
15+
# Create a VDB Group with VDB 1
16+
resource "delphix_vdb_group" "create_vdb_group" {
17+
name = "Terraform Demo Group"
18+
vdb_ids = [
19+
delphix_vdb.provision_vdb_1.id
20+
]
21+
}

examples/simple-provision/outputs.tf

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variable "dct_hostname" {
2+
type = string
3+
description = "dct hostname config file [default: workspace variable set]"
4+
}
5+
6+
variable "dct_api_key" {
7+
type = string
8+
description = "dct api key config file [default: workspace variable set]"
9+
}
10+
11+
variable "source_data_id_1" {
12+
description = "Name or ID of the VDB or Data Source to provision from. [User Defined]"
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
delphix = {
4+
source = "delphix-integrations/delphix"
5+
version = "1.0.0"
6+
}
7+
}
8+
}

examples/vdb/hana/bookmark/main.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Summary: This template showcases the properties available when provisioning a SAP Hana database from a DCT bookmark.
3+
*/
4+
15
terraform {
26
required_providers {
37
delphix = {
@@ -55,11 +59,6 @@ resource "delphix_vdb" "example" {
5559
mount_path = "/work",
5660
environment_id = "environment-123"
5761
}]
58-
make_current_account_owner = true
59-
tags {
60-
key = "key-1"
61-
value = "value-1"
62-
}
6362
post_snapshot {
6463
name = "string"
6564
command = "string"
@@ -137,4 +136,9 @@ resource "delphix_vdb" "example" {
137136
element_id = "string"
138137
has_credentials = true
139138
}
139+
make_current_account_owner = true
140+
tags {
141+
key = "key-1"
142+
value = "value-1"
143+
}
140144
}

examples/vdb/hana/snapshot/main.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Summary: This template showcases the properties available when provisioning a SAP Hana database from a DCT bookmark.
3+
*/
4+
15
terraform {
26
required_providers {
37
delphix = {
@@ -56,11 +60,6 @@ resource "delphix_vdb" "example" {
5660
mount_path = "/work",
5761
environment_id = "environment-123"
5862
}]
59-
make_current_account_owner = true
60-
tags {
61-
key = "key-1"
62-
value = "value-1"
63-
}
6463
post_snapshot {
6564
name = "string"
6665
command = "string"
@@ -138,4 +137,10 @@ resource "delphix_vdb" "example" {
138137
element_id = "string"
139138
has_credentials = true
140139
}
140+
make_current_account_owner = true
141+
tags {
142+
key = "key-1"
143+
value = "value-1"
144+
}
145+
141146
}

examples/vdb/hana/timestamp/main.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Summary: This template showcases the properties available when provisioning an SAP Hana database from a DCT bookmark.
3+
*/
4+
15
terraform {
26
required_providers {
37
delphix = {
@@ -57,11 +61,6 @@ resource "delphix_vdb" "example" {
5761
mount_path = "/work",
5862
environment_id = "environment-123"
5963
}]
60-
make_current_account_owner = true
61-
tags {
62-
key = "key-1"
63-
value = "value-1"
64-
}
6564
post_snapshot {
6665
name = "string"
6766
command = "string"
@@ -139,4 +138,9 @@ resource "delphix_vdb" "example" {
139138
element_id = "string"
140139
has_credentials = true
141140
}
141+
make_current_account_owner = true
142+
tags {
143+
key = "key-1"
144+
value = "value-1"
145+
}
142146
}

0 commit comments

Comments
 (0)