From 32527e5736803a32a75458bac71e887f411d22c2 Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 14:31:04 -0700 Subject: [PATCH 1/9] remove suppression --- internal/provider/all_schemas.hcl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/provider/all_schemas.hcl b/internal/provider/all_schemas.hcl index 1a384abb2..008c56c64 100644 --- a/internal/provider/all_schemas.hcl +++ b/internal/provider/all_schemas.hcl @@ -2002,10 +2002,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" { From ad42eb3652fdac768eb04f9fd7ba763df2dbf881 Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 14:31:20 -0700 Subject: [PATCH 2/9] make schemas --- internal/provider/import_examples_gen.json | 5 +++++ internal/provider/resources.go | 1 + internal/provider/singular_data_sources.go | 1 + 3 files changed, 7 insertions(+) diff --git a/internal/provider/import_examples_gen.json b/internal/provider/import_examples_gen.json index 18f2582e3..ad8955e4c 100644 --- a/internal/provider/import_examples_gen.json +++ b/internal/provider/import_examples_gen.json @@ -2089,6 +2089,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 0fdb24d00..34cd67525 100644 --- a/internal/provider/resources.go +++ b/internal/provider/resources.go @@ -420,6 +420,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 addb6af23..532cddf15 100644 --- a/internal/provider/singular_data_sources.go +++ b/internal/provider/singular_data_sources.go @@ -420,6 +420,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 From 4eca93af91c55a4b29a0d32d250387d630dd52ae Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 16:30:30 -0700 Subject: [PATCH 3/9] make resources --- .../aws/events/connection_resource_gen.go | 720 ++++++++++++++++++ .../events/connection_resource_gen_test.go | 46 ++ 2 files changed, 766 insertions(+) create mode 100644 internal/aws/events/connection_resource_gen.go create mode 100644 internal/aws/events/connection_resource_gen_test.go diff --git a/internal/aws/events/connection_resource_gen.go b/internal/aws/events/connection_resource_gen.go new file mode 100644 index 000000000..31214a047 --- /dev/null +++ b/internal/aws/events/connection_resource_gen.go @@ -0,0 +1,720 @@ +// 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" +) + +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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: ApiKeyValue + "api_key_value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Username + "username": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.LengthBetween(1, 2048), + }, /*END VALIDATORS*/ + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: ClientSecret + "client_secret": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: HttpMethod + "http_method": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.OneOf( + "GET", + "POST", + "PUT", + ), + }, /*END VALIDATORS*/ + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*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, + }, + }) +} From 5cc12dbce631fd98e7f7ed8afde3309919246174 Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 16:30:41 -0700 Subject: [PATCH 4/9] make singular data source --- .../connection_singular_data_source_gen.go | 579 ++++++++++++++++++ ...onnection_singular_data_source_gen_test.go | 40 ++ 2 files changed, 619 insertions(+) create mode 100644 internal/aws/events/connection_singular_data_source_gen.go create mode 100644 internal/aws/events/connection_singular_data_source_gen_test.go 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"), + }, + }) +} From 09f38eb8dfc51193d4a2922f490fd60f41090160 Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 18:35:40 -0700 Subject: [PATCH 5/9] make docs --- docs/resources/events_connection.md | 238 ++++++++++++++++++ .../connection_with_api_key_authorizer.tf | 17 ++ .../connection_with_oauth_authorizer.tf | 25 ++ .../awscc_events_connection/import.sh | 1 + templates/resources/events_connection.md.tmpl | 35 +++ 5 files changed, 316 insertions(+) create mode 100644 docs/resources/events_connection.md create mode 100644 examples/resources/awscc_events_connection/connection_with_api_key_authorizer.tf create mode 100644 examples/resources/awscc_events_connection/connection_with_oauth_authorizer.tf create mode 100644 examples/resources/awscc_events_connection/import.sh create mode 100644 templates/resources/events_connection.md.tmpl diff --git a/docs/resources/events_connection.md b/docs/resources/events_connection.md new file mode 100644 index 000000000..b78007e25 --- /dev/null +++ b/docs/resources/events_connection.md @@ -0,0 +1,238 @@ +--- +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` + +Required: + +- `api_key_name` (String) +- `api_key_value` (String) + + + +### Nested Schema for `auth_parameters.basic_auth_parameters` + +Required: + +- `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` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.header_parameters` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + + + +### Nested Schema for `auth_parameters.invocation_http_parameters.query_string_parameters` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + + + + +### Nested Schema for `auth_parameters.o_auth_parameters` + +Required: + +- `authorization_endpoint` (String) +- `client_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--client_parameters)) +- `http_method` (String) + +Optional: + +- `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` + +Required: + +- `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` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.header_parameters` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + + + +### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.query_string_parameters` + +Required: + +- `key` (String) +- `value` (String) + +Optional: + +- `is_value_secret` (Boolean) + +## 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/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 From 9f8405d9496c877c866cba7589cc3620e10e4b1b Mon Sep 17 00:00:00 2001 From: wellsiau-aws Date: Fri, 6 Sep 2024 19:22:15 -0700 Subject: [PATCH 6/9] singular data source --- docs/data-sources/events_connection.md | 154 +++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 docs/data-sources/events_connection.md 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) From e9e7a2a68f612a1d300af88a8589513fbc633606 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 23 Sep 2024 13:36:20 -0500 Subject: [PATCH 7/9] run make resources --- .../aws/events/connection_resource_gen.go | 186 ++++++++++++++++-- 1 file changed, 165 insertions(+), 21 deletions(-) diff --git a/internal/aws/events/connection_resource_gen.go b/internal/aws/events/connection_resource_gen.go index 31214a047..9307f91b0 100644 --- a/internal/aws/events/connection_resource_gen.go +++ b/internal/aws/events/connection_resource_gen.go @@ -20,6 +20,7 @@ import ( "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() { @@ -299,11 +300,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ // Property: ApiKeyName "api_key_name": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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, @@ -317,11 +332,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ // Property: Password "password": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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, @@ -348,11 +377,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -377,11 +420,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -406,11 +463,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -432,35 +503,66 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ // Property: AuthorizationEndpoint "authorization_endpoint": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ - Required: true, + 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*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -480,11 +582,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -509,11 +625,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ @@ -538,11 +668,25 @@ func connectionResource(ctx context.Context) (resource.Resource, error) { }, /*END ATTRIBUTE*/ // Property: Key "key": schema.StringAttribute{ /*START ATTRIBUTE*/ - Required: true, + 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*/ - Required: true, + 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*/ From 76199bc113bac184bc63266691fe229b84f60a1f Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 23 Sep 2024 13:37:49 -0500 Subject: [PATCH 8/9] run make docs --- docs/resources/events_connection.md | 53 +++++++++-------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/docs/resources/events_connection.md b/docs/resources/events_connection.md index b78007e25..9fd4561da 100644 --- a/docs/resources/events_connection.md +++ b/docs/resources/events_connection.md @@ -96,7 +96,7 @@ Optional: ### Nested Schema for `auth_parameters.api_key_auth_parameters` -Required: +Optional: - `api_key_name` (String) - `api_key_value` (String) @@ -105,7 +105,7 @@ Required: ### Nested Schema for `auth_parameters.basic_auth_parameters` -Required: +Optional: - `password` (String) - `username` (String) @@ -123,60 +123,48 @@ Optional: ### Nested Schema for `auth_parameters.invocation_http_parameters.body_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ### Nested Schema for `auth_parameters.invocation_http_parameters.header_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ### Nested Schema for `auth_parameters.invocation_http_parameters.query_string_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ### Nested Schema for `auth_parameters.o_auth_parameters` -Required: +Optional: - `authorization_endpoint` (String) - `client_parameters` (Attributes) (see [below for nested schema](#nestedatt--auth_parameters--o_auth_parameters--client_parameters)) - `http_method` (String) - -Optional: - - `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` -Required: +Optional: - `client_id` (String) - `client_secret` (String) @@ -194,40 +182,31 @@ Optional: ### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.body_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.header_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ### Nested Schema for `auth_parameters.o_auth_parameters.o_auth_http_parameters.query_string_parameters` -Required: - -- `key` (String) -- `value` (String) - Optional: - `is_value_secret` (Boolean) +- `key` (String) +- `value` (String) ## Import From d89d07d9af008dcc557df12e672ad5a9eb449d2a Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 23 Sep 2024 14:03:31 -0500 Subject: [PATCH 9/9] add CHANGELOG entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) 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: