Skip to content

Commit

Permalink
feat: latest provider with presets
Browse files Browse the repository at this point in the history
  • Loading branch information
benbuchanan committed Nov 2, 2022
1 parent a19be28 commit d733ad3
Show file tree
Hide file tree
Showing 2,764 changed files with 414,798 additions and 108,410 deletions.
1,424 changes: 1,422 additions & 2 deletions CHANGELOG.md

Large diffs are not rendered by default.

360 changes: 360 additions & 0 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Maintainers
===========

**Active Maintainers**

| Name | GitHub | email
|------|--------|------|
| Ashish Thakur | [ashishth09][ashishth09] | <[email protected]>
| Harini | [hkantare][hkantare] | <[email protected]>
| Kavya Handadi | [kavya498][kavya498] | <[email protected]>
| Vijay R Kalangumvathakkal | [vkalangu][vkalangu] | <[email protected]>


**Documentation Maintainers**

| Name | GitHub | email
|------|--------|----------------------
| Geetha Sathyamurthy | [geethasathyamurthy][geethasathyamurthy] | <[email protected]>


**Retired Maintainers**

| Name | GitHub | email
|------|--------|----------------------
| Anilkumar Mallakkanavar | [Anil-CM][Anil-CM] | <[email protected]>
| Praveen Gostu | [Praveengostu][Praveengostu] | <[email protected]>
| Sakshi Agarwal | [sakshiag][sakshiag] | <[email protected]>


[ashishth09]: https://github.com/ashishth09
[kavya498]: https://github.com/kavya498
[hkantare]: https://github.com/hkantare
[vkalangu]: https://github.com/vkalangu/
[geethasathyamurthy]: https://github.com/geethasathyamurthy
[Anil-CM]: https://github.com/Anil-CM
[Praveengostu]: https://github.com/Praveengostu
[sakshiag]: https://github.com/sakshiag
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/IBM-Cloud/terraform-provider-ibm)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/IBM-Cloud/terraform-provider-ibm?include_prereleases)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/IBM-Cloud/terraform-provider-ibm/release)
![GitHub](https://img.shields.io/github/license/IBM-Cloud/terraform-provider-ibm)<br />
![GitHub contributors](https://img.shields.io/github/contributors/IBM-Cloud/terraform-provider-ibm?color=blueviolet)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/IBM-Cloud/terraform-provider-ibm?color=blueviolet)
![GitHub all releases](https://img.shields.io/github/downloads/IBM-Cloud/terraform-provider-ibm/total)
[![GitHub stars](https://img.shields.io/github/stars/IBM-Cloud/terraform-provider-ibm?color=yellow)](https://github.com/IBM-Cloud/terraform-provider-ibm/stargazers)

# Terraform Provider

- Website: https://www.terraform.io
Expand All @@ -7,7 +16,7 @@
## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.10.1+
- [Go](https://golang.org/doc/install) 1.16 (to build the provider plugin)
- [Go](https://golang.org/doc/install) 1.18 (to build the provider plugin)

## Building The Provider

Expand Down
37 changes: 19 additions & 18 deletions examples/ibm-api-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ This example illustrates how to use the API Gateway Endpoint and Subscription re

These types of resources are supported:

* [API Gateway Endpoint](https://cloud.ibm.com/docs/terraform?topic=terraform-api-gateway-resources#api-gw-endpoint)
* [API Gateway Endpoint Subscription](https://cloud.ibm.com/docs/terraform?topic=terraform-api-gateway-resources#api-gw-endpoint-subscript)
* [API Gateway Endpoint](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/api_gateway_endpoint)
* [API Gateway Endpoint Subscription](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/api_gateway_endpoint_subscription)

## Terraform versions

Terraform 0.12. Pin module version to `~> v1.4.0`. Branch - `master`.
| Name | Version |
|------|---------|
| terraform | >=1.0.0, <2.0 |

Terraform 0.11. Pin module version to `~> v0.25.0`. Branch - `terraform_v0.11.x`.

## Usage

Expand All @@ -30,7 +31,7 @@ Run `terraform destroy` when you don't need these resources.

API Gateway Endpoint resource with single OpenAPI document:

```hcl
```terraform
resource "ibm_api_gateway_endpoint" "endpoint" {
service_instance_crn = ibm_resource_instance.apigateway.id
name = "test-endpoint"
Expand All @@ -40,7 +41,7 @@ resource "ibm_api_gateway_endpoint" "endpoint" {
}
```
API Gateway Endpoint resource with directory of OpenAPI documents:
```hcl
```terraform
resource "ibm_api_gateway_endpoint" "endpoint" {
for_each = fileset(var.dir_path, "*.json")
service_instance_crn = ibm_resource_instance.apigateway.id
Expand All @@ -51,7 +52,7 @@ resource "ibm_api_gateway_endpoint" "endpoint" {
}
```
API Gateway Endpoint Subscription Resource:
```hcl
```terraform
resource "ibm_api_gateway_endpoint_subscription" "subs" {
artifact_id = data.ibm_api_gateway.endpoint.endpoints[0].endpoint_id
client_id = "testapikey"
Expand All @@ -64,21 +65,21 @@ resource "ibm_api_gateway_endpoint_subscription" "subs" {
## API Gateway Data Source
Lists all endpoints and its subscriptions of an API Gateway Instance.

```hcl
```terraform
data "ibm_api_gateway" "endpoint"{
service_instance_crn =ibm_resource_instance.apigateway.id
}
```

## Assumptions

1. It's recommended to use subscription resource by making the endpoint online. i.e manged attribute of endpoint resource should be true.
1. It's recommended to use subscription resource by making the endpoint online. i.e managed attribute of endpoint resource should be `true`.
2. To view the subscriptions it is required to enable any of the two options of `Application authentication via API key` under `Define and Secure` page and save the endpoint in API Gateway service page.
3. The `client ID` of a particular subscription is available as an `API key` in the `Manage and Sharing` page of an endpoint of the API Gateway service.

## Notes

1. Terraform IBM provider v1.4.0 (via Terraform 0.12) supports "Autogeneration of Client ID i.e API key and Client Secret for the endpoint subscription".
1. Terraform IBM provider supports "Autogeneration of Client ID i.e API key and Client Secret for the endpoint subscription".

## Examples

Expand All @@ -89,31 +90,31 @@ data "ibm_api_gateway" "endpoint"{

| Name | Version |
|------|---------|
| terraform | ~> 0.12 |
| terraform | >=1.0.0, <2.0 |

Single OpenAPI document or directory of documents.

## Providers

| Name | Version |
|------|---------|
| ibm | n/a |
| ibm | Latest |

## Inputs

| Name | Description | Type | Required |
|------|-------------|------|---------|
| region | THe region where the resource has to be provisioned. Default: `us-south`| `string` | yes |
| service\_name | The name of the API Gateway Service Instance. | `string` | yes |
| service_name | The name of the API Gateway Service Instance. | `string` | yes |
| endpoint_name | The name of the API Gateway Endpoint resource. | `string` | yes |
| managed | Indicates whether endpoint is online or not. Default: false | `bool` | yes |
| routes | Invokable routes for an endpoint | `list` | no |
| file\_path | The API document name that represents the endpoint. It is required when a single endpoint is created| `string` | yes |
| file_path | The API document name that represents the endpoint. It is required when a single endpoint is created| `string` | yes |
| dir_path | The directory name of API documents that represents multiple endpoint. It is required when a multipple endpoints are created| `string` | no |
| action\_type | The type of action that is performed on the API endpoint. Supported values are [`share`], [`unshare`], [`manage`], and [`unmanage`].To manage API to offline and online action\_type has to be set. The default value is [`unshare`]. Note that endpoint actions are performed by using the type parameter after the endpoint is created. As a consequence, endpoint actions are invoked during an endpoint update only. | `string` | required while managing actions. |
| subscription\_name | The name of the subscription resource indicates the name for an API key. | `string` | yes |
| client\_id | The API key to generate an API key for the subscription. The generated API key represents the ID of a subscription. If not provided it is auto generated. | `string` | yes |
| subscription\_type | The type of the subscription resource indicates the type of API key sharing. Supported values are [`external`], and [`internal`]. | `string` | yes |
| action_type | The type of action that is performed on the API endpoint. Supported values are [`share`], [`unshare`], [`manage`], and [`unmanage`].To manage API to offline and online action_type has to be set. The default value is [`unshare`]. Note that endpoint actions are performed by using the type parameter after the endpoint is created. As a consequence, endpoint actions are invoked during an endpoint update only. | `string` | required while managing actions. |
| subscription_name | The name of the subscription resource indicates the name for an API key. | `string` | yes |
| client_id | The API key to generate an API key for the subscription. The generated API key represents the ID of a subscription. If not provided it is auto generated. | `string` | yes |
| subscription_type | The type of the subscription resource indicates the type of API key sharing. Supported values are [`external`], and [`internal`]. | `string` | yes |
| secret | The secret of the API key. | `string` | yes |
| generate_secret | It conflicts with secret. If `generate_secret`- `true`, secret is auto generated. | `bool` | no |

Expand Down
9 changes: 7 additions & 2 deletions examples/ibm-api-gateway/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
terraform {
required_version = ">= 0.12"
}
required_version = ">=1.0.0, <2.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
}
}
}
13 changes: 13 additions & 0 deletions examples/ibm-atracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ These types of resources are supported:

* Activity Tracker Target
* Activity Tracker Route
* Activity Tracker Settings

## Usage

Expand Down Expand Up @@ -41,6 +42,17 @@ resource "atracker_route" "atracker_route_instance" {
}
```

atracker_settings resource:

```hcl
resource "atracker_settings" "atracker_settings_instance" {
metadata_region_primary = var.atracker_settings_metadata_region_primary
private_api_endpoint_only = var.atracker_settings_private_api_endpoint_only
default_targets = var.atracker_settings_default_targets
permitted_target_regions = var.atracker_settings_permitted_target_regions
}
```

## AtrackerV1 Data sources

atracker_targets data source:
Expand Down Expand Up @@ -107,3 +119,4 @@ data "atracker_endpoints" "atracker_endpoints_instance" {
| atracker_targets | atracker_targets object |
| atracker_routes | atracker_routes object |
| atracker_endpoints | atracker_endpoints object |
| atracker_settings | atracker_settings object |
22 changes: 21 additions & 1 deletion examples/ibm-atracker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ resource "ibm_atracker_target" "atracker_target_instance" {
bucket = "my-atracker-bucket"
api_key = "xxxxxxxxxxxxxx"
}
region = var.atracker_target_region
}

// Provision atracker_target resource instance for logdna
resource "ibm_atracker_target" "atracker_target_logdna_instance" {
name = var.atracker_target_name
target_type = "logdna"
logdna_endpoint {
target_crn = "crn:v1:bluemix:public:logdna:us-south:a/11111111111111111111111111111111:22222222-2222-2222-2222-222222222222::"
ingestion_key = "xxxxxxxxxxxxxx"
}
region = var.atracker_target_region
}

// Provision atracker_route resource instance
Expand All @@ -21,6 +33,14 @@ resource "ibm_atracker_route" "atracker_route_instance" {
rules = var.atracker_route_rules
}

// Provision atracker_settings resource instance
resource "ibm_atracker_settings" "atracker_settings_instance" {
metadata_region_primary = var.atracker_settings_metadata_region_primary
private_api_endpoint_only = var.atracker_settings_private_api_endpoint_only
default_targets = var.atracker_settings_default_targets
permitted_target_regions = var.atracker_settings_permitted_target_regions
}

// Create atracker_targets data source
data "ibm_atracker_targets" "atracker_targets_instance" {
name = var.atracker_targets_name
Expand All @@ -31,6 +51,6 @@ data "ibm_atracker_routes" "atracker_routes_instance" {
name = var.atracker_routes_name
}

// Create atracker_endpoints data source
// Create atracker_endpoints data source (DEPRECATED)
data "ibm_atracker_endpoints" "atracker_endpoints_instance" {
}
7 changes: 7 additions & 0 deletions examples/ibm-atracker/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ output "ibm_atracker_route" {
value = ibm_atracker_route.atracker_route_instance
description = "atracker_route resource instance"
}

// This allows atracker_settings data to be referenced by other resources and the terraform CLI
// Modify this if only certain data should be exposed
output "ibm_atracker_settings" {
value = ibm_atracker_settings.atracker_settings_instance
description = "atracker_settings resource instance"
}
21 changes: 21 additions & 0 deletions examples/ibm-atracker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,26 @@ variable "atracker_routes_name" {
type = string
default = "my-route"
}
// Resource arguments for atracker_settings
variable "atracker_settings_metadata_region_primary" {
description = "To store all your meta data in a single region."
type = string
default = "us-south"
}
variable "atracker_settings_private_api_endpoint_only" {
description = "If you set this true then you cannot access api through public network."
type = bool
default = false
}
variable "atracker_settings_default_targets" {
description = "The target ID List. In the event that no routing rule causes the event to be sent to a target, these targets will receive the event."
type = list(string)
default = [ "c3af557f-fb0e-4476-85c3-0889e7fe7bc4" ]
}
variable "atracker_settings_permitted_target_regions" {
description = "If present then only these regions may be used to define a target."
type = list(string)
default = [ "us-south" ]
}

// Data source arguments for atracker_endpoints
Loading

0 comments on commit d733ad3

Please sign in to comment.