diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c66a31c..03bd45452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ ## 1.16.0 (Unreleased) + +* **New Data Source:** `awscc_events_connection` +* **New Resource:** `awscc_events_connection` + ## 1.15.0 (September 19, 2024) BUG FIXES: diff --git a/docs/data-sources/events_connection.md b/docs/data-sources/events_connection.md new file mode 100644 index 000000000..93e1a242e --- /dev/null +++ b/docs/data-sources/events_connection.md @@ -0,0 +1,154 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_events_connection Data Source - terraform-provider-awscc" +subcategory: "" +description: |- + Data Source schema for AWS::Events::Connection +--- + +# awscc_events_connection (Data Source) + +Data Source schema for AWS::Events::Connection + + + + +## Schema + +### Required + +- `id` (String) Uniquely identifies the resource. + +### Read-Only + +- `arn` (String) The arn of the connection resource. +- `auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters)) +- `authorization_type` (String) +- `description` (String) Description of the connection. +- `name` (String) Name of the connection. +- `secret_arn` (String) The arn of the secrets manager secret created in the customer account. + + +### Nested Schema for `auth_parameters` + +Read-Only: + +- `api_key_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--api_key_auth_parameters)) +- `basic_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--basic_auth_parameters)) +- `invocation_http_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters)) +- `o_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters)) + + +### Nested Schema for `auth_parameters.api_key_auth_parameters` + +Read-Only: + +- `api_key_name` (String) +- `api_key_value` (String) + + + +### Nested Schema for `auth_parameters.basic_auth_parameters` + +Read-Only: + +- `password` (String) +- `username` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters` + +Read-Only: + +- `body_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--body_parameters)) +- `header_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--header_parameters)) +- `query_string_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--query_string_parameters)) + + +### Nested Schema for `auth_parameters.invocation_http_parameters.body_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.header_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.query_string_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + + +### Nested Schema for `auth_parameters.o_auth_parameters` + +Read-Only: + +- `authorization_endpoint` (String) +- `client_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--client_parameters)) +- `http_method` (String) +- `o_auth_http_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters)) + + +### Nested Schema for `auth_parameters.o_auth_parameters.client_parameters` + +Read-Only: + +- `client_id` (String) +- `client_secret` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters` + +Read-Only: + +- `body_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--body_parameters)) +- `header_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--header_parameters)) +- `query_string_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--query_string_parameters)) + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.body_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.header_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.query_string_parameters` + +Read-Only: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) diff --git a/docs/resources/events_connection.md b/docs/resources/events_connection.md new file mode 100644 index 000000000..9fd4561da --- /dev/null +++ b/docs/resources/events_connection.md @@ -0,0 +1,217 @@ +--- +page_title: "awscc_events_connection Resource - terraform-provider-awscc" +subcategory: "" +description: |- + Resource Type definition for AWS::Events::Connection. +--- + +# awscc_events_connection (Resource) + +Resource Type definition for AWS::Events::Connection. + +## Example Usage + +### Create a connection with ApiKey authorization parameters + +The following example creates a connection named pagerduty-connection using ApiKey authorization and stores a secret from Secrets Manager. + +```terraform +resource "awscc_events_connection" "pagerduty_connection" { + name = "pagerduty-connection" + authorization_type = "API_KEY" + + auth_parameters = { + api_key_auth_parameters = { + api_key_name = "Authorization" + api_key_value = "my-secret-string" + } + + additional_parameters = { + body_parameters = { + routing_key = "my-pagerduty-integration-key" + } + } + } +} +``` + +### Create a connection with OAuth authorization parameters + +The following example creates a connection named auth0-connection using OAuth authorization and stores a secret from Secrets Manager. + +```terraform +resource "awscc_events_connection" "auth0_connection" { + name = "auth0-connection" + authorization_type = "OAUTH_CLIENT_CREDENTIALS" + + auth_parameters = { + o_auth_parameters = { + client_parameters = { + client_id = "my-client-id" + client_secret = "my-secret-string" + } + + authorization_endpoint = "https://yourUserName.us.auth0.com/oauth/token" + http_method = "POST" + + o_auth_http_parameters = { + body_parameters = [ + { + key = "audience", + value = "my-auth0-identifier" + } + ] + } + } + } +} +``` + + +## Schema + +### Optional + +- `auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters)) +- `authorization_type` (String) +- `description` (String) Description of the connection. +- `name` (String) Name of the connection. + +### Read-Only + +- `arn` (String) The arn of the connection resource. +- `id` (String) Uniquely identifies the resource. +- `secret_arn` (String) The arn of the secrets manager secret created in the customer account. + + +### Nested Schema for `auth_parameters` + +Optional: + +- `api_key_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--api_key_auth_parameters)) +- `basic_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--basic_auth_parameters)) +- `invocation_http_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters)) +- `o_auth_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters)) + + +### Nested Schema for `auth_parameters.api_key_auth_parameters` + +Optional: + +- `api_key_name` (String) +- `api_key_value` (String) + + + +### Nested Schema for `auth_parameters.basic_auth_parameters` + +Optional: + +- `password` (String) +- `username` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters` + +Optional: + +- `body_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--body_parameters)) +- `header_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--header_parameters)) +- `query_string_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--invocation_http_parameters--query_string_parameters)) + + +### Nested Schema for `auth_parameters.invocation_http_parameters.body_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.header_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.query_string_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + + +### Nested Schema for `auth_parameters.o_auth_parameters` + +Optional: + +- `authorization_endpoint` (String) +- `client_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--client_parameters)) +- `http_method` (String) +- `o_auth_http_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters)) + + +### Nested Schema for `auth_parameters.o_auth_parameters.client_parameters` + +Optional: + +- `client_id` (String) +- `client_secret` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters` + +Optional: + +- `body_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--body_parameters)) +- `header_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--header_parameters)) +- `query_string_parameters` (Attributes List) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--o_auth_http_parameters--query_string_parameters)) + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.body_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.header_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.query_string_parameters` + +Optional: + +- `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) + +## Import + +Import is supported using the following syntax: + +```shell +$ terraform import awscc_events_connection.example "name" +``` \ No newline at end of file diff --git a/examples/resources/awscc_events_connection/connection_with_api_key_authorizer.tf b/examples/resources/awscc_events_connection/connection_with_api_key_authorizer.tf new file mode 100644 index 000000000..4052412c8 --- /dev/null +++ b/examples/resources/awscc_events_connection/connection_with_api_key_authorizer.tf @@ -0,0 +1,17 @@ +resource "awscc_events_connection" "pagerduty_connection" { + name = "pagerduty-connection" + authorization_type = "API_KEY" + + auth_parameters = { + api_key_auth_parameters = { + api_key_name = "Authorization" + api_key_value = "my-secret-string" + } + + additional_parameters = { + body_parameters = { + routing_key = "my-pagerduty-integration-key" + } + } + } +} \ No newline at end of file diff --git a/examples/resources/awscc_events_connection/connection_with_oauth_authorizer.tf b/examples/resources/awscc_events_connection/connection_with_oauth_authorizer.tf new file mode 100644 index 000000000..996f44ce6 --- /dev/null +++ b/examples/resources/awscc_events_connection/connection_with_oauth_authorizer.tf @@ -0,0 +1,25 @@ +resource "awscc_events_connection" "auth0_connection" { + name = "auth0-connection" + authorization_type = "OAUTH_CLIENT_CREDENTIALS" + + auth_parameters = { + o_auth_parameters = { + client_parameters = { + client_id = "my-client-id" + client_secret = "my-secret-string" + } + + authorization_endpoint = "https://yourUserName.us.auth0.com/oauth/token" + http_method = "POST" + + o_auth_http_parameters = { + body_parameters = [ + { + key = "audience", + value = "my-auth0-identifier" + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/resources/awscc_events_connection/import.sh b/examples/resources/awscc_events_connection/import.sh new file mode 100644 index 000000000..925043690 --- /dev/null +++ b/examples/resources/awscc_events_connection/import.sh @@ -0,0 +1 @@ +$ terraform import awscc_events_connection.example "name" \ No newline at end of file diff --git a/internal/aws/events/connection_resource_gen.go b/internal/aws/events/connection_resource_gen.go new file mode 100644 index 000000000..9307f91b0 --- /dev/null +++ b/internal/aws/events/connection_resource_gen.go @@ -0,0 +1,864 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package events + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" + fwvalidators "github.com/hashicorp/terraform-provider-awscc/internal/validators" +) + +func init() { + registry.AddResourceFactory("awscc_events_connection", connectionResource) +} + +// connectionResource returns the Terraform awscc_events_connection resource. +// This Terraform resource corresponds to the CloudFormation AWS::Events::Connection resource. +func connectionResource(ctx context.Context) (resource.Resource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Arn + // CloudFormation resource type schema: + // + // { + // "description": "The arn of the connection resource.", + // "type": "string" + // } + "arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The arn of the connection resource.", + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: AuthParameters + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "oneOf": [ + // { + // "required": [ + // "BasicAuthParameters" + // ] + // }, + // { + // "required": [ + // "OAuthParameters" + // ] + // }, + // { + // "required": [ + // "ApiKeyAuthParameters" + // ] + // } + // ], + // "properties": { + // "ApiKeyAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "ApiKeyName": { + // "type": "string" + // }, + // "ApiKeyValue": { + // "type": "string" + // } + // }, + // "required": [ + // "ApiKeyName", + // "ApiKeyValue" + // ], + // "type": "object" + // }, + // "BasicAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "Password": { + // "type": "string" + // }, + // "Username": { + // "type": "string" + // } + // }, + // "required": [ + // "Username", + // "Password" + // ], + // "type": "object" + // }, + // "InvocationHttpParameters": { + // "additionalProperties": false, + // "properties": { + // "BodyParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "HeaderParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "QueryStringParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // } + // }, + // "type": "object" + // }, + // "OAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "AuthorizationEndpoint": { + // "maxLength": 2048, + // "minLength": 1, + // "type": "string" + // }, + // "ClientParameters": { + // "additionalProperties": false, + // "properties": { + // "ClientID": { + // "type": "string" + // }, + // "ClientSecret": { + // "type": "string" + // } + // }, + // "required": [ + // "ClientID", + // "ClientSecret" + // ], + // "type": "object" + // }, + // "HttpMethod": { + // "enum": [ + // "GET", + // "POST", + // "PUT" + // ], + // "type": "string" + // }, + // "OAuthHttpParameters": { + // "additionalProperties": false, + // "properties": { + // "BodyParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "HeaderParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "QueryStringParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // } + // }, + // "type": "object" + // } + // }, + // "required": [ + // "ClientParameters", + // "AuthorizationEndpoint", + // "HttpMethod" + // ], + // "type": "object" + // } + // }, + // "type": "object" + // } + "auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiKeyAuthParameters + "api_key_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiKeyName + "api_key_name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ApiKeyValue + "api_key_value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: BasicAuthParameters + "basic_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Password + "password": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Username + "username": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: InvocationHttpParameters + "invocation_http_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: BodyParameters + "body_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: HeaderParameters + "header_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: QueryStringParameters + "query_string_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: OAuthParameters + "o_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AuthorizationEndpoint + "authorization_endpoint": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.LengthBetween(1, 2048), + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ClientParameters + "client_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ClientID + "client_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ClientSecret + "client_secret": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + Validators: []validator.Object{ /*START VALIDATORS*/ + fwvalidators.NotNullObject(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: HttpMethod + "http_method": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.OneOf( + "GET", + "POST", + "PUT", + ), + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: OAuthHttpParameters + "o_auth_http_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: BodyParameters + "body_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: HeaderParameters + "header_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: QueryStringParameters + "query_string_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + fwvalidators.NotNullString(), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + listplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + // AuthParameters is a write-only property. + }, /*END ATTRIBUTE*/ + // Property: AuthorizationType + // CloudFormation resource type schema: + // + // { + // "enum": [ + // "API_KEY", + // "BASIC", + // "OAUTH_CLIENT_CREDENTIALS" + // ], + // "type": "string" + // } + "authorization_type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.OneOf( + "API_KEY", + "BASIC", + "OAUTH_CLIENT_CREDENTIALS", + ), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Description + // CloudFormation resource type schema: + // + // { + // "description": "Description of the connection.", + // "maxLength": 512, + // "type": "string" + // } + "description": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Description of the connection.", + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.LengthAtMost(512), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Name + // CloudFormation resource type schema: + // + // { + // "description": "Name of the connection.", + // "maxLength": 64, + // "minLength": 1, + // "type": "string" + // } + "name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Name of the connection.", + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.LengthBetween(1, 64), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplaceIfConfigured(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: SecretArn + // CloudFormation resource type schema: + // + // { + // "description": "The arn of the secrets manager secret created in the customer account.", + // "type": "string" + // } + "secret_arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The arn of the secrets manager secret created in the customer account.", + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + // Corresponds to CloudFormation primaryIdentifier. + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + } + + schema := schema.Schema{ + Description: "Resource Type definition for AWS::Events::Connection.", + Version: 1, + Attributes: attributes, + } + + var opts generic.ResourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::Events::Connection").WithTerraformTypeName("awscc_events_connection") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "api_key_auth_parameters": "ApiKeyAuthParameters", + "api_key_name": "ApiKeyName", + "api_key_value": "ApiKeyValue", + "arn": "Arn", + "auth_parameters": "AuthParameters", + "authorization_endpoint": "AuthorizationEndpoint", + "authorization_type": "AuthorizationType", + "basic_auth_parameters": "BasicAuthParameters", + "body_parameters": "BodyParameters", + "client_id": "ClientID", + "client_parameters": "ClientParameters", + "client_secret": "ClientSecret", + "description": "Description", + "header_parameters": "HeaderParameters", + "http_method": "HttpMethod", + "invocation_http_parameters": "InvocationHttpParameters", + "is_value_secret": "IsValueSecret", + "key": "Key", + "name": "Name", + "o_auth_http_parameters": "OAuthHttpParameters", + "o_auth_parameters": "OAuthParameters", + "password": "Password", + "query_string_parameters": "QueryStringParameters", + "secret_arn": "SecretArn", + "username": "Username", + "value": "Value", + }) + + opts = opts.WithWriteOnlyPropertyPaths([]string{ + "/properties/AuthParameters", + }) + opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0) + + opts = opts.WithUpdateTimeoutInMinutes(0) + + v, err := generic.NewResource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/events/connection_resource_gen_test.go b/internal/aws/events/connection_resource_gen_test.go new file mode 100644 index 000000000..2960a35e5 --- /dev/null +++ b/internal/aws/events/connection_resource_gen_test.go @@ -0,0 +1,46 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package events_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSEventsConnection_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Events::Connection", "awscc_events_connection", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + Check: resource.ComposeTestCheckFunc( + td.CheckExistsInAWS(), + ), + }, + { + ResourceName: td.ResourceName, + ImportState: true, + ImportStateVerify: true, + }, + }) +} + +func TestAccAWSEventsConnection_disappears(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Events::Connection", "awscc_events_connection", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + Check: resource.ComposeTestCheckFunc( + td.CheckExistsInAWS(), + td.DeleteResource(), + ), + ExpectNonEmptyPlan: true, + }, + }) +} diff --git a/internal/aws/events/connection_singular_data_source_gen.go b/internal/aws/events/connection_singular_data_source_gen.go new file mode 100644 index 000000000..7a6ad3cf6 --- /dev/null +++ b/internal/aws/events/connection_singular_data_source_gen.go @@ -0,0 +1,579 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package events + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddDataSourceFactory("awscc_events_connection", connectionDataSource) +} + +// connectionDataSource returns the Terraform awscc_events_connection data source. +// This Terraform data source corresponds to the CloudFormation AWS::Events::Connection resource. +func connectionDataSource(ctx context.Context) (datasource.DataSource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Arn + // CloudFormation resource type schema: + // + // { + // "description": "The arn of the connection resource.", + // "type": "string" + // } + "arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The arn of the connection resource.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: AuthParameters + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "oneOf": [ + // { + // "required": [ + // "BasicAuthParameters" + // ] + // }, + // { + // "required": [ + // "OAuthParameters" + // ] + // }, + // { + // "required": [ + // "ApiKeyAuthParameters" + // ] + // } + // ], + // "properties": { + // "ApiKeyAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "ApiKeyName": { + // "type": "string" + // }, + // "ApiKeyValue": { + // "type": "string" + // } + // }, + // "required": [ + // "ApiKeyName", + // "ApiKeyValue" + // ], + // "type": "object" + // }, + // "BasicAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "Password": { + // "type": "string" + // }, + // "Username": { + // "type": "string" + // } + // }, + // "required": [ + // "Username", + // "Password" + // ], + // "type": "object" + // }, + // "InvocationHttpParameters": { + // "additionalProperties": false, + // "properties": { + // "BodyParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "HeaderParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "QueryStringParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // } + // }, + // "type": "object" + // }, + // "OAuthParameters": { + // "additionalProperties": false, + // "properties": { + // "AuthorizationEndpoint": { + // "maxLength": 2048, + // "minLength": 1, + // "type": "string" + // }, + // "ClientParameters": { + // "additionalProperties": false, + // "properties": { + // "ClientID": { + // "type": "string" + // }, + // "ClientSecret": { + // "type": "string" + // } + // }, + // "required": [ + // "ClientID", + // "ClientSecret" + // ], + // "type": "object" + // }, + // "HttpMethod": { + // "enum": [ + // "GET", + // "POST", + // "PUT" + // ], + // "type": "string" + // }, + // "OAuthHttpParameters": { + // "additionalProperties": false, + // "properties": { + // "BodyParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "HeaderParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // }, + // "QueryStringParameters": { + // "items": { + // "additionalProperties": false, + // "properties": { + // "IsValueSecret": { + // "default": true, + // "type": "boolean" + // }, + // "Key": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Key", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array" + // } + // }, + // "type": "object" + // } + // }, + // "required": [ + // "ClientParameters", + // "AuthorizationEndpoint", + // "HttpMethod" + // ], + // "type": "object" + // } + // }, + // "type": "object" + // } + "auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiKeyAuthParameters + "api_key_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiKeyName + "api_key_name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ApiKeyValue + "api_key_value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: BasicAuthParameters + "basic_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Password + "password": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Username + "username": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: InvocationHttpParameters + "invocation_http_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: BodyParameters + "body_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: HeaderParameters + "header_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: QueryStringParameters + "query_string_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: OAuthParameters + "o_auth_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AuthorizationEndpoint + "authorization_endpoint": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ClientParameters + "client_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ClientID + "client_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ClientSecret + "client_secret": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: HttpMethod + "http_method": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: OAuthHttpParameters + "o_auth_http_parameters": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: BodyParameters + "body_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: HeaderParameters + "header_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: QueryStringParameters + "query_string_parameters": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: IsValueSecret + "is_value_secret": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Key + "key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: AuthorizationType + // CloudFormation resource type schema: + // + // { + // "enum": [ + // "API_KEY", + // "BASIC", + // "OAUTH_CLIENT_CREDENTIALS" + // ], + // "type": "string" + // } + "authorization_type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Description + // CloudFormation resource type schema: + // + // { + // "description": "Description of the connection.", + // "maxLength": 512, + // "type": "string" + // } + "description": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Description of the connection.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Name + // CloudFormation resource type schema: + // + // { + // "description": "Name of the connection.", + // "maxLength": 64, + // "minLength": 1, + // "type": "string" + // } + "name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Name of the connection.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: SecretArn + // CloudFormation resource type schema: + // + // { + // "description": "The arn of the secrets manager secret created in the customer account.", + // "type": "string" + // } + "secret_arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The arn of the secrets manager secret created in the customer account.", + Computed: true, + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Required: true, + } + + schema := schema.Schema{ + Description: "Data Source schema for AWS::Events::Connection", + Attributes: attributes, + } + + var opts generic.DataSourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::Events::Connection").WithTerraformTypeName("awscc_events_connection") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "api_key_auth_parameters": "ApiKeyAuthParameters", + "api_key_name": "ApiKeyName", + "api_key_value": "ApiKeyValue", + "arn": "Arn", + "auth_parameters": "AuthParameters", + "authorization_endpoint": "AuthorizationEndpoint", + "authorization_type": "AuthorizationType", + "basic_auth_parameters": "BasicAuthParameters", + "body_parameters": "BodyParameters", + "client_id": "ClientID", + "client_parameters": "ClientParameters", + "client_secret": "ClientSecret", + "description": "Description", + "header_parameters": "HeaderParameters", + "http_method": "HttpMethod", + "invocation_http_parameters": "InvocationHttpParameters", + "is_value_secret": "IsValueSecret", + "key": "Key", + "name": "Name", + "o_auth_http_parameters": "OAuthHttpParameters", + "o_auth_parameters": "OAuthParameters", + "password": "Password", + "query_string_parameters": "QueryStringParameters", + "secret_arn": "SecretArn", + "username": "Username", + "value": "Value", + }) + + v, err := generic.NewSingularDataSource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/events/connection_singular_data_source_gen_test.go b/internal/aws/events/connection_singular_data_source_gen_test.go new file mode 100644 index 000000000..2f251bc81 --- /dev/null +++ b/internal/aws/events/connection_singular_data_source_gen_test.go @@ -0,0 +1,40 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package events_test + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSEventsConnectionDataSource_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Events::Connection", "awscc_events_connection", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithEmptyResourceConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(fmt.Sprintf("data.%s", td.ResourceName), "id", td.ResourceName, "id"), + resource.TestCheckResourceAttrPair(fmt.Sprintf("data.%s", td.ResourceName), "arn", td.ResourceName, "arn"), + ), + }, + }) +} + +func TestAccAWSEventsConnectionDataSource_NonExistent(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Events::Connection", "awscc_events_connection", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithNonExistentIDConfig(), + ExpectError: regexp.MustCompile("Not Found"), + }, + }) +} diff --git a/internal/provider/all_schemas.hcl b/internal/provider/all_schemas.hcl index 95c5105e3..f95fea2a6 100644 --- a/internal/provider/all_schemas.hcl +++ b/internal/provider/all_schemas.hcl @@ -2017,10 +2017,11 @@ resource_schema "aws_events_archive" { resource_schema "aws_events_connection" { cloudformation_type_name = "AWS::Events::Connection" - # Suppression Reason: error creating write-only attribute path (/definitions/BasicAuthParameters/Password): expected "properties" for the second property path segment, got: "definitions" + # Suppression Update: the latest schema refer `Password` with type string. + # Historical suppression Reason: error creating write-only attribute path (/definitions/BasicAuthParameters/Password): expected "properties" for the second property path segment, got: "definitions" # https://github.com/hashicorp/terraform-provider-awscc/issues/1521 - suppress_resource_generation = true - suppress_singular_data_source_generation = true + suppress_resource_generation = false + suppress_singular_data_source_generation = false } resource_schema "aws_events_endpoint" { diff --git a/internal/provider/import_examples_gen.json b/internal/provider/import_examples_gen.json index 8b6155cbe..9fa4be0c4 100644 --- a/internal/provider/import_examples_gen.json +++ b/internal/provider/import_examples_gen.json @@ -2104,6 +2104,11 @@ "identifier": ["ArchiveName"], "path": "./examples/resources/awscc_events_archive/import.sh" }, + { + "resource": "awscc_events_connection", + "identifier": ["Name"], + "path": "./examples/resources/awscc_events_connection/import.sh" + }, { "resource": "awscc_events_endpoint", "identifier": ["Name"], diff --git a/internal/provider/resources.go b/internal/provider/resources.go index ab051d087..0a101c1c9 100644 --- a/internal/provider/resources.go +++ b/internal/provider/resources.go @@ -423,6 +423,7 @@ //go:generate go run generators/resource/main.go -resource awscc_eventschemas_schema -cfschema ../service/cloudformation/schemas/AWS_EventSchemas_Schema.json -package eventschemas -- ../aws/eventschemas/schema_resource_gen.go ../aws/eventschemas/schema_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_events_api_destination -cfschema ../service/cloudformation/schemas/AWS_Events_ApiDestination.json -package events -- ../aws/events/api_destination_resource_gen.go ../aws/events/api_destination_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_events_archive -cfschema ../service/cloudformation/schemas/AWS_Events_Archive.json -package events -- ../aws/events/archive_resource_gen.go ../aws/events/archive_resource_gen_test.go +//go:generate go run generators/resource/main.go -resource awscc_events_connection -cfschema ../service/cloudformation/schemas/AWS_Events_Connection.json -package events -- ../aws/events/connection_resource_gen.go ../aws/events/connection_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_events_endpoint -cfschema ../service/cloudformation/schemas/AWS_Events_Endpoint.json -package events -- ../aws/events/endpoint_resource_gen.go ../aws/events/endpoint_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_events_event_bus -cfschema ../service/cloudformation/schemas/AWS_Events_EventBus.json -package events -- ../aws/events/event_bus_resource_gen.go ../aws/events/event_bus_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_events_rule -cfschema ../service/cloudformation/schemas/AWS_Events_Rule.json -package events -- ../aws/events/rule_resource_gen.go ../aws/events/rule_resource_gen_test.go diff --git a/internal/provider/singular_data_sources.go b/internal/provider/singular_data_sources.go index 7eb0add14..809a2fcbb 100644 --- a/internal/provider/singular_data_sources.go +++ b/internal/provider/singular_data_sources.go @@ -423,6 +423,7 @@ //go:generate go run generators/singular-data-source/main.go -data-source awscc_eventschemas_schema -cfschema ../service/cloudformation/schemas/AWS_EventSchemas_Schema.json -package eventschemas ../aws/eventschemas/schema_singular_data_source_gen.go ../aws/eventschemas/schema_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_events_api_destination -cfschema ../service/cloudformation/schemas/AWS_Events_ApiDestination.json -package events ../aws/events/api_destination_singular_data_source_gen.go ../aws/events/api_destination_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_events_archive -cfschema ../service/cloudformation/schemas/AWS_Events_Archive.json -package events ../aws/events/archive_singular_data_source_gen.go ../aws/events/archive_singular_data_source_gen_test.go +//go:generate go run generators/singular-data-source/main.go -data-source awscc_events_connection -cfschema ../service/cloudformation/schemas/AWS_Events_Connection.json -package events ../aws/events/connection_singular_data_source_gen.go ../aws/events/connection_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_events_endpoint -cfschema ../service/cloudformation/schemas/AWS_Events_Endpoint.json -package events ../aws/events/endpoint_singular_data_source_gen.go ../aws/events/endpoint_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_events_event_bus -cfschema ../service/cloudformation/schemas/AWS_Events_EventBus.json -package events ../aws/events/event_bus_singular_data_source_gen.go ../aws/events/event_bus_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_events_rule -cfschema ../service/cloudformation/schemas/AWS_Events_Rule.json -package events ../aws/events/rule_singular_data_source_gen.go ../aws/events/rule_singular_data_source_gen_test.go diff --git a/templates/resources/events_connection.md.tmpl b/templates/resources/events_connection.md.tmpl new file mode 100644 index 000000000..2aa2d8885 --- /dev/null +++ b/templates/resources/events_connection.md.tmpl @@ -0,0 +1,35 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### Create a connection with ApiKey authorization parameters + +The following example creates a connection named pagerduty-connection using ApiKey authorization and stores a secret from Secrets Manager. + +{{ tffile (printf "examples/resources/%s/connection_with_api_key_authorizer.tf" .Name)}} + +### Create a connection with OAuth authorization parameters + +The following example creates a connection named auth0-connection using OAuth authorization and stores a secret from Secrets Manager. + +{{ tffile (printf "examples/resources/%s/connection_with_oauth_authorizer.tf" .Name)}} + +{{ .SchemaMarkdown | trimspace }} +{{- if .HasImport }} + +## Import + +Import is supported using the following syntax: + +{{ codefile "shell" .ImportFile }} + +{{- end }} \ No newline at end of file