diff --git a/aws/table_aws_elastic_beanstalk_environment.go b/aws/table_aws_elastic_beanstalk_environment.go index 2bcb5dbc2..d44f19c7a 100644 --- a/aws/table_aws_elastic_beanstalk_environment.go +++ b/aws/table_aws_elastic_beanstalk_environment.go @@ -131,6 +131,13 @@ func tableAwsElasticBeanstalkEnvironment(_ context.Context) *plugin.Table { Description: "The application version deployed in this environment.", Type: proto.ColumnType_STRING, }, + { + Name: "configuration_settings", + Description: "Returns a description of the settings for the specified configuration set, that is, either a configuration template or the configuration set associated with a running environment.", + Type: proto.ColumnType_JSON, + Hydrate: getAwsElasticBeanstalkConfigurationSettings, + Transform: transform.FromValue(), + }, { Name: "environment_links", Description: "A list of links to other environments in the same group.", @@ -331,6 +338,39 @@ func getAwsElasticBeanstalkEnvironmentManagedActions(ctx context.Context, d *plu return nil, nil } +func getAwsElasticBeanstalkConfigurationSettings(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { + // Create Session + svc, err := ElasticBeanstalkClient(ctx, d) + if err != nil { + plugin.Logger(ctx).Error("elastic_beanstalk_environment.getAwsElasticBeanstalkConfigurationSettings", "connection_error", err) + return nil, err + } + + env := h.Item.(types.EnvironmentDescription) + // Build params + params := &elasticbeanstalk.DescribeConfigurationSettingsInput{ + ApplicationName: env.ApplicationName, + EnvironmentName: env.EnvironmentName, + } + + configurationSettings, err := svc.DescribeConfigurationSettings(ctx, params) + if err != nil { + var ae smithy.APIError + if errors.As(err, &ae) { + if ae.ErrorCode() == "InvalidParameterValue" { + return nil, nil + } + } + plugin.Logger(ctx).Error("elastic_beanstalk_environment.getAwsElasticBeanstalkConfigurationSettings", "api_error", err) + return nil, err + } + + if configurationSettings != nil && len(configurationSettings.ConfigurationSettings) > 0 { + return configurationSettings.ConfigurationSettings, nil + } + return nil, nil +} + func listElasticBeanstalkEnvironmentTags(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { resourceArn := h.Item.(types.EnvironmentDescription).EnvironmentArn diff --git a/docs/tables/aws_elastic_beanstalk_environment.md b/docs/tables/aws_elastic_beanstalk_environment.md index 683792a89..238c4a5d2 100644 --- a/docs/tables/aws_elastic_beanstalk_environment.md +++ b/docs/tables/aws_elastic_beanstalk_environment.md @@ -68,4 +68,26 @@ select from aws_elastic_beanstalk_environment, jsonb_array_elements(managed_actions) as a; +``` + +### list the configuration settings for each environment + +```sql +select + environment_name, + application_name, + c ->> 'DateCreated' as date_created, + c ->> 'DateUpdated' as date_updated, + c ->> 'DeploymentStatus' as deployment_status, + c ->> 'Description' as description, + c -> 'OptionSettings' ->> 'Namespace' as option_settings_namespace, + c -> 'OptionSettings' ->> 'OptionName' as option_name, + c -> 'OptionSettings' ->> 'ResourceName' as option_resource_name, + c -> 'OptionSettings' ->> 'Value' as option_value, + c ->> 'PlatformArn' as platform_arn, + c ->> 'SolutionStackName' as solution_stack_name, + c ->> 'TemplateName' as template_name +from + aws_elastic_beanstalk_environment, + jsonb_array_elements(configuration_settings) as c; ``` \ No newline at end of file