Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update documentation to clarify support for DNS app import #23

Merged
merged 3 commits into from
May 30, 2019

Conversation

jakewan
Copy link
Contributor

@jakewan jakewan commented May 30, 2019

Originally terraform import wasn't supported, but later it was added and I forgot to mention it in the website docs.

This is only a documentation change, so you should be able to just read the updated Markdown file directly. But if you're interested in testing the import functionality itself, this is how I do it:

  1. Start up the Docker container (e.g. make docker-build, make docker-run)
  2. On the Docker host in another shell, run make docker-exec-install-plugin
  3. Navigate to /terraform-provider-citrixitm/examples/dns/import-custom-app
  4. Create an app in the Portal using the app.js file from that directory on the Docker host.
  5. Obtain the App ID from the Portal and use it to import the app via Terraform. In my case, the app id was 166:
[container] /terraform-provider-citrixitm/examples/dns/import-custom-app $ terraform import -var itm_client_id=$ITM_CLIENT_ID -var itm_client_secret=$ITM_CLIENT_SECRET citrixitm_dns_app.simple_app 166
  1. Run a terraform plan -var itm_client_id=$ITM_CLIENT_ID -var itm_client_secret=$ITM_CLIENT_SECRET to see if there are any differences between the resource configuration and the Production app. In my case there were because I made no attempt to make the app in the Portal have the correct name, description or fallback CNAME.
[container] /terraform-provider-citrixitm/examples/dns/import-custom-app $ terraform plan -var itm_client_id=$ITM_CLIENT_ID -var itm_client_secret=$ITM_CLIENT_SECRET 
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

citrixitm_dns_app.simple_app: Refreshing state... (ID: 166)

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ citrixitm_dns_app.simple_app
      description:    "" => "A simple static response app"
      fallback_cname: "foo.example.com" => "origin.example.com"
      name:           "Test Import" => "My Static App"


Plan: 0 to add, 1 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
  1. I want ahead and ran applied the changes, although this isn't really necessary to test the import functionality:
container] /terraform-provider-citrixitm/examples/dns/import-custom-app $ terraform apply -var itm_client_id=$ITM_CLIENT_ID -var itm_client_secret=$ITM_CLIENT_SECRET 
citrixitm_dns_app.simple_app: Refreshing state... (ID: 166)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ citrixitm_dns_app.simple_app
      description:    "" => "A simple static response app"
      fallback_cname: "foo.example.com" => "origin.example.com"
      name:           "Test Import" => "My Static App"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

citrixitm_dns_app.simple_app: Modifying... (ID: 166)
  description:    "" => "A simple static response app"
  fallback_cname: "foo.example.com" => "origin.example.com"
  name:           "Test Import" => "My Static App"
citrixitm_dns_app.simple_app: Modifications complete after 1s (ID: 166)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Outputs:

dns_app_cname = 2-01-d896-00a6.cdx.cedexis.net
dns_app_id = 166
dns_app_version = 2

@jakewan jakewan requested review from wraithan and aggarwaa May 30, 2019 03:43
@jakewan jakewan self-assigned this May 30, 2019
Copy link

@aggarwaa aggarwaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@jakewan jakewan merged commit a6d3c51 into master May 30, 2019
@jakewan jakewan deleted the jacob/clarify-dns-app-import-support branch May 30, 2019 18:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants