hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.84k stars 9.19k forks source link

Cloudformation Type Configuration #22061

Closed webratz closed 10 months ago

webratz commented 2 years ago

Community Note

Description

It should be possible to set the configuration of a Cloudformation type. This could be either by extending aws_cloudformation_type (see docs or creating a new resource. The underlying AWS API is documented at https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SetTypeConfiguration.html

New or Affected Resource(s)

Potential Terraform Configuration

# this already exists, just for reference
resource "aws_cloudformation_type" "datadogdashboard" {
  schema_handler_package = "s3://datadog-cloudformation-resources/datadog-dashboards-dashboard/datadog-dashboards-dashboard-2.0.2.zip"
  type                   = "RESOURCE"
  type_name              = "Datadog::Dashboards::Dashboard"

  lifecycle {
    create_before_destroy = true
  }
}

# the new configuration
resource "aws_cloudformation_type_config" "datadogdashboardconfig" {
  type_arn = aws_cloudformation_type.datadogdashboard.arn
  configuration = jsonencode({
    DatadogCredentials = {
      "ApiURL"         = "https://api.datadoghq.eu",
      "ApiKey"         = "{{resolve:secretsmanager:MySecret:SecretString:SecretAPIKey}}",
      "ApplicationKey" = "{{resolve:secretsmanager:MySecret:SecretString:SecretAppKey}}"
    }
  })
}

References

Example of related aws cli call

aws cloudformation set-type-configuration \
    --type-name "${DATADOG_RESOURCE_NAME}" \
    --type RESOURCE \
    --configuration '{"DatadogCredentials": {"ApiURL": "https://api.datadoghq.eu", "ApiKey": "{{resolve:secretsmanager:Datadog:SecretString:APIKey}}", "ApplicationKey": "{{resolve:secretsmanager:Datadog:SecretString:AppKey}}"}}'
DrFaust92 commented 2 years ago

Random semi related comment. While the above might be useful in general. For the datadog example you can use https://registry.terraform.io/providers/DataDog/datadog/latest/docs

webratz commented 2 years ago

Thats right, but the use case here is to make it available via cloudformation for some other use case

github-actions[bot] commented 11 months ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

github-actions[bot] commented 9 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.