diff --git a/README.md b/README.md index 2e5cc15..7827e7c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This project was initiated by Mulesoft's consultants and architects from the pro This provider uses the anypoint platform APIs to perform actions for each one of the implemented resources. -![alt text](resources/imgs/provider-arch.png) +![alt text](drive/imgs/provider-arch.png) We use the **anypoint client library** as an abstraction layer to perform actions on the platform. @@ -16,7 +16,7 @@ For better maintainability and in order to speed up the development process, the The following image describes the delivery cycle: -![alt text](resources/imgs/provider-deliver.png) +![alt text](drive/imgs/provider-deliver.png) The cycle is composed of 3 steps: @@ -24,7 +24,7 @@ The cycle is composed of 3 steps: 2. Create the OAS3 specification. The specification should at least contain GET, POST and DELETE operations. The specification should be contributed [here](https://github.com/mulesoft-consulting/anypoint-automation-client-generator). Using the OAS spec, a go module will be generated and pushed [here](https://github.com/mulesoft-consulting/anypoint-client-go). - ![alt text](resources/imgs/provider-cycle.png) + ![alt text](drive/imgs/provider-cycle.png) 3. Implement the resource and related data sources in the provider using the generated library. ## How to use diff --git a/anypoint/util.go b/anypoint/util.go index ae44281..d7e8516 100644 --- a/anypoint/util.go +++ b/anypoint/util.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -const COMPOSITE_ID_SEPARATOR = "_" +const COMPOSITE_ID_SEPARATOR = "/" func IsString(v interface{}) bool { return reflect.TypeOf(v) == reflect.TypeOf("") diff --git a/docs/data-sources/ame.md b/docs/data-sources/ame.md new file mode 100644 index 0000000..71574c7 --- /dev/null +++ b/docs/data-sources/ame.md @@ -0,0 +1,66 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_ame Data Source - terraform-provider-anypoint" +subcategory: "" +description: |- + Reads all `Anypoint MQs` in your environment's region. +--- + +# anypoint_ame (Data Source) + +Reads all `Anypoint MQs` in your environment's region. + +## Example Usage + +```terraform +data "anypoint_ame" "ame_list" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + + params { + offset = 2 + limit = 10 + } +} +``` + + +## Schema + +### Required + +- `env_id` (String) The environment id where the Anypoint MQ Exchange is defined. +- `org_id` (String) The organization id where the Anypoint MQ Exchange is defined. +- `region_id` (String) The region id where the Anypoint MQ Exchange is defined. Refer to Anypoint Platform official documentation for the list of available regions + +### Optional + +- `params` (Block Set, Max: 1) The search parameters. Should only provide one occurrence of the block. (see [below for nested schema](#nestedblock--params)) + +### Read-Only + +- `exchanges` (List of Object) List of exchanges defined in the given region (see [below for nested schema](#nestedatt--exchanges)) +- `id` (String) The ID of this resource. + + +### Nested Schema for `params` + +Optional: + +- `destination_ids` (List of String) Includes only results with the given Ids. +- `limit` (Number) Limit the number of elements in the response. +- `offset` (Number) Skip over a number of elements by specifying an offset value for the query. +- `starts_with` (String) Searchs the field from the left using the passed string. + + + +### Nested Schema for `exchanges` + +Read-Only: + +- `encrypted` (Boolean) +- `exchange_id` (String) +- `type` (String) + + diff --git a/docs/data-sources/amq.md b/docs/data-sources/amq.md new file mode 100644 index 0000000..b42cd98 --- /dev/null +++ b/docs/data-sources/amq.md @@ -0,0 +1,72 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_amq Data Source - terraform-provider-anypoint" +subcategory: "" +description: |- + Reads all `Anypoint MQs` in your environment's region. +--- + +# anypoint_amq (Data Source) + +Reads all `Anypoint MQs` in your environment's region. + +## Example Usage + +```terraform +data "anypoint_amq" "amq_list" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + + params { + offset = 2 + limit = 10 + } +} +``` + + +## Schema + +### Required + +- `env_id` (String) The environment id where the Anypoint MQ is defined. +- `org_id` (String) The organization id where the Anypoint MQ is defined. +- `region_id` (String) The region id where the Anypoint MQ is defined. Refer to Anypoint Platform official documentation for the list of available regions + +### Optional + +- `params` (Block Set, Max: 1) The search parameters. Should only provide one occurrence of the block. (see [below for nested schema](#nestedblock--params)) + +### Read-Only + +- `id` (String) The ID of this resource. +- `queues` (List of Object) List of queues defined in the given region (see [below for nested schema](#nestedatt--queues)) + + +### Nested Schema for `params` + +Optional: + +- `destination_ids` (List of String) Includes only results with the given Ids. +- `limit` (Number) Limit the number of elements in the response. +- `offset` (Number) Skip over a number of elements by specifying an offset value for the query. +- `starts_with` (String) Searchs the field from the left using the passed string. + + + +### Nested Schema for `queues` + +Read-Only: + +- `dead_letter_queue_id` (String) +- `default_delivery_delay` (Number) +- `default_lock_ttl` (Number) +- `default_ttl` (Number) +- `encrypted` (Boolean) +- `fifo` (Boolean) +- `max_deliveries` (Number) +- `queue_id` (String) +- `type` (String) + + diff --git a/docs/data-sources/connected_app.md b/docs/data-sources/connected_app.md new file mode 100644 index 0000000..7297e15 --- /dev/null +++ b/docs/data-sources/connected_app.md @@ -0,0 +1,58 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_connected_app Data Source - terraform-provider-anypoint" +subcategory: "" +description: |- + Reads all `connected apps` in your organization. +--- + +# anypoint_connected_app (Data Source) + +Reads all `connected apps` in your organization. + +## Example Usage + +```terraform +data "anypoint_connected_app" "my_read_conn_app" { + id = "7d72415f862044199be3b739848e6adb" # existing Connected App client id +} +``` + + +## Schema + +### Required + +- `id` (String) The unique id of this connected app generated by the anypoint platform. + +### Read-Only + +- `audience` (String) Who can use this application +- `cert_expiry` (String) +- `client_uri` (String) Users can visit this URL to learn more about your app. Required for "on behalf of user" + connected apps +- `enabled` (Boolean) True if the connected app is enabled +- `grant_types` (List of String) List of grant types. For "on its own behalf" connected apps the only allowed value is "client_credentials". + The allowed values for "on behalf of user" connected apps are: "authorization_code", "refresh_token", + "password", and "urn:ietf:params:oauth:grant-type:jwt-bearer". +- `name` (String) The name of the connected app. +- `organization_id` (String) The organization id where the connected app's owner is defined. +- `policy_uri` (String) +- `public_keys` (List of String) Application public key (PEM format). Used to validate JWT authorization grants. + Required when grant type jwt-bearer is selected. +- `redirect_uris` (List of String) Configure which URIs users may be directed to after authorization +- `scope` (List of Object) The scopes this connected app has authorization to work on (see [below for nested schema](#nestedatt--scope)) +- `secret` (String, Sensitive) The secret of the connected app. +- `tos_uri` (String) +- `user_id` (String) The id of the user who owns the connected app + + +### Nested Schema for `scope` + +Read-Only: + +- `env_id` (String) +- `org_id` (String) +- `scope` (String) + + diff --git a/docs/data-sources/env.md b/docs/data-sources/env.md index f4ef209..b0fde5e 100644 --- a/docs/data-sources/env.md +++ b/docs/data-sources/env.md @@ -32,7 +32,6 @@ data "anypoint_env" "env" { - `client_id` (String) - `is_production` (Boolean) True if the environment is a production environment - `name` (String) The name of the environment -- `organization_id` (String) The organization id where the environment is defined. - `type` (String) The type of the environment: sandbox or production diff --git a/docs/resources/ame.md b/docs/resources/ame.md new file mode 100644 index 0000000..2c52472 --- /dev/null +++ b/docs/resources/ame.md @@ -0,0 +1,57 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_ame Resource - terraform-provider-anypoint" +subcategory: "" +description: |- + Creates an `Anypoint MQ Exchange` in your `region`. +--- + +# anypoint_ame (Resource) + +Creates an `Anypoint MQ Exchange` in your `region`. + +## Example Usage + +```terraform +resource "anypoint_ame" "ame" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + exchange_id = "myExchangeId" + encrypted = true +} +``` + + +## Schema + +### Required + +- `env_id` (String) The environment id where the Anypoint MQ Exchange is defined. +- `exchange_id` (String) The unique id of this Anypoint MQ Exchange. +- `org_id` (String) The organization id where the Anypoint MQ Exchange is defined. +- `region_id` (String) The region id where the Anypoint MQ Exchange is defined. Refer to Anypoint Platform official documentation for the list of available regions + +### Optional + +- `encrypted` (Boolean) Whether to encrypt the Exchange or not. +- `last_updated` (String) The last time this resource has been updated locally. + +### Read-Only + +- `id` (String) The unique id of this Anypoint MQ Exchange generated by the provider composed of {orgId}_{envId}_{regionId}_{queueId}. +- `type` (String) The type of the Anypoint MQ Exchange. + +## Import + +Import is supported using the following syntax: + +```shell +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{EXCHANGE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variables file + anypoint_ame.ame \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/myAwesomeExchange #resource ID +``` diff --git a/docs/resources/ame_binding.md b/docs/resources/ame_binding.md new file mode 100644 index 0000000..7794bab --- /dev/null +++ b/docs/resources/ame_binding.md @@ -0,0 +1,259 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_ame_binding Resource - terraform-provider-anypoint" +subcategory: "" +description: |- + Creates an `Anypoint MQ Exchange Binding` in your `region`. +--- + +# anypoint_ame_binding (Resource) + +Creates an `Anypoint MQ Exchange Binding` in your `region`. + +## Example Usage + +```terraform +resource "anypoint_amq" "amq_01" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_amq" "amq_02" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_amq" "amq_03" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_ame" "ame" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + exchange_id = "myExchangeId" + encrypted = true +} + + +resource "anypoint_ame_binding" "ame_b_01" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_01.queue_id + + rule_str_compare { + property_name = "my_property_name" + property_type = "STRING" + matcher_type = "EQ" + value = "full" + } +} + +resource "anypoint_ame_binding" "ame_b_02" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_02.queue_id + + rule_str_state { + property_name = "TO_ROUTE" + property_type = "STRING" + matcher_type = "EXISTS" + value = true + } +} + +resource "anypoint_ame_binding" "ame_b_03" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_03.queue_id + + rule_str_set { + property_name = "horse_name" + property_type = "STRING" + matcher_type = "ANY_OF" + value = tolist(["sugar", "cash", "magic"]) + } + +} + +resource "anypoint_ame_binding" "ame_b_04" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_04.queue_id + + rule_num_compare { + property_name = "nbr_horses" + property_type = "NUMERIC" + matcher_type = "GT" + value = 12 + } + +} + +resource "anypoint_ame_binding" "ame_b_05" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_05.queue_id + + rule_num_state { + property_name = "to_ship" + property_type = "NUMERIC" + matcher_type = "EXISTS" + value = true + } +} + + +resource "anypoint_ame_binding" "ame_b_06" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_06.queue_id + + rule_num_set { + property_name = "nbr_horses" + property_type = "NUMERIC" + matcher_type = "RANGE" + value = tolist([2,10]) + } +} +``` + + +## Schema + +### Required + +- `env_id` (String) The environment id where the Anypoint MQ Exchange is defined. +- `exchange_id` (String) The unique id of this Anypoint MQ Exchange. +- `org_id` (String) The organization id where the Anypoint MQ Exchange is defined. +- `queue_id` (String) The unique id of this Anypoint MQ Queue. +- `region_id` (String) The region id where the Anypoint MQ Exchange is defined. Refer to Anypoint Platform official documentation for the list of available regions + +### Optional + +- `last_updated` (String) The last time this resource has been updated locally. +- `rule_num_compare` (Block Set, Max: 1) This rule is to be used when your source attribute is a NUMERIC and you want to compare is to another NUMERIC value (see [below for nested schema](#nestedblock--rule_num_compare)) +- `rule_num_set` (Block Set, Max: 1) This rule is to be used when your source attribute is a NUMERIC and you want to check of the property is included or excluded from a set of NUMERIC values (see [below for nested schema](#nestedblock--rule_num_set)) +- `rule_num_state` (Block Set, Max: 1) This rule is to be used when your source attribute is a NUMERIC and you want to check the property's existence (see [below for nested schema](#nestedblock--rule_num_state)) +- `rule_str_compare` (Block Set, Max: 1) This rule is to be used when your source attribute is a STRING and you want to use EQUAL or PREFIX comparisons (see [below for nested schema](#nestedblock--rule_str_compare)) +- `rule_str_set` (Block Set, Max: 1) This rule is to be used when your source attribute is a STRING and you want to check of the property is included or excluded from a set of STRING values (see [below for nested schema](#nestedblock--rule_str_set)) +- `rule_str_state` (Block Set, Max: 1) This rule is to be used when your source attribute is a STRING and you want to check the property's existence (see [below for nested schema](#nestedblock--rule_str_state)) + +### Read-Only + +- `id` (String) The unique id of this Anypoint MQ Exchange generated by the provider composed of {orgId}_{envId}_{regionId}_{queueId}. + + +### Nested Schema for `rule_num_compare` + +Required: + +- `matcher_type` (String) The operation to perform on the property. + Only 'EQ' (equal), 'LT'(less than), 'LE' (less or equal), 'GT' (greater than) and 'GE' (greater or equal) + values are supported for this specific rule. +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only NUMERIC is supported for this specific rule. +- `value` (Number) The value against which the operation will be performed. + + + +### Nested Schema for `rule_num_set` + +Required: + +- `matcher_type` (String) The operation to perform on the property. Only 'RANGE' and 'NONE_OF' values are supported for this specific rule +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only NUMERIC is supported for this specific rule. +- `value` (List of Number) The value against which the operation will be performed. + + + +### Nested Schema for `rule_num_state` + +Required: + +- `matcher_type` (String) The operation to perform on the property. Only 'EXISTS' value is supported for this specific rule +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only NUMERIC is supported for this specific rule. +- `value` (Boolean) The value against which the operation will be performed. + + + +### Nested Schema for `rule_str_compare` + +Required: + +- `matcher_type` (String) The operation to perform on the property. Only 'EQ' (equal) and 'PREFIX' values are supported for this specific rule +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only STRING is supported for this specific rule. +- `value` (String) The value against which the operation will be performed. + + + +### Nested Schema for `rule_str_set` + +Required: + +- `matcher_type` (String) The operation to perform on the property. Only 'ANY_OF' and 'NONE_OF' values are supported for this specific rule +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only STRING is supported for this specific rule. +- `value` (List of String) The value against which the operation will be performed. + + + +### Nested Schema for `rule_str_state` + +Required: + +- `matcher_type` (String) The operation to perform on the property. Only 'EXISTS' value is supported for this specific rule +- `property_name` (String) The property name subject of the rule +- `property_type` (String) The propety type. Only STRING is supported for this specific rule. +- `value` (Boolean) The value against which the operation will be performed. + +## Import + +Import is supported using the following syntax: + +```shell +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{EXCHANGE_ID}/{QUEUE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variable file + anypoint_ame_binding.ame_b \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/MY-AWESOME-EXCHANGE #resource id +``` diff --git a/docs/resources/amq.md b/docs/resources/amq.md new file mode 100644 index 0000000..c9cd5db --- /dev/null +++ b/docs/resources/amq.md @@ -0,0 +1,67 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_amq Resource - terraform-provider-anypoint" +subcategory: "" +description: |- + Creates an `Anypoint MQ` in your `region`. +--- + +# anypoint_amq (Resource) + +Creates an `Anypoint MQ` in your `region`. + +## Example Usage + +```terraform +resource "anypoint_amq" "amq" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "YOUR_QUEUE_ID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "MY_EMPTY_DLQ" + max_deliveries = 10 +} +``` + + +## Schema + +### Required + +- `env_id` (String) The environment id where the Anypoint MQ is defined. +- `org_id` (String) The organization id where the Anypoint MQ is defined. +- `queue_id` (String) The unique id of this Anypoint MQ. +- `region_id` (String) The region id where the Anypoint MQ is defined. Refer to Anypoint Platform official documentation for the list of available regions + +### Optional + +- `dead_letter_queue_id` (String) The queue Id of the dead letter queue to bind to this queue. A FIFO DLQ only works with FIFO queues. +- `default_delivery_delay` (Number) The default delivery delay in seconds. +- `default_lock_ttl` (Number) The default time to live of the created locks in milliseconds. +- `default_ttl` (Number) The default TTL applied to messages in milliseconds. +- `encrypted` (Boolean) To encrypt the queue. +- `fifo` (Boolean) Whether to make this queue a FIFO. +- `last_updated` (String) The last time this resource has been updated locally. +- `max_deliveries` (Number) The maximum number of attempts after which the message will be routed to DLQ. This field can only be used when dead_letter_queue_id attribute is present. + +### Read-Only + +- `id` (String) The unique id of this Anypoint MQ generated by the provider composed of {orgId}_{envId}_{regionId}_{queueId}. +- `type` (String) The type is always queue. + +## Import + +Import is supported using the following syntax: + +```shell +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{QUEUE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variables file + anypoint_amq.amq \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/myAwesomeQ #resource ID +``` diff --git a/docs/resources/connected_app.md b/docs/resources/connected_app.md new file mode 100644 index 0000000..9c22109 --- /dev/null +++ b/docs/resources/connected_app.md @@ -0,0 +1,119 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "anypoint_connected_app Resource - terraform-provider-anypoint" +subcategory: "" +description: |- + Creates a `connected app`. +--- + +# anypoint_connected_app (Resource) + +Creates a `connected app`. + +## Example Usage + +```terraform +resource "anypoint_connected_app" "my_conn_app_its_own_behalf" { + name = "its own behalf" + grant_types = ["client_credentials"] + audience = "internal" + + scope { + scope = "profile" + } + + scope { + scope = "aeh_admin" + org_id = var.org_id + } + + scope { + scope = "read:audit_logs" + org_id = var.org_id + } + + scope { + scope = "view:environment" + org_id = var.org_id + env_id = var.env_id + } + + scope { + scope = "edit:environment" + org_id = var.org_id + env_id = var.env_id + } +} + +resource "anypoint_connected_app" "my_conn_app_behalf_of_user" { + name = "behalf of user" + grant_types = [ + "authorization_code", + "refresh_token", + "password", + "urn:ietf:params:oauth:grant-type:jwt-bearer" + ] + + audience = "everyone" + client_uri = "https://mysite.com" + redirect_uris = [ + "https://myothersitei.com" + ] + public_keys = [ + "some_public_key" + ] + + scope { + scope = "full" + } + + scope { + scope = "read:full" + } +} +``` + + +## Schema + +### Required + +- `audience` (String) Who can use this application +- `grant_types` (List of String) List of grant types. For "on its own behalf" connected apps the only allowed value is "client_credentials". + The allowed values for "on behalf of user" connected apps are: "authorization_code", "refresh_token", + "password", and "urn:ietf:params:oauth:grant-type:jwt-bearer". +- `name` (String) The name of the connected app. + +### Optional + +- `client_uri` (String) Users can visit this URL to learn more about your app. Required for "on behalf of user" + connected apps +- `enabled` (Boolean) True if the connected app is enabled +- `public_keys` (List of String) Application public key (PEM format). Used to validate JWT authorization grants. + Required when grant type jwt-bearer is selected. +- `redirect_uris` (List of String) Configure which URIs users may be directed to after authorization +- `scope` (Block List) The scopes this connected app has authorization to work on (see [below for nested schema](#nestedblock--scope)) +- `secret` (String, Sensitive) The secret of the connected app. + +### Read-Only + +- `cert_expiry` (String) +- `id` (String) The unique id of this connected app generated by the anypoint platform. +- `organization_id` (String) The organization id where the connected app's owner is defined. +- `policy_uri` (String) +- `tos_uri` (String) +- `user_id` (String) The id of the user who owns the connected app + + +### Nested Schema for `scope` + +Required: + +- `scope` (String) Scope + +Optional: + +- `env_id` (String) The id of the environment the scope is valid. Only required for particular scopes +- `org_id` (String) The id of the business group the scope is valid. Only required for particular scopes + + diff --git a/docs/resources/env.md b/docs/resources/env.md index 37224f0..6026d3c 100644 --- a/docs/resources/env.md +++ b/docs/resources/env.md @@ -31,13 +31,12 @@ resource "anypoint_env" "env" { ### Optional -- `client_id` (String) - `last_updated` (String) The last time this resource has been updated locally. ### Read-Only +- `client_id` (String) The environment client id - `id` (String) The unique id of this environment generated by the anypoint platform. - `is_production` (Boolean) True if the environment is a production environment -- `organization_id` (String) The organization id where the environment is defined. diff --git a/docs/resources/vpc.md b/docs/resources/vpc.md index c92270c..9c4c004 100644 --- a/docs/resources/vpc.md +++ b/docs/resources/vpc.md @@ -67,11 +67,11 @@ resource "anypoint_vpc" "avpc" { - `last_updated` (String) The last time this resource has been updated locally. - `owner_id` (String) The id of the organization that owns the vpc. - `shared_with` (List of String) A list of Business Groups to share this vpc with -- `vpc_routes` (Block List) The network routes of this vpc. (see [below for nested schema](#nestedblock--vpc_routes)) ### Read-Only - `id` (String) The unique id of this vpc generated by the anypoint platform. +- `vpc_routes` (List of Object) The network routes of this vpc. (see [below for nested schema](#nestedatt--vpc_routes)) ### Nested Schema for `firewall_rules` @@ -84,10 +84,10 @@ Required: - `to_port` (Number) - + ### Nested Schema for `vpc_routes` -Required: +Read-Only: - `cidr` (String) - `next_hop` (String) diff --git a/resources/imgs/provider-arch.png b/drive/imgs/provider-arch.png similarity index 100% rename from resources/imgs/provider-arch.png rename to drive/imgs/provider-arch.png diff --git a/resources/imgs/provider-cycle.png b/drive/imgs/provider-cycle.png similarity index 100% rename from resources/imgs/provider-cycle.png rename to drive/imgs/provider-cycle.png diff --git a/resources/imgs/provider-deliver.png b/drive/imgs/provider-deliver.png similarity index 100% rename from resources/imgs/provider-deliver.png rename to drive/imgs/provider-deliver.png diff --git a/examples/data-sources/anypoint_ame/data-source.tf b/examples/data-sources/anypoint_ame/data-source.tf new file mode 100644 index 0000000..a850e70 --- /dev/null +++ b/examples/data-sources/anypoint_ame/data-source.tf @@ -0,0 +1,10 @@ +data "anypoint_ame" "ame_list" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + + params { + offset = 2 + limit = 10 + } +} \ No newline at end of file diff --git a/examples/data-sources/anypoint_amq/data-source.tf b/examples/data-sources/anypoint_amq/data-source.tf new file mode 100644 index 0000000..bd18a1d --- /dev/null +++ b/examples/data-sources/anypoint_amq/data-source.tf @@ -0,0 +1,10 @@ +data "anypoint_amq" "amq_list" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + + params { + offset = 2 + limit = 10 + } +} \ No newline at end of file diff --git a/examples/resources/anypoint_ame/import.sh b/examples/resources/anypoint_ame/import.sh new file mode 100644 index 0000000..0126360 --- /dev/null +++ b/examples/resources/anypoint_ame/import.sh @@ -0,0 +1,7 @@ +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{EXCHANGE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variables file + anypoint_ame.ame \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/myAwesomeExchange #resource ID diff --git a/examples/resources/anypoint_ame/resource.tf b/examples/resources/anypoint_ame/resource.tf new file mode 100644 index 0000000..d259c27 --- /dev/null +++ b/examples/resources/anypoint_ame/resource.tf @@ -0,0 +1,7 @@ +resource "anypoint_ame" "ame" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + exchange_id = "myExchangeId" + encrypted = true +} diff --git a/examples/resources/anypoint_ame/test.auto.tfvars b/examples/resources/anypoint_ame/test.auto.tfvars new file mode 100644 index 0000000..ff92193 --- /dev/null +++ b/examples/resources/anypoint_ame/test.auto.tfvars @@ -0,0 +1,2 @@ +root_org = "aa1f55d6-213d-4f60-845c-207286484cd1" +env_id = "18f23771-c78a-4be2-af8f-1bae66f43942" diff --git a/examples/resources/anypoint_ame/test.tf b/examples/resources/anypoint_ame/test.tf new file mode 100644 index 0000000..64c2a44 --- /dev/null +++ b/examples/resources/anypoint_ame/test.tf @@ -0,0 +1,7 @@ +variable "root_org" { + default = "xx1f55d6-213d-4f60-845c-207286484cd1" +} + +variable "env_id" { + default = "18f23771-c78a-4be2-af8f-1bae66f43942" +} \ No newline at end of file diff --git a/examples/resources/anypoint_ame_binding/import.sh b/examples/resources/anypoint_ame_binding/import.sh new file mode 100644 index 0000000..a8d0caa --- /dev/null +++ b/examples/resources/anypoint_ame_binding/import.sh @@ -0,0 +1,7 @@ +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{EXCHANGE_ID}/{QUEUE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variable file + anypoint_ame_binding.ame_b \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/MY-AWESOME-EXCHANGE #resource id diff --git a/examples/resources/anypoint_ame_binding/resource.tf b/examples/resources/anypoint_ame_binding/resource.tf new file mode 100644 index 0000000..adba797 --- /dev/null +++ b/examples/resources/anypoint_ame_binding/resource.tf @@ -0,0 +1,137 @@ +resource "anypoint_amq" "amq_01" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_amq" "amq_02" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_amq" "amq_03" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "yourQueueID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "myEmptyDLQ" + max_deliveries = 10 +} + +resource "anypoint_ame" "ame" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + exchange_id = "myExchangeId" + encrypted = true +} + + +resource "anypoint_ame_binding" "ame_b_01" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_01.queue_id + + rule_str_compare { + property_name = "my_property_name" + property_type = "STRING" + matcher_type = "EQ" + value = "full" + } +} + +resource "anypoint_ame_binding" "ame_b_02" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_02.queue_id + + rule_str_state { + property_name = "TO_ROUTE" + property_type = "STRING" + matcher_type = "EXISTS" + value = true + } +} + +resource "anypoint_ame_binding" "ame_b_03" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_03.queue_id + + rule_str_set { + property_name = "horse_name" + property_type = "STRING" + matcher_type = "ANY_OF" + value = tolist(["sugar", "cash", "magic"]) + } + +} + +resource "anypoint_ame_binding" "ame_b_04" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_04.queue_id + + rule_num_compare { + property_name = "nbr_horses" + property_type = "NUMERIC" + matcher_type = "GT" + value = 12 + } + +} + +resource "anypoint_ame_binding" "ame_b_05" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_05.queue_id + + rule_num_state { + property_name = "to_ship" + property_type = "NUMERIC" + matcher_type = "EXISTS" + value = true + } +} + + +resource "anypoint_ame_binding" "ame_b_06" { + org_id = var.root_org + env_id = anypoint_amq.ame.env_id + region_id = anypoint_amq.ame.region_id + exchange_id = anypoint_ame.ame.exchange_id + queue_id = anypoint_amq.amq_06.queue_id + + rule_num_set { + property_name = "nbr_horses" + property_type = "NUMERIC" + matcher_type = "RANGE" + value = tolist([2,10]) + } +} \ No newline at end of file diff --git a/examples/resources/anypoint_ame_binding/test.auto.tfvars b/examples/resources/anypoint_ame_binding/test.auto.tfvars new file mode 100644 index 0000000..ff92193 --- /dev/null +++ b/examples/resources/anypoint_ame_binding/test.auto.tfvars @@ -0,0 +1,2 @@ +root_org = "aa1f55d6-213d-4f60-845c-207286484cd1" +env_id = "18f23771-c78a-4be2-af8f-1bae66f43942" diff --git a/examples/resources/anypoint_ame_binding/test.tf b/examples/resources/anypoint_ame_binding/test.tf new file mode 100644 index 0000000..64c2a44 --- /dev/null +++ b/examples/resources/anypoint_ame_binding/test.tf @@ -0,0 +1,7 @@ +variable "root_org" { + default = "xx1f55d6-213d-4f60-845c-207286484cd1" +} + +variable "env_id" { + default = "18f23771-c78a-4be2-af8f-1bae66f43942" +} \ No newline at end of file diff --git a/examples/resources/anypoint_amq/import.sh b/examples/resources/anypoint_amq/import.sh new file mode 100644 index 0000000..d1ecfa6 --- /dev/null +++ b/examples/resources/anypoint_amq/import.sh @@ -0,0 +1,7 @@ +# In order for the import to work, you should provide a ID composed of the following: +# {ORG_ID}/{ENV_ID}/{REGION_ID}/{QUEUE_ID} + +terraform import \ + -var-file params.tfvars.json \ #variables file + anypoint_amq.amq \ #resource name + aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/myAwesomeQ #resource ID diff --git a/examples/resources/anypoint_amq/resource.tf b/examples/resources/anypoint_amq/resource.tf new file mode 100644 index 0000000..c70d661 --- /dev/null +++ b/examples/resources/anypoint_amq/resource.tf @@ -0,0 +1,11 @@ +resource "anypoint_amq" "amq" { + org_id = var.root_org + env_id = var.env_id + region_id = "us-east-1" + queue_id = "YOUR_QUEUE_ID" + fifo = false + default_ttl = 604800000 + default_lock_ttl = 120000 + dead_letter_queue_id = "MY_EMPTY_DLQ" + max_deliveries = 10 +} \ No newline at end of file diff --git a/examples/resources/anypoint_amq/test.auto.tfvars b/examples/resources/anypoint_amq/test.auto.tfvars new file mode 100644 index 0000000..ff92193 --- /dev/null +++ b/examples/resources/anypoint_amq/test.auto.tfvars @@ -0,0 +1,2 @@ +root_org = "aa1f55d6-213d-4f60-845c-207286484cd1" +env_id = "18f23771-c78a-4be2-af8f-1bae66f43942" diff --git a/examples/resources/anypoint_amq/test.tf b/examples/resources/anypoint_amq/test.tf new file mode 100644 index 0000000..64c2a44 --- /dev/null +++ b/examples/resources/anypoint_amq/test.tf @@ -0,0 +1,7 @@ +variable "root_org" { + default = "xx1f55d6-213d-4f60-845c-207286484cd1" +} + +variable "env_id" { + default = "18f23771-c78a-4be2-af8f-1bae66f43942" +} \ No newline at end of file