|
| 1 | +# Module: Create Access Keys and Fetch Access keys: |
| 2 | + |
| 3 | +## Overview |
| 4 | +This module may be used to create a user or ingest key using the `newrelic_api_access_key` resource, and fetch the created key, by performing a NerdGraph query under the hood, using the ID of the key created via the resource to fetch the created key. |
| 5 | + |
| 6 | +### Outputs |
| 7 | +The following output values are provided by the module: |
| 8 | + |
| 9 | +* `key`: The actual API key. |
| 10 | +* `name`: The name of the key. |
| 11 | +* `type`: The type of API key. |
| 12 | +* `ingest_type`: The type of ingest (applicable only for key_type = INGEST). |
| 13 | + |
| 14 | + |
| 15 | +### Example usage #1 (USER) |
| 16 | +```terraform |
| 17 | +module "create_access_keys" { |
| 18 | + source = "../examples/modules/newrelic_api_access_key_extended" |
| 19 | +
|
| 20 | + create_access_keys_service = { |
| 21 | + api_key = "NRAK-XXXXXXXXXX" |
| 22 | + newrelic_account_id = "12345678" |
| 23 | + name = "Access key for DemoApp" |
| 24 | + key_type = "USER" |
| 25 | + user_id = 12345623445 |
| 26 | + } |
| 27 | +} |
| 28 | +
|
| 29 | +output "required_attributes" { |
| 30 | + value = module.create_access_keys.required_attributes |
| 31 | +} |
| 32 | +``` |
| 33 | +### Example usage #2 (INGEST-LICENSE) |
| 34 | +```terraform |
| 35 | +module "create_access_keys" { |
| 36 | + source = "../examples/modules/newrelic_api_access_key_extended" |
| 37 | +
|
| 38 | + create_access_keys_service = { |
| 39 | + api_key = "NRAK-XXXXXXXXXX" |
| 40 | + newrelic_account_id = "12345678" |
| 41 | + name = "DemoApp" |
| 42 | + key_type = "USER" |
| 43 | + ingest_type = "LICENSE" |
| 44 | + } |
| 45 | +} |
| 46 | +
|
| 47 | +output "required_attributes" { |
| 48 | + value = module.create_access_keys.required_attributes |
| 49 | +} |
| 50 | +``` |
| 51 | +### Example usage #3 (INGEST-BROWSER) |
| 52 | +```terraform |
| 53 | +module "create_access_keys" { |
| 54 | + source = "../examples/modules/newrelic_api_access_key_extended" |
| 55 | +
|
| 56 | + create_access_keys_service = { |
| 57 | + api_key = "NRAK-XXXXXXXXXX" |
| 58 | + newrelic_account_id = "12345678" |
| 59 | + name = "DemoApp" |
| 60 | + key_type = "USER" |
| 61 | + ingest_type = "BROWSER" |
| 62 | + } |
| 63 | +} |
| 64 | +
|
| 65 | +output "required_attributes" { |
| 66 | + value = module.create_access_keys.required_attributes |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +## Overview |
| 71 | +This module may be used to fetch a user or ingest key, using the ID of the key. Note that the ID of a key can be copied from the New Relic One UI, and is also exported by the newrelic_api_access_key resource in the New Relic Terraform Provider, if the key is created using this resource. |
| 72 | + |
| 73 | +### Outputs |
| 74 | +The following output values are provided by the module: |
| 75 | + |
| 76 | +* `key`: The actual API key |
| 77 | +* `name`: The name of the key. |
| 78 | +* `type`: The type of API key |
| 79 | +* `ingest_type`: The type of ingest (applicable only for key_type = INGEST). |
| 80 | + |
| 81 | + |
| 82 | +### Example usage |
| 83 | +```terraform |
| 84 | +module "fetch_access_keys" { |
| 85 | + source = "../examples/modules/newrelic_api_access_key_extended" |
| 86 | +
|
| 87 | + fetch_access_keys_service = { |
| 88 | + api_key = "NRAK-XXXXXXXXXXXXXXXX" |
| 89 | + key_id = "DWEGHFF327532576931786356532327538273" |
| 90 | + key_type = "INGEST" |
| 91 | + } |
| 92 | +} |
| 93 | +
|
| 94 | +output "required_attributes" { |
| 95 | + value = module.fetch_access_keys.required_attributes |
| 96 | +} |
| 97 | +``` |
0 commit comments