diff --git a/.github/workflows/test_terraform.yml b/.github/workflows/test_terraform.yml
index 015b88998..3c05362bb 100644
--- a/.github/workflows/test_terraform.yml
+++ b/.github/workflows/test_terraform.yml
@@ -29,12 +29,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.8"
- # FIXME: pinned because of https://github.com/hashicorp/terraform-provider-aws/issues/27049
- - name: Install terraform
- uses: hashicorp/setup-terraform@v2
- with:
- terraform_version: "1.2.9"
- terraform_wrapper: "false"
- name: Start MotoServer
run: |
pip install PyYAML
diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md
index 197d7ba0e..4e2ca6834 100644
--- a/IMPLEMENTATION_COVERAGE.md
+++ b/IMPLEMENTATION_COVERAGE.md
@@ -22,18 +22,18 @@
## amp
-61% implemented
+80% implemented
- [ ] create_alert_manager_definition
-- [ ] create_logging_configuration
+- [X] create_logging_configuration
- [X] create_rule_groups_namespace
- [X] create_workspace
- [ ] delete_alert_manager_definition
-- [ ] delete_logging_configuration
+- [X] delete_logging_configuration
- [X] delete_rule_groups_namespace
- [X] delete_workspace
- [ ] describe_alert_manager_definition
-- [ ] describe_logging_configuration
+- [X] describe_logging_configuration
- [X] describe_rule_groups_namespace
- [X] describe_workspace
- [X] list_rule_groups_namespaces
@@ -43,7 +43,7 @@
- [X] put_rule_groups_namespace
- [X] tag_resource
- [X] untag_resource
-- [ ] update_logging_configuration
+- [X] update_logging_configuration
- [X] update_workspace_alias
diff --git a/docs/docs/services/amp.rst b/docs/docs/services/amp.rst
index 7dec8bd6e..accd65239 100644
--- a/docs/docs/services/amp.rst
+++ b/docs/docs/services/amp.rst
@@ -28,7 +28,7 @@ amp
|start-h3| Implemented features for this service |end-h3|
- [ ] create_alert_manager_definition
-- [ ] create_logging_configuration
+- [X] create_logging_configuration
- [X] create_rule_groups_namespace
The ClientToken-parameter is not yet implemented
@@ -40,7 +40,7 @@ amp
- [ ] delete_alert_manager_definition
-- [ ] delete_logging_configuration
+- [X] delete_logging_configuration
- [X] delete_rule_groups_namespace
The ClientToken-parameter is not yet implemented
@@ -52,7 +52,7 @@ amp
- [ ] describe_alert_manager_definition
-- [ ] describe_logging_configuration
+- [X] describe_logging_configuration
- [X] describe_rule_groups_namespace
- [X] describe_workspace
- [X] list_rule_groups_namespaces
@@ -66,7 +66,7 @@ amp
- [X] tag_resource
- [X] untag_resource
-- [ ] update_logging_configuration
+- [X] update_logging_configuration
- [X] update_workspace_alias
The ClientToken-parameter is not yet implemented
diff --git a/moto/amp/models.py b/moto/amp/models.py
index 032b7819a..0b7a3b8b0 100644
--- a/moto/amp/models.py
+++ b/moto/amp/models.py
@@ -5,7 +5,7 @@ from moto.core.utils import BackendDict, unix_time
from moto.moto_api._internal import mock_random
from moto.utilities.paginator import paginate
from moto.utilities.tagging_service import TaggingService
-from typing import Any, Callable, Dict, List
+from typing import Any, Callable, Dict, List, Optional
from .exceptions import RuleGroupNamespaceNotFound, WorkspaceNotFound
from .utils import PAGINATION_MODEL
@@ -59,6 +59,7 @@ class Workspace(BaseModel):
self.created_at = unix_time()
self.tag_fn = tag_fn
self.rule_group_namespaces: Dict[str, RuleGroupNamespace] = dict()
+ self.logging_config: Optional[Dict[str, Any]] = None
def to_dict(self) -> Dict[str, Any]:
return {
@@ -182,5 +183,35 @@ class PrometheusServiceBackend(BaseBackend):
]
return list(ws.rule_group_namespaces.values())
+ def create_logging_configuration(
+ self, workspace_id: str, log_group_arn: str
+ ) -> Dict[str, str]:
+ ws = self.describe_workspace(workspace_id)
+ ws.logging_config = {
+ "logGroupArn": log_group_arn,
+ "createdAt": unix_time(),
+ "status": {"statusCode": "ACTIVE"},
+ "workspace": workspace_id,
+ }
+ return ws.logging_config["status"]
+
+ def describe_logging_configuration(self, workspace_id: str) -> Dict[str, Any]:
+ ws = self.describe_workspace(workspace_id)
+ if ws.logging_config is None:
+ return {}
+ return ws.logging_config
+
+ def delete_logging_configuration(self, workspace_id: str) -> None:
+ ws = self.describe_workspace(workspace_id)
+ ws.logging_config = None
+
+ def update_logging_configuration(
+ self, workspace_id: str, log_group_arn: str
+ ) -> Dict[str, str]:
+ ws = self.describe_workspace(workspace_id)
+ ws.logging_config["logGroupArn"] = log_group_arn # type: ignore[index]
+ ws.logging_config["modifiedAt"] = unix_time() # type: ignore[index]
+ return ws.logging_config["status"] # type: ignore[index]
+
amp_backends = BackendDict(PrometheusServiceBackend, "amp")
diff --git a/moto/amp/responses.py b/moto/amp/responses.py
index cab5cab32..feed0092d 100644
--- a/moto/amp/responses.py
+++ b/moto/amp/responses.py
@@ -140,3 +140,32 @@ class PrometheusServiceResponse(BaseResponse):
ruleGroupsNamespaces=[ns.to_dict() for ns in namespaces],
)
)
+
+ def create_logging_configuration(self) -> str:
+ workspace_id = unquote(self.path).split("/")[-2]
+ log_group_arn = self._get_param("logGroupArn")
+ status = self.amp_backend.create_logging_configuration(
+ workspace_id=workspace_id,
+ log_group_arn=log_group_arn,
+ )
+ return json.dumps({"status": status})
+
+ def describe_logging_configuration(self) -> str:
+ workspace_id = unquote(self.path).split("/")[-2]
+ config = self.amp_backend.describe_logging_configuration(
+ workspace_id=workspace_id
+ )
+ return json.dumps({"loggingConfiguration": config})
+
+ def update_logging_configuration(self) -> str:
+ workspace_id = unquote(self.path).split("/")[-2]
+ log_group_arn = self._get_param("logGroupArn")
+ status = self.amp_backend.update_logging_configuration(
+ workspace_id=workspace_id, log_group_arn=log_group_arn
+ )
+ return json.dumps({"status": status})
+
+ def delete_logging_configuration(self) -> str:
+ workspace_id = unquote(self.path).split("/")[-2]
+ self.amp_backend.delete_logging_configuration(workspace_id=workspace_id)
+ return "{}"
diff --git a/moto/amp/urls.py b/moto/amp/urls.py
index b18f717a7..0b9abd365 100644
--- a/moto/amp/urls.py
+++ b/moto/amp/urls.py
@@ -13,6 +13,7 @@ url_paths = {
"{0}/workspaces$": response.dispatch,
"{0}/workspaces/(?P[^/]+)$": response.dispatch,
"{0}/workspaces/(?P[^/]+)/alias$": response.dispatch,
+ "{0}/workspaces/(?P[^/]+)/logging$": response.dispatch,
"{0}/workspaces/(?P[^/]+)/rulegroupsnamespaces$": response.dispatch,
"{0}/workspaces/(?P[^/]+)/rulegroupsnamespaces/(?P[^/]+)$": response.dispatch,
"{0}/tags/(?P[^/]+)$": response.dispatch,
diff --git a/moto/ec2/models/vpcs.py b/moto/ec2/models/vpcs.py
index a79b2f777..cc10fd5cb 100644
--- a/moto/ec2/models/vpcs.py
+++ b/moto/ec2/models/vpcs.py
@@ -169,6 +169,7 @@ class VPC(TaggedEC2Resource, CloudFormationModel):
# This attribute is set to 'true' only for default VPCs
# or VPCs created using the wizard of the VPC console
self.enable_dns_hostnames = "true" if is_default else "false"
+ self.enable_network_address_usage_metrics = "false"
self.associate_vpc_cidr_block(cidr_block)
if amazon_provided_ipv6_cidr_block:
@@ -466,7 +467,11 @@ class VPCBackend:
def describe_vpc_attribute(self, vpc_id, attr_name):
vpc = self.get_vpc(vpc_id)
- if attr_name in ("enable_dns_support", "enable_dns_hostnames"):
+ if attr_name in (
+ "enable_dns_support",
+ "enable_dns_hostnames",
+ "enable_network_address_usage_metrics",
+ ):
return getattr(vpc, attr_name)
else:
raise InvalidParameterValueError(attr_name)
@@ -493,7 +498,11 @@ class VPCBackend:
def modify_vpc_attribute(self, vpc_id, attr_name, attr_value):
vpc = self.get_vpc(vpc_id)
- if attr_name in ("enable_dns_support", "enable_dns_hostnames"):
+ if attr_name in (
+ "enable_dns_support",
+ "enable_dns_hostnames",
+ "enable_network_address_usage_metrics",
+ ):
setattr(vpc, attr_name, attr_value)
else:
raise InvalidParameterValueError(attr_name)
diff --git a/tests/terraformtests/etc/0007-Comprehend-Reduce-wait-times.patch b/tests/terraformtests/etc/0007-Comprehend-Reduce-wait-times.patch
index c8ba7c900..a2fbfb1f6 100644
--- a/tests/terraformtests/etc/0007-Comprehend-Reduce-wait-times.patch
+++ b/tests/terraformtests/etc/0007-Comprehend-Reduce-wait-times.patch
@@ -1,60 +1,49 @@
-From ba338bc6eff2276671b8fd8e61c5a1aceab96112 Mon Sep 17 00:00:00 2001
+From 01a50d07400ee7513b31ec10e9832a2d8290b4e2 Mon Sep 17 00:00:00 2001
From: Bert Blommers
-Date: Tue, 4 Oct 2022 19:00:11 +0000
-Subject: [PATCH] Patch: Reduce Comprehend timings
+Date: Sat, 22 Oct 2022 13:25:17 +0000
+Subject: [PATCH] Patch: Comprehend timings
---
- internal/service/comprehend/common_model.go | 2 +-
- internal/service/comprehend/consts.go | 6 +++---
- internal/service/comprehend/entity_recognizer.go | 6 +++---
- 3 files changed, 7 insertions(+), 7 deletions(-)
+ internal/service/comprehend/common_model.go | 2 +-
+ internal/service/comprehend/consts.go | 12 ++++++------
+ 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/internal/service/comprehend/common_model.go b/internal/service/comprehend/common_model.go
-index 7fa0c1022f..eb6b7c9265 100644
+index 034314bdcc..03a29aa3c2 100644
--- a/internal/service/comprehend/common_model.go
+++ b/internal/service/comprehend/common_model.go
-@@ -57,7 +57,7 @@ func waitNetworkInterfaceCreated(ctx context.Context, conn *ec2.EC2, initialENII
+@@ -60,7 +60,7 @@ func waitNetworkInterfaceCreated(ctx context.Context, conn *ec2.EC2, initialENII
Pending: []string{},
Target: []string{ec2.NetworkInterfaceStatusInUse},
Refresh: statusNetworkInterfaces(ctx, conn, initialENIIds, securityGroups, subnets),
- Delay: 4 * time.Minute,
-+ Delay: 40 * time.Second,
++ Delay: 4 * time.Second,
MinTimeout: 10 * time.Second,
Timeout: timeout,
}
diff --git a/internal/service/comprehend/consts.go b/internal/service/comprehend/consts.go
-index 8c926987a4..2420b78dcc 100644
+index e57884a12d..df5fd0678b 100644
--- a/internal/service/comprehend/consts.go
+++ b/internal/service/comprehend/consts.go
-@@ -4,8 +4,8 @@ import (
- "time"
- )
-
--const iamPropagationTimeout = 2 * time.Minute
-+const iamPropagationTimeout = 20 * time.Second
-
+@@ -7,12 +7,12 @@ import (
+ const iamPropagationTimeout = 2 * time.Minute
+
// Avoid service throttling
--const entityRegcognizerDelay = 1 * time.Minute
+-const entityRegcognizerCreatedDelay = 10 * time.Minute
++const entityRegcognizerCreatedDelay = 10 * time.Second
+ const entityRegcognizerStoppedDelay = 0
+-const entityRegcognizerDeletedDelay = 5 * time.Minute
-const entityRegcognizerPollInterval = 1 * time.Minute
-+const entityRegcognizerDelay = 10 * time.Second
-+const entityRegcognizerPollInterval = 10 * time.Second
-diff --git a/internal/service/comprehend/entity_recognizer.go b/internal/service/comprehend/entity_recognizer.go
-index 119bf790db..3e953427af 100644
---- a/internal/service/comprehend/entity_recognizer.go
-+++ b/internal/service/comprehend/entity_recognizer.go
-@@ -42,9 +42,9 @@ func ResourceEntityRecognizer() *schema.Resource {
- },
-
- Timeouts: &schema.ResourceTimeout{
-- Create: schema.DefaultTimeout(60 * time.Minute),
-- Update: schema.DefaultTimeout(60 * time.Minute),
-- Delete: schema.DefaultTimeout(30 * time.Minute),
-+ Create: schema.DefaultTimeout(60 * time.Second),
-+ Update: schema.DefaultTimeout(60 * time.Second),
-+ Delete: schema.DefaultTimeout(30 * time.Second),
- },
-
- Schema: map[string]*schema.Schema{
++const entityRegcognizerDeletedDelay = 5 * time.Second
++const entityRegcognizerPollInterval = 1 * time.Second
+
+-const documentClassifierCreatedDelay = 15 * time.Minute
++const documentClassifierCreatedDelay = 15 * time.Second
+ const documentClassifierStoppedDelay = 0
+-const documentClassifierDeletedDelay = 5 * time.Minute
+-const documentClassifierPollInterval = 1 * time.Minute
++const documentClassifierDeletedDelay = 5 * time.Second
++const documentClassifierPollInterval = 1 * time.Second
--
2.25.1
diff --git a/tests/terraformtests/terraform-provider-aws b/tests/terraformtests/terraform-provider-aws
index 6020c871a..f9a6db6e3 160000
--- a/tests/terraformtests/terraform-provider-aws
+++ b/tests/terraformtests/terraform-provider-aws
@@ -1 +1 @@
-Subproject commit 6020c871a99278bc855638a801e662328ab2b342
+Subproject commit f9a6db6e3c3f3299701747972fd6c37ba4af36f4
diff --git a/tests/terraformtests/terraform-tests.success.txt b/tests/terraformtests/terraform-tests.success.txt
index d66058a7d..6b7b0ae46 100644
--- a/tests/terraformtests/terraform-tests.success.txt
+++ b/tests/terraformtests/terraform-tests.success.txt
@@ -39,7 +39,13 @@ autoscaling:
- TestAccAutoScalingGroup_mixedInstancesPolicy
- TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance
- TestAccAutoScalingLaunchConfigurationDataSource
- - TestAccAutoScalingLaunchConfiguration_
+ - TestAccAutoScalingLaunchConfiguration_AssociatePublicIPAddress
+ - TestAccAutoScalingLaunchConfiguration_EBS_noDevice
+ - TestAccAutoScalingLaunchConfiguration_userData
+ - TestAccAutoScalingLaunchConfiguration_metadataOptions
+ - TestAccAutoScalingLaunchConfiguration_with
+ - TestAccAutoScalingLaunchConfiguration_encryptedEBSBlockDevice
+ - TestAccAutoScalingLaunchConfiguration_encryptedRootBlockDevice
batch:
- TestAccBatchJobDefinition
- TestAccBatchJobQueue_basic
@@ -76,7 +82,14 @@ cognitoidp:
- TestAccCognitoIDPUser_
- TestAccCognitoIDPUserPoolClients
comprehend:
- - TestAccComprehendEntityRecognizer
+ - TestAccComprehendEntityRecognizer_basic
+ - TestAccComprehendEntityRecognizer_disappears
+ - TestAccComprehendEntityRecognizer_version
+ - TestAccComprehendEntityRecognizer_documents
+ - TestAccComprehendEntityRecognizer_annotations
+ - TestAccComprehendEntityRecognizer_tags
+ - TestAccComprehendEntityRecognizer_DefaultTags
+ - TestAccComprehendEntityRecognizer_KMSKeys
dax:
- TestAccDAXCluster_basic
- TestAccDAXCluster_Encryption
@@ -95,7 +108,6 @@ ec2:
- TestAccEC2VPCsDataSource
- TestAccEC2VPNGateway_
- TestAccEC2VPNGatewayAttachment_
- - TestAccVPC_
- TestAccVPCEgressOnlyInternetGateway_
- TestAccVPCInternetGateway
- TestAccVPCNATGateway_
diff --git a/tests/test_amp/test_amp_logging_config.py b/tests/test_amp/test_amp_logging_config.py
new file mode 100644
index 000000000..ba82539e3
--- /dev/null
+++ b/tests/test_amp/test_amp_logging_config.py
@@ -0,0 +1,61 @@
+import boto3
+import sys
+import unittest
+from moto import mock_amp
+
+
+@mock_amp
+class TestAmpLoggingConfig(unittest.TestCase):
+ def setUp(self) -> None:
+ if sys.version_info < (3, 7):
+ raise unittest.SkipTest(
+ "Cannot test this in Py3.6; outdated botocore dependencies do not yet support this feature"
+ )
+ self.client = boto3.client("amp", region_name="us-east-2")
+
+ workspace = self.client.create_workspace(alias="test", tags={"t": "v"})
+ self.workspace_id = workspace["workspaceId"]
+
+ def test_describe_logging(self):
+ resp = self.client.describe_logging_configuration(workspaceId=self.workspace_id)
+ resp.should.have.key("loggingConfiguration").equals({})
+
+ def test_create_logging(self):
+ resp = self.client.create_logging_configuration(
+ workspaceId=self.workspace_id, logGroupArn="log/arn"
+ )
+ resp.should.have.key("status").equals({"statusCode": "ACTIVE"})
+
+ resp = self.client.describe_logging_configuration(
+ workspaceId=self.workspace_id
+ )["loggingConfiguration"]
+ resp.should.have.key("createdAt")
+ resp.should.have.key("logGroupArn").equals("log/arn")
+ resp.should.have.key("status").equals({"statusCode": "ACTIVE"})
+ resp.should.have.key("workspace").equals(self.workspace_id)
+
+ def test_update_logging(self):
+ self.client.create_logging_configuration(
+ workspaceId=self.workspace_id, logGroupArn="log/arn"
+ )
+
+ resp = self.client.update_logging_configuration(
+ workspaceId=self.workspace_id, logGroupArn="log/arn2"
+ )
+ resp.should.have.key("status").equals({"statusCode": "ACTIVE"})
+
+ resp = self.client.describe_logging_configuration(
+ workspaceId=self.workspace_id
+ )["loggingConfiguration"]
+ resp.should.have.key("modifiedAt")
+ resp.should.have.key("logGroupArn").equals("log/arn2")
+
+ def test_delete_logging(self):
+ resp = self.client.create_logging_configuration(
+ workspaceId=self.workspace_id, logGroupArn="log/arn"
+ )
+
+ self.client.delete_logging_configuration(workspaceId=self.workspace_id)
+
+ resp = self.client.describe_logging_configuration(workspaceId=self.workspace_id)
+ resp.should.have.key("loggingConfiguration").equals({})