Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: data/aws_cloudwatch_log_group #3247

Closed
jkroepke opened this issue Feb 4, 2018 · 3 comments
Closed

FR: data/aws_cloudwatch_log_group #3247

jkroepke opened this issue Feb 4, 2018 · 3 comments
Labels
new-data-source Introduces a new data source.
Milestone

Comments

@jkroepke
Copy link

jkroepke commented Feb 4, 2018

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.3

  • provider.aws v1.8.0
  • provider.local v1.0.0
  • provider.null v1.0.0
  • provider.template v1.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • d/aws_cloudwatch_log_group

Hi,

For the API Gateway, amazon create automaticly Cloudwatch Log Groups based on the aws gw id (e.g.)

I want to import the Log Group and apply additional configurations. Thats why i'm need the aws_cloudwatch_log_group data source.

@bflad
Copy link
Contributor

bflad commented Feb 5, 2018

Hi @jkroepke, you specifically are mentioning the following:

I want to import the Log Group and apply additional configurations.

In Terraform's configuration model this is handled by a resource, not a data source. Think of data sources as read-only information about AWS itself or your infrastructure.

The documentation for the existing aws_cloudwatch_log_group resource has information on importing an existing CloudWatch log group into Terraform.

With an example configuration such as:

resource "aws_api_gateway_rest_api" "example" {
  name = "example"
  # ... other configuration ...
}

resource "aws_api_gateway_stage" "example" {
  stage_name = "example"
  rest_api_id = "${aws_api_gateway_rest_api.example.id}"
  # ... other configuration ...
}

# This should work as a configuration when importing (it if it exists)
# However, could have issues if being created the same time as above
resource "aws_cloudwatch_log_group" "example" {
  name = "API-Gateway-Execution-Logs_${aws_api_gateway_rest_api.example.id}/${aws_api_gateway_stage.example.stage_name}"
  # ... other configuration ...
}

You might be have some trouble doing this automatically when the API Gateway is created at the same time as the CloudWatch log group though. AWS might create the log group automatically before Terraform does, in which Terraform will throw an error on creating the log group. If that is your situation, please let us know.

@bflad bflad added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/apigateway Issues and PRs that pertain to the apigateway service. labels Feb 5, 2018
sjauld pushed a commit to sjauld/terraform-provider-aws that referenced this issue Apr 11, 2018
@bflad
Copy link
Contributor

bflad commented Apr 18, 2018

The aws_cloudwatch_log_group data source has been released in version 1.15.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@bflad bflad closed this as completed Apr 18, 2018
@bflad bflad added this to the v1.15.0 milestone Apr 18, 2018
@bflad bflad added new-data-source Introduces a new data source. service/cloudwatchlogs and removed question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/apigateway Issues and PRs that pertain to the apigateway service. labels Apr 18, 2018
@ghost
Copy link

ghost commented Apr 6, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source.
Projects
None yet
Development

No branches or pull requests

2 participants