|
| 1 | +# fabric compute example |
| 2 | + |
| 3 | +**__NOTE: THIS RESOURCE TYPE MUST BE IMPORTED. ATTEMPTING TO CREATE IT WILL ERROR__ ** |
| 4 | + |
| 5 | +These resources (fabric computes) are discovered in vRA(C) as part of creating a Cloud Account and can not therefore be "created" or "destroyed" in a traditional sense. |
| 6 | + |
| 7 | +This is an example on how to import a fabric compute resource into terraform and then manage settings on it. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +There are variables which need to be added to a `terraform.tfvars` file: |
| 12 | + |
| 13 | +* `url` - The base url for API operations |
| 14 | +* `refresh_token` - The refresh token for API operations |
| 15 | +* `insecure` - Specify whether to validate TLS certificates |
| 16 | + |
| 17 | +To facilitate adding these variables, a sample tfvars file can be copied first: |
| 18 | + |
| 19 | +```shell |
| 20 | +cp terraform.tfvars.sample terraform.tfvars |
| 21 | +``` |
| 22 | + |
| 23 | +This examples assumes a cloud account is already set up. |
| 24 | + |
| 25 | +To import the resource you must find the ID of the fabric compute. There are a couple of way this ID can be aquired: |
| 26 | + |
| 27 | +1. Via API calls |
| 28 | +2. Viewing the object in a browser and pulling the ID from the url (ex value: `e2a959f4-7ec5-4941-b532-32b798309feb`) |
| 29 | + |
| 30 | +Once the information is added to `terraform.tfvars` the resource can be imported and the manage via: |
| 31 | + |
| 32 | +```shell |
| 33 | +terraform import vra_fabric_compute.this <computeID> |
| 34 | +``` |
| 35 | + |
| 36 | +If the import is successful output from the command should resemble |
| 37 | + |
| 38 | +```shell |
| 39 | +vra_fabric_compute.this: Importing from ID "<computeID>"... |
| 40 | +vra_fabric_compute.this: Import prepared! |
| 41 | + Prepared vra_fabric_compute for import |
| 42 | +vra_fabric_compute.this: Refreshing state... [id=<computeID>] |
| 43 | + |
| 44 | +Import successful! |
| 45 | + |
| 46 | +The resources that were imported are shown above. These resources are now in |
| 47 | +your Terraform state and will henceforth be managed by Terraform |
| 48 | +``` |
| 49 | + |
| 50 | +To apply your settings you can now perform an apply comand: |
| 51 | + |
| 52 | +```shell |
| 53 | +terraform apply |
| 54 | +``` |
0 commit comments